]> scripts.mit.edu Git - autoinstalls/wordpress.git/commitdiff
Wordpress 3.0 wordpress-3.0
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 19 Jun 2010 09:15:44 +0000 (02:15 -0700)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 19 Jun 2010 09:15:44 +0000 (02:15 -0700)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
534 files changed:
readme.html
wp-activate.php [new file with mode: 0644]
wp-admin/admin-ajax.php
wp-admin/admin-footer.php
wp-admin/admin-header.php
wp-admin/admin.php
wp-admin/async-upload.php
wp-admin/categories.php [deleted file]
wp-admin/comment.php
wp-admin/css/colors-classic-rtl.css
wp-admin/css/colors-classic-rtl.dev.css [new file with mode: 0644]
wp-admin/css/colors-classic.css
wp-admin/css/colors-classic.dev.css
wp-admin/css/colors-fresh-rtl.css
wp-admin/css/colors-fresh-rtl.dev.css [new file with mode: 0644]
wp-admin/css/colors-fresh.css
wp-admin/css/colors-fresh.dev.css
wp-admin/css/dashboard-rtl.css
wp-admin/css/dashboard-rtl.dev.css [new file with mode: 0644]
wp-admin/css/dashboard.css
wp-admin/css/dashboard.dev.css
wp-admin/css/global-rtl.css
wp-admin/css/global-rtl.dev.css [new file with mode: 0644]
wp-admin/css/global.css
wp-admin/css/global.dev.css
wp-admin/css/ie-rtl.css
wp-admin/css/ie-rtl.dev.css [new file with mode: 0644]
wp-admin/css/ie.css
wp-admin/css/ie.dev.css [new file with mode: 0644]
wp-admin/css/install-rtl.css
wp-admin/css/install-rtl.dev.css [new file with mode: 0644]
wp-admin/css/install.css
wp-admin/css/install.dev.css
wp-admin/css/login-rtl.css
wp-admin/css/login-rtl.dev.css [new file with mode: 0644]
wp-admin/css/login.css
wp-admin/css/login.dev.css
wp-admin/css/media-rtl.css
wp-admin/css/media-rtl.dev.css [new file with mode: 0644]
wp-admin/css/media.css
wp-admin/css/media.dev.css
wp-admin/css/ms.css [new file with mode: 0644]
wp-admin/css/ms.dev.css [new file with mode: 0644]
wp-admin/css/nav-menu-rtl.css [new file with mode: 0644]
wp-admin/css/nav-menu-rtl.dev.css [new file with mode: 0644]
wp-admin/css/nav-menu.css [new file with mode: 0644]
wp-admin/css/nav-menu.dev.css [new file with mode: 0644]
wp-admin/css/plugin-install-rtl.css
wp-admin/css/plugin-install-rtl.dev.css [new file with mode: 0644]
wp-admin/css/plugin-install.css
wp-admin/css/plugin-install.dev.css
wp-admin/css/press-this-rtl.css
wp-admin/css/press-this-rtl.dev.css [new file with mode: 0644]
wp-admin/css/press-this.css
wp-admin/css/press-this.dev.css
wp-admin/css/theme-editor-rtl.css
wp-admin/css/theme-editor-rtl.dev.css [new file with mode: 0644]
wp-admin/css/theme-editor.css
wp-admin/css/theme-editor.dev.css
wp-admin/css/theme-install.css
wp-admin/css/theme-install.dev.css
wp-admin/css/widgets-rtl.css
wp-admin/css/widgets-rtl.dev.css [new file with mode: 0644]
wp-admin/css/widgets.css
wp-admin/css/widgets.dev.css
wp-admin/css/wp-admin-rtl.css [new file with mode: 0644]
wp-admin/css/wp-admin-rtl.dev.css [moved from wp-admin/rtl.dev.css with 76% similarity]
wp-admin/css/wp-admin.css [new file with mode: 0644]
wp-admin/css/wp-admin.dev.css [moved from wp-admin/wp-admin.dev.css with 89% similarity]
wp-admin/custom-background.php [new file with mode: 0644]
wp-admin/custom-header.php
wp-admin/edit-attachment-rows.php
wp-admin/edit-category-form.php [deleted file]
wp-admin/edit-comments.php
wp-admin/edit-form-advanced.php
wp-admin/edit-form-comment.php
wp-admin/edit-link-categories.php
wp-admin/edit-link-category-form.php
wp-admin/edit-link-form.php
wp-admin/edit-page-form.php [deleted file]
wp-admin/edit-pages.php [deleted file]
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/browse-happy.gif [deleted file]
wp-admin/images/fav-arrow-rtl.gif
wp-admin/images/fav-arrow-vs-rtl.gif [new file with mode: 0644]
wp-admin/images/fav-arrow.gif
wp-admin/images/fav-top.png [deleted file]
wp-admin/images/icons32-vs.png
wp-admin/images/icons32.png
wp-admin/images/media-button-image.gif
wp-admin/images/media-button-music.gif
wp-admin/images/media-button-other.gif
wp-admin/images/media-button-video.gif
wp-admin/images/menu-bits-rtl.gif
wp-admin/images/menu-bits.gif
wp-admin/images/menu-vs.png
wp-admin/images/menu.png
wp-admin/images/screen-options-left.gif [deleted file]
wp-admin/images/screen-options-right-up.gif
wp-admin/images/screen-options-right.gif
wp-admin/images/widgets-arrow.gif [new file with mode: 0644]
wp-admin/images/wp-logo-vs.gif [deleted file]
wp-admin/images/wp-logo-vs.png [new file with mode: 0644]
wp-admin/images/wp-logo.gif [deleted file]
wp-admin/images/wp-logo.png [new file with mode: 0644]
wp-admin/import.php
wp-admin/import/blogger.php [deleted file]
wp-admin/import/blogware.php [deleted file]
wp-admin/import/dotclear.php [deleted file]
wp-admin/import/greymatter.php [deleted file]
wp-admin/import/livejournal.php [deleted file]
wp-admin/import/mt.php [deleted file]
wp-admin/import/opml.php [deleted file]
wp-admin/import/rss.php [deleted file]
wp-admin/import/stp.php [deleted file]
wp-admin/import/textpattern.php [deleted file]
wp-admin/import/utw.php [deleted file]
wp-admin/import/wordpress.php [deleted file]
wp-admin/import/wp-cat2tag.php [deleted file]
wp-admin/includes/admin.php
wp-admin/includes/bookmark.php
wp-admin/includes/class-ftp.php
wp-admin/includes/class-wp-filesystem-base.php
wp-admin/includes/class-wp-filesystem-direct.php
wp-admin/includes/class-wp-filesystem-ftpext.php
wp-admin/includes/class-wp-filesystem-ftpsockets.php
wp-admin/includes/class-wp-filesystem-ssh2.php
wp-admin/includes/class-wp-importer.php [new file with mode: 0644]
wp-admin/includes/class-wp-upgrader.php
wp-admin/includes/comment.php
wp-admin/includes/dashboard.php
wp-admin/includes/deprecated.php [new file with mode: 0644]
wp-admin/includes/export.php
wp-admin/includes/file.php
wp-admin/includes/image-edit.php
wp-admin/includes/image.php
wp-admin/includes/manifest.php
wp-admin/includes/media.php
wp-admin/includes/meta-boxes.php
wp-admin/includes/misc.php
wp-admin/includes/ms-deprecated.php [new file with mode: 0644]
wp-admin/includes/ms.php [new file with mode: 0644]
wp-admin/includes/nav-menu.php [new file with mode: 0644]
wp-admin/includes/plugin-install.php
wp-admin/includes/plugin.php
wp-admin/includes/post.php
wp-admin/includes/schema.php
wp-admin/includes/taxonomy.php
wp-admin/includes/template.php
wp-admin/includes/theme-install.php
wp-admin/includes/theme.php
wp-admin/includes/update-core.php
wp-admin/includes/update.php
wp-admin/includes/upgrade.php
wp-admin/includes/user.php
wp-admin/includes/widgets.php
wp-admin/index-extra.php
wp-admin/index.php
wp-admin/install.php
wp-admin/js/common.dev.js
wp-admin/js/common.js
wp-admin/js/custom-background.dev.js [new file with mode: 0644]
wp-admin/js/custom-background.js [new file with mode: 0644]
wp-admin/js/dashboard.dev.js
wp-admin/js/dashboard.js
wp-admin/js/edit-comments.dev.js
wp-admin/js/edit-comments.js
wp-admin/js/image-edit.dev.js
wp-admin/js/inline-edit-post.dev.js
wp-admin/js/inline-edit-post.js
wp-admin/js/link.dev.js
wp-admin/js/link.js
wp-admin/js/media.dev.js
wp-admin/js/media.js
wp-admin/js/nav-menu.dev.js [new file with mode: 0644]
wp-admin/js/nav-menu.js [new file with mode: 0644]
wp-admin/js/password-strength-meter.dev.js
wp-admin/js/password-strength-meter.js
wp-admin/js/plugin-install.dev.js
wp-admin/js/plugin-install.js
wp-admin/js/post.dev.js
wp-admin/js/post.js
wp-admin/js/postbox.dev.js
wp-admin/js/set-post-thumbnail.dev.js
wp-admin/js/set-post-thumbnail.js
wp-admin/js/tags.dev.js
wp-admin/js/tags.js
wp-admin/js/theme-preview.dev.js
wp-admin/js/theme-preview.js
wp-admin/js/user-profile.dev.js
wp-admin/js/user-profile.js
wp-admin/js/widgets.dev.js
wp-admin/js/wp-gears.dev.js [deleted file]
wp-admin/js/wp-gears.js [deleted file]
wp-admin/js/xfn.dev.js
wp-admin/js/xfn.js
wp-admin/link-add.php
wp-admin/link-category.php
wp-admin/link-manager.php
wp-admin/link.php
wp-admin/load-scripts.php
wp-admin/load-styles.php
wp-admin/maint/repair.php
wp-admin/media-new.php
wp-admin/media-upload.php
wp-admin/media.php
wp-admin/menu-header.php
wp-admin/menu.php
wp-admin/ms-admin.php [new file with mode: 0644]
wp-admin/ms-delete-site.php [new file with mode: 0644]
wp-admin/ms-edit.php [new file with mode: 0644]
wp-admin/ms-options.php [new file with mode: 0644]
wp-admin/ms-sites.php [new file with mode: 0644]
wp-admin/ms-themes.php [new file with mode: 0644]
wp-admin/ms-upgrade-network.php [new file with mode: 0644]
wp-admin/ms-users.php [new file with mode: 0644]
wp-admin/my-sites.php [new file with mode: 0644]
wp-admin/nav-menus.php [new file with mode: 0644]
wp-admin/network.php [new file with mode: 0644]
wp-admin/options-discussion.php
wp-admin/options-general.php
wp-admin/options-head.php
wp-admin/options-media.php
wp-admin/options-misc.php [deleted file]
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 [deleted file]
wp-admin/page.php [deleted file]
wp-admin/plugin-editor.php
wp-admin/plugin-install.php
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 [deleted file]
wp-admin/setup-config.php
wp-admin/sidebar.php
wp-admin/theme-editor.php
wp-admin/theme-install.php
wp-admin/themes.php
wp-admin/tools.php
wp-admin/update-core.php
wp-admin/update-links.php [deleted file]
wp-admin/update.php
wp-admin/upgrade.php
wp-admin/upload.php
wp-admin/user-edit.php
wp-admin/user-new.php
wp-admin/users.php
wp-admin/widgets.php
wp-admin/wp-admin.css [deleted file]
wp-app.php
wp-comments-post.php
wp-config-sample.php
wp-content/plugins/akismet/akismet.php
wp-content/plugins/akismet/readme.txt
wp-content/plugins/hello.php
wp-content/themes/classic/comments.php [deleted file]
wp-content/themes/classic/footer.php [deleted file]
wp-content/themes/classic/functions.php [deleted file]
wp-content/themes/classic/header.php [deleted file]
wp-content/themes/classic/index.php [deleted file]
wp-content/themes/classic/rtl.css [deleted file]
wp-content/themes/classic/screenshot.png [deleted file]
wp-content/themes/classic/sidebar.php [deleted file]
wp-content/themes/classic/style.css [deleted file]
wp-content/themes/default/404.php [deleted file]
wp-content/themes/default/archive.php [deleted file]
wp-content/themes/default/archives.php [deleted file]
wp-content/themes/default/comments-popup.php [deleted file]
wp-content/themes/default/footer.php [deleted file]
wp-content/themes/default/functions.php [deleted file]
wp-content/themes/default/image.php [deleted file]
wp-content/themes/default/images/audio.jpg [deleted file]
wp-content/themes/default/images/header-img.php [deleted file]
wp-content/themes/default/images/kubrickbg-ltr.jpg [deleted file]
wp-content/themes/default/images/kubrickbg-rtl.jpg [deleted file]
wp-content/themes/default/images/kubrickbgcolor.jpg [deleted file]
wp-content/themes/default/images/kubrickbgwide.jpg [deleted file]
wp-content/themes/default/images/kubrickfooter.jpg [deleted file]
wp-content/themes/default/images/kubrickheader.jpg [deleted file]
wp-content/themes/default/index.php [deleted file]
wp-content/themes/default/links.php [deleted file]
wp-content/themes/default/page.php [deleted file]
wp-content/themes/default/rtl.css [deleted file]
wp-content/themes/default/screenshot.png [deleted file]
wp-content/themes/default/search.php [deleted file]
wp-content/themes/default/sidebar.php [deleted file]
wp-content/themes/default/single.php [deleted file]
wp-content/themes/default/style.css [deleted file]
wp-content/themes/twentyten/404.php [new file with mode: 0644]
wp-content/themes/twentyten/archive.php [new file with mode: 0644]
wp-content/themes/twentyten/attachment.php [new file with mode: 0644]
wp-content/themes/twentyten/author.php [new file with mode: 0644]
wp-content/themes/twentyten/category.php [new file with mode: 0644]
wp-content/themes/twentyten/comments.php [new file with mode: 0644]
wp-content/themes/twentyten/editor-style-rtl.css [new file with mode: 0644]
wp-content/themes/twentyten/editor-style.css [new file with mode: 0644]
wp-content/themes/twentyten/footer.php [new file with mode: 0644]
wp-content/themes/twentyten/functions.php [new file with mode: 0644]
wp-content/themes/twentyten/header.php [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/berries.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/cherryblossoms.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/concave.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/fern.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/forestfloor.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/inkwell.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/path-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/path.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/headers/sunset.jpg [new file with mode: 0644]
wp-content/themes/twentyten/images/wordpress.png [new file with mode: 0644]
wp-content/themes/twentyten/index.php [new file with mode: 0644]
wp-content/themes/twentyten/languages/twentyten.pot [new file with mode: 0644]
wp-content/themes/twentyten/license.txt [new file with mode: 0644]
wp-content/themes/twentyten/loop.php [new file with mode: 0644]
wp-content/themes/twentyten/onecolumn-page.php [new file with mode: 0644]
wp-content/themes/twentyten/page.php [new file with mode: 0644]
wp-content/themes/twentyten/rtl.css [new file with mode: 0644]
wp-content/themes/twentyten/screenshot.png [new file with mode: 0644]
wp-content/themes/twentyten/search.php [new file with mode: 0644]
wp-content/themes/twentyten/sidebar-footer.php [new file with mode: 0644]
wp-content/themes/twentyten/sidebar.php [new file with mode: 0644]
wp-content/themes/twentyten/single.php [new file with mode: 0644]
wp-content/themes/twentyten/style.css [new file with mode: 0644]
wp-content/themes/twentyten/tag.php [new file with mode: 0644]
wp-cron.php
wp-feed.php
wp-includes/Text/Diff.php
wp-includes/Text/Diff/Engine/native.php
wp-includes/Text/Diff/Engine/shell.php
wp-includes/Text/Diff/Engine/string.php
wp-includes/Text/Diff/Engine/xdiff.php
wp-includes/Text/Diff/Renderer.php
wp-includes/Text/Diff/Renderer/inline.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-http.php [new file with mode: 0644]
wp-includes/class-json.php
wp-includes/class-oembed.php
wp-includes/class-phpass.php
wp-includes/class-simplepie.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-constants.php [new file with mode: 0644]
wp-includes/default-embeds.php
wp-includes/default-filters.php
wp-includes/default-widgets.php
wp-includes/deprecated.php
wp-includes/feed-atom-comments.php
wp-includes/feed-atom.php
wp-includes/feed-rdf.php
wp-includes/feed-rss.php
wp-includes/feed-rss2-comments.php
wp-includes/feed-rss2.php
wp-includes/feed.php
wp-includes/formatting.php
wp-includes/functions.php
wp-includes/functions.wp-scripts.php
wp-includes/functions.wp-styles.php
wp-includes/general-template.php
wp-includes/http.php
wp-includes/images/upload.png
wp-includes/js/autosave.dev.js
wp-includes/js/autosave.js
wp-includes/js/codepress/codepress.css [deleted file]
wp-includes/js/codepress/codepress.html [deleted file]
wp-includes/js/codepress/codepress.js [deleted file]
wp-includes/js/codepress/engines/gecko.js [deleted file]
wp-includes/js/codepress/engines/khtml.js [deleted file]
wp-includes/js/codepress/engines/msie.js [deleted file]
wp-includes/js/codepress/engines/older.js [deleted file]
wp-includes/js/codepress/engines/opera.js [deleted file]
wp-includes/js/codepress/images/line-numbers.png [deleted file]
wp-includes/js/codepress/languages/asp.css [deleted file]
wp-includes/js/codepress/languages/asp.js [deleted file]
wp-includes/js/codepress/languages/autoit.css [deleted file]
wp-includes/js/codepress/languages/autoit.js [deleted file]
wp-includes/js/codepress/languages/csharp.css [deleted file]
wp-includes/js/codepress/languages/csharp.js [deleted file]
wp-includes/js/codepress/languages/css.css [deleted file]
wp-includes/js/codepress/languages/css.js [deleted file]
wp-includes/js/codepress/languages/generic.css [deleted file]
wp-includes/js/codepress/languages/generic.js [deleted file]
wp-includes/js/codepress/languages/html.css [deleted file]
wp-includes/js/codepress/languages/html.js [deleted file]
wp-includes/js/codepress/languages/java.css [deleted file]
wp-includes/js/codepress/languages/java.js [deleted file]
wp-includes/js/codepress/languages/javascript.css [deleted file]
wp-includes/js/codepress/languages/javascript.js [deleted file]
wp-includes/js/codepress/languages/perl.css [deleted file]
wp-includes/js/codepress/languages/perl.js [deleted file]
wp-includes/js/codepress/languages/php.css [deleted file]
wp-includes/js/codepress/languages/php.js [deleted file]
wp-includes/js/codepress/languages/ruby.css [deleted file]
wp-includes/js/codepress/languages/ruby.js [deleted file]
wp-includes/js/codepress/languages/sql.css [deleted file]
wp-includes/js/codepress/languages/sql.js [deleted file]
wp-includes/js/codepress/languages/text.css [deleted file]
wp-includes/js/codepress/languages/text.js [deleted file]
wp-includes/js/codepress/languages/vbscript.css [deleted file]
wp-includes/js/codepress/languages/vbscript.js [deleted file]
wp-includes/js/codepress/languages/xsl.css [deleted file]
wp-includes/js/codepress/languages/xsl.js [deleted file]
wp-includes/js/codepress/license.txt [deleted file]
wp-includes/js/jquery/interface.js [deleted file]
wp-includes/js/jquery/jquery.js
wp-includes/js/jquery/suggest.dev.js
wp-includes/js/jquery/suggest.js
wp-includes/js/jquery/ui.core.js
wp-includes/js/jquery/ui.dialog.js
wp-includes/js/jquery/ui.draggable.js
wp-includes/js/jquery/ui.droppable.js
wp-includes/js/jquery/ui.resizable.js
wp-includes/js/jquery/ui.selectable.js
wp-includes/js/jquery/ui.sortable.js
wp-includes/js/jquery/ui.tabs.js
wp-includes/js/prototype.js
wp-includes/js/quicktags.dev.js
wp-includes/js/scriptaculous/MIT-LICENSE
wp-includes/js/scriptaculous/builder.js
wp-includes/js/scriptaculous/controls.js
wp-includes/js/scriptaculous/dragdrop.js
wp-includes/js/scriptaculous/effects.js
wp-includes/js/scriptaculous/prototype.js [deleted file]
wp-includes/js/scriptaculous/scriptaculous.js
wp-includes/js/scriptaculous/slider.js
wp-includes/js/scriptaculous/sound.js
wp-includes/js/scriptaculous/unittest.js
wp-includes/js/scriptaculous/wp-scriptaculous.js
wp-includes/js/swfobject.js
wp-includes/js/swfupload/handlers.dev.js
wp-includes/js/swfupload/handlers.js
wp-includes/js/thickbox/thickbox.js
wp-includes/js/tinymce/langs/wp-langs.php
wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
wp-includes/js/tinymce/wp-mce-help.php
wp-includes/js/tinymce/wp-tinymce.js [deleted file]
wp-includes/js/tinymce/wp-tinymce.php
wp-includes/js/wp-list-revisions.dev.js [new file with mode: 0644]
wp-includes/js/wp-list-revisions.js [new file with mode: 0644]
wp-includes/kses.php
wp-includes/l10n.php
wp-includes/link-template.php
wp-includes/load.php [new file with mode: 0644]
wp-includes/locale.php
wp-includes/media.php
wp-includes/meta.php
wp-includes/ms-blogs.php [new file with mode: 0644]
wp-includes/ms-default-constants.php [new file with mode: 0644]
wp-includes/ms-default-filters.php [new file with mode: 0644]
wp-includes/ms-deprecated.php [new file with mode: 0644]
wp-includes/ms-files.php [new file with mode: 0644]
wp-includes/ms-functions.php [new file with mode: 0644]
wp-includes/ms-load.php [new file with mode: 0644]
wp-includes/ms-settings.php [new file with mode: 0644]
wp-includes/nav-menu-template.php [new file with mode: 0644]
wp-includes/nav-menu.php [new file with mode: 0644]
wp-includes/pluggable-deprecated.php [new file with mode: 0644]
wp-includes/pluggable.php
wp-includes/plugin.php
wp-includes/pomo/entry.php
wp-includes/pomo/mo.php
wp-includes/pomo/po.php
wp-includes/pomo/streams.php
wp-includes/pomo/translations.php
wp-includes/post-template.php
wp-includes/post-thumbnail-template.php
wp-includes/post.php
wp-includes/query.php
wp-includes/registration-functions.php
wp-includes/registration.php
wp-includes/rewrite.php
wp-includes/rss-functions.php
wp-includes/rss.php
wp-includes/script-loader.php
wp-includes/shortcodes.php
wp-includes/taxonomy.php
wp-includes/template-loader.php
wp-includes/theme-compat/comments-popup.php [moved from wp-content/themes/classic/comments-popup.php with 53% similarity]
wp-includes/theme-compat/comments.php [moved from wp-content/themes/default/comments.php with 50% similarity]
wp-includes/theme-compat/footer.php [new file with mode: 0644]
wp-includes/theme-compat/header.php [moved from wp-content/themes/default/header.php with 74% similarity]
wp-includes/theme-compat/sidebar.php [new file with mode: 0644]
wp-includes/theme.php
wp-includes/update.php
wp-includes/user.php
wp-includes/vars.php
wp-includes/version.php
wp-includes/widgets.php
wp-includes/wp-db.php
wp-includes/wp-diff.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php [new file with mode: 0644]
wp-trackback.php
xmlrpc.php

index f9b926f07020ff743000871174ce2567cf438c6a..9b731ae41c22448d4a689be8b7e60a551e109be6 100644 (file)
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-       <title>WordPress &rsaquo; ReadMe</title>
-       <link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
+       <title>WordPress &#8250; ReadMe</title>
+       <link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
 </head>
 <body>
-<h1 id="logo" style="text-align: center">
-       <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
-       <br /> Version 2.9.2
+<h1 id="logo">
+       <a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" width="250" height="68" /></a>
+       <br /> Version 3.0
 </h1>
 <p style="text-align: center">Semantic Personal Publishing Platform</p>
 
 <h1>First Things First</h1>
 <p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I'm proud to be a part of. Thousands of hours have gone into WordPress, and we're dedicated to making it better every day. Thank you for making it part of your world.</p>
-<p style="text-align: right;">&#8212; Matt Mullenweg</p>
+<p style="text-align: right">&#8212; Matt Mullenweg</p>
 
 <h1>Installation: Famous 5-minute install</h1>
 <ol>
-       <li>Unzip the package in an empty directory.</li>
-       <li>Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
-       <li>Save the file as <code>wp-config.php</code></li>
-       <li>Upload everything.</li>
-       <li>Open <span class="file"><a href="wp-admin/install.php">/wp-admin/install.php</a></span> in your browser. This should setup the tables needed for your blog. If there is an error, double check your <span class="file">wp-config.php</span> file, and try again. If it fails again, please go to the <a href="http://wordpress.org/support/">support forums</a> with as much data as you can gather.</li>
-       <li><strong>Note the password given to you.</strong></li>
-       <li> The install script should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username <code>admin</code> and the password generated during the installation. You can then click on 'Profile' to change the password.</li>
+       <li>Unzip the package in an empty directory and upload everything.</li>
+       <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
+               <ol>
+                       <li>If for some reason this doesn't work, don't worry. It doesn't work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
+                       <li>Save the file as <code>wp-config.php</code> and upload it.</li>
+                       <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
+               </ol>
+       </li>
+       <li>Once the configuration file is set up, the installer will set up the tables needed for your blog. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="http://wordpress.org/support/" title="WordPress support">support forums</a> with as much data as you can gather.</li>
+       <li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
+       <li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on 'Profile' to change the password.</li>
 </ol>
 
 <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.9.2:</h2>
+<h2>Using the Automatic Upgrader</h2>
+<p>If you are upgrading from version 2.7 or higher, you can use the automatic upgrader:</p>
 <ol>
-       <li>Delete your old WP files, saving ones you've modified.</li>
+       <li>Open the <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
+       <li>You wanted more, perhaps? That's it!</li>
+</ol>
+
+<h2>Upgrading Manually</h2>
+<ol>
+       <li>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
+       <li>Delete your old WordPress files, saving ones you've modified.</li>
        <li>Upload the new files.</li>
        <li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
-       <li>You wanted more, perhaps? That's it!</li>
 </ol>
-<h2>Template Changes</h2>
-<p>If you have customized your templates you will probably have to make some changes to them. If you're converting your 1.2 or earlier templates, <a href="http://codex.wordpress.org/Upgrade_1.2_to_1.5">we've created a special guide for you</a>. </p>
+
+<h2>Theme Template Changes</h2>
+<p>If you have customized your theme templates, you may have to make some changes across major versions.</p>
+
+<h1>Migrating from other systems</h1>
+<p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php" title="Import to WordPress">our import tools</a>.</p>
+
+<h1>System Requirements</h1>
+<ul>
+       <li><a href="http://php.net/">PHP</a> version <strong>4.3</strong> or higher.</li>
+       <li><a href="http://www.mysql.com/">MySQL</a> version <strong>4.1.2</strong> or higher.</li>
+</ul>
+
+<h2>System Recommendations</h2>
+<ul>
+       <li>The <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
+       <li>A link to <a href="http://wordpress.org/">http://wordpress.org</a> on your site.</li>
+</ul>
 
 <h1>Online Resources</h1>
 <p>If you have any questions that aren't addressed in this document, please take advantage of WordPress' numerous online resources:</p>
 <dl>
-       <dt><a href="http://codex.wordpress.org/">The WordPress Codex </a></dt>
+       <dt><a href="http://codex.wordpress.org/">The WordPress Codex</a></dt>
                <dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
-       <dt><a href="http://wordpress.org/development/">The Development Blog</a></dt>
-               <dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often.</dd>
-       <dt><a href="http://planet.wordpress.org/">WordPress Planet </a></dt>
+       <dt><a href="http://wordpress.org/development/">The WordPress Blog</a></dt>
+               <dd>This is where you'll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
+       <dt><a href="http://planet.wordpress.org/">WordPress Planet</a></dt>
                <dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
        <dt><a href="http://wordpress.org/support/">WordPress Support Forums</a></dt>
                <dd>If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
-       <dt><a href="http://codex.wordpress.org/IRC">WordPress IRC Channel</a></dt>
-               <dd>Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
+       <dt><a href="http://codex.wordpress.org/IRC">WordPress <abbr title="Internet Relay Chat">IRC</abbr> Channel</a></dt>
+               <dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
 </dl>
 
-<h1>System Recommendations</h1>
-<ul>
-       <li>PHP version <strong>4.3</strong> or higher.</li>
-       <li>MySQL version <strong>4.1.2</strong> or higher.</li>
-       <li>... and a link to <a href="http://wordpress.org/">http://wordpress.org</a> on your site.</li>
-</ul>
-<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&eacute;log</a>, which came from Michel V. The work has been continued by the <a href="http://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="http://wordpress.org/donate/">donating</a>.</p>
-
-<h1>Upgrading from another system</h1>
-<p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>
-
-<h1>XML-RPC and Atom Interface</h1>
-<p>You can now post to your WordPress blog with tools like <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>, <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>
+<h1><abbr title="eXtensible Markup Language">XML</abbr>-<abbr title="Remote Procedure Call">RPC</abbr> and Atom Interface</h1>
+<p>You can post to your WordPress blog with tools like <a href="http://download.live.com/writer">Windows Live Writer</a>, <a href="http://illuminex.com/ecto/">Ecto</a>, <a href="http://bloggar.com/">w.bloggar</a>, <a href="http://radio.userland.com/">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the blogging <abbr title="application programming interface">API</abbr>s! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support"><abbr>XML</abbr>-<abbr>RPC</abbr> support on the Codex</a>.</p>
 
 <h1>Post via Email</h1>
-<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL.</p>
+<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret <abbr title="Post Office Protocol version 3">POP3</abbr> account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with <a href="http://en.wikipedia.org/wiki/Cron">cron</a>-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> <abbr title="Uniform Resource Locator">URL</abbr>.</p>
 <p>Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address discrete. The script will <em>delete</em> emails that are successfully posted.</p>
 
 <h1>User Roles</h1>
-<p>We've eliminated user levels in order to make way for the much more flexible roles system introduced in 2.0. You can <a href="http://codex.wordpress.org/Roles_and_Capabilities">read more about Roles and Capabilities on the Codex</a>.</p>
+<p>We introduced a very flexible roles system in version 2.0. You can <a href="http://codex.wordpress.org/Roles_and_Capabilities" title="WordPress roles and capabilities">read more about Roles and Capabilities on the Codex</a>.</p>
 
-<h1> Final notes</h1>
+<h1>Final Notes</h1>
 <ul>
-       <li>If you have any suggestions, ideas, comments, or if you (gasp!) found a bug, join us in the <a href="http://wordpress.org/support/">Support Forums</a>.</li>
-       <li>WordPress now has a robust plugin API that makes extending the code easy. If you are a developer interested in utilizing this see the <a href="http://codex.wordpress.org/Plugin_API">plugin documentation in the Codex</a>. In most all cases you shouldn't modify any of the core code.</li>
+       <li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="http://wordpress.org/support/">Support Forums</a>.</li>
+       <li>WordPress has a robust plugin <abbr title="application programming interface">API</abbr> that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="http://codex.wordpress.org/Plugin_API" title="WordPress plugin API">plugin documentation in the Codex</a>. You shouldn't modify any of the core code.</li>
 </ul>
 
 <h1>Share the Love</h1>
 <p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.</p>
 
+<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&#233;log</a>, which came from Michel V. The work has been continued by the <a href="http://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="http://wordpress.org/donate/" title="Donate to WordPress">donating</a>.</p>
+
 <h1>Copyright</h1>
-<p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr> (see <a href="license.txt">license.txt</a>).</p>
+<p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr>v2 (see <a href="license.txt">license.txt</a>).</p>
+
 
 </body>
 </html>
diff --git a/wp-activate.php b/wp-activate.php
new file mode 100644 (file)
index 0000000..b9e7707
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+define( "WP_INSTALLING", true );
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+require( './wp-blog-header.php' );
+
+if ( !is_multisite() ) {
+       wp_redirect( get_option( 'siteurl' ) . "/wp-login.php?action=register" );
+       die();
+}
+
+require_once( ABSPATH . WPINC . '/registration.php');
+
+if ( is_object( $wp_object_cache ) )
+       $wp_object_cache->cache_enabled = false;
+
+do_action("activate_header");
+
+function do_activate_header() {
+       do_action("activate_wp_head");
+}
+add_action( 'wp_head', 'do_activate_header' );
+
+function wpmu_activate_stylesheet() {
+       ?>
+       <style type="text/css">
+               form { margin-top: 2em; }
+               #submit, #key { width: 90%; font-size: 24px; }
+               #language { margin-top: .5em; }
+               .error { background: #f66; }
+               span.h3 { padding:0 8px; font-size:1.3em; font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-weight:700; color:#333333; }
+       </style>
+       <?php
+}
+add_action( 'wp_head', 'wpmu_activate_stylesheet' );
+
+get_header();
+?>
+
+<div id="content" class="widecolumn">
+       <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
+
+               <h2><?php _e('Activation Key Required') ?></h2>
+               <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
+                       <p>
+                           <label for="key"><?php _e('Activation Key:') ?></label>
+                           <br /><input type="text" name="key" id="key" value="" size="50" />
+                       </p>
+                       <p class="submit">
+                           <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
+                       </p>
+               </form>
+
+       <?php } else {
+
+               $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
+               $result = wpmu_activate_signup($key);
+               if ( is_wp_error($result) ) {
+                       if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
+                           $signup = $result->get_error_data();
+                               ?>
+                               <h2><?php _e('Your account is now active!'); ?></h2>
+                               <?php
+                               echo '<p class="lead-in">';
+                               if ( $signup->domain . $signup->path == '' ) {
+                                       printf( __('Your account has been activated. You may now <a href="%1$s">login</a> to the site using your chosen username of &#8220;%2$s&#8221;.  Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, network_site_url( 'wp-login.php?action=lostpassword', 'login' ) );
+                               } else {
+                                       printf( __('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;.  Please check your email inbox at %4$s for your password and login instructions.  If you do not receive an email, please check your junk or spam folder.  If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, network_site_url( 'wp-login.php?action=lostpassword' ) );
+                               }
+                               echo '</p>';
+                       } else {
+                               ?>
+                               <h2><?php _e('An error occurred during the activation'); ?></h2>
+                               <?php
+                           echo '<p>'.$result->get_error_message().'</p>';
+                       }
+               } else {
+                       extract($result);
+                       $url = get_blogaddress_by_id( (int) $blog_id);
+                       $user = new WP_User( (int) $user_id);
+                       ?>
+                       <h2><?php _e('Your account is now active!'); ?></h2>
+
+                       <div id="signup-welcome">
+                               <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
+                               <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
+                       </div>
+
+                       <?php if ( $url != network_home_url('', 'http') ) : ?>
+                               <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Login</a>'), $url, $url . 'wp-login.php' ); ?></p>
+                       <?php else: ?>
+                               <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
+                       <?php endif;
+               }
+       }
+       ?>
+</div>
+<script type="text/javascript">
+       var key_input = document.getElementById('key');
+       key_input && key_input.focus();
+</script>
+<?php get_footer(); ?>
\ No newline at end of file
index 5778a12e2edeb8db39714ba95c6eea9d3f3a0e8d..a4ba6e1dc9b9ed7fe83e07798b3ea1d3764f0ffe 100644 (file)
@@ -15,29 +15,34 @@ define('DOING_AJAX', true);
 define('WP_ADMIN', true);
 
 require_once('../wp-load.php');
-require_once('includes/admin.php');
+
+if ( ! isset( $_REQUEST['action'] ) )
+       die('-1');
+
+require_once('./includes/admin.php');
 @header('Content-Type: text/html; charset=' . get_option('blog_charset'));
+send_nosniff_header();
 
 do_action('admin_init');
 
 if ( ! is_user_logged_in() ) {
 
-       if ( $_POST['action'] == 'autosave' ) {
+       if ( isset( $_POST['action'] ) && $_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();
+               $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();
        }
 
-       if ( !empty( $_REQUEST['action']) )
+       if ( !empty( $_REQUEST['action'] ) )
                do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
 
        die('-1');
@@ -93,10 +98,10 @@ case 'wp-compression-test' :
                 } elseif ( 2 == $_GET['test'] ) {
                        if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
                                die('-1');
-                       if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+                       if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
                                header('Content-Encoding: deflate');
                                $out = gzdeflate( $test_str, 1 );
-                       } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
+                       } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
                                header('Content-Encoding: gzip');
                                $out = gzencode( $test_str, 1 );
                        } else {
@@ -121,11 +126,21 @@ case 'imgedit-preview' :
        check_ajax_referer( "image_editor-$post_id" );
 
        include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
-       if ( !stream_preview_image($post_id) )
+       if ( ! stream_preview_image($post_id) )
                die('-1');
 
        die();
        break;
+case 'menu-quick-search':
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               die('-1');
+
+       require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
+
+       _wp_ajax_menu_quick_search( $_REQUEST );
+
+       exit;
+       break;
 case 'oembed-cache' :
        $return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0';
        die( $return );
@@ -200,6 +215,84 @@ function _wp_ajax_delete_comment_response( $comment_id ) {
        $x->send();
 }
 
+function _wp_ajax_add_hierarchical_term() {
+       $action = $_POST['action'];
+       $taxonomy = get_taxonomy(substr($action, 4));
+       check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
+       if ( !current_user_can( $taxonomy->cap->edit_terms ) )
+               die('-1');
+       $names = explode(',', $_POST['new'.$taxonomy->name]);
+       $parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
+       if ( 0 > $parent )
+               $parent = 0;
+       if ( $taxonomy->name == 'category' )
+               $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
+       else
+               $post_category = ( isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array();
+       $checked_categories = array_map( 'absint', (array) $post_category );
+       $popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false);
+
+       foreach ( $names as $cat_name ) {
+               $cat_name = trim($cat_name);
+               $category_nicename = sanitize_title($cat_name);
+               if ( '' === $category_nicename )
+                       continue;
+               if ( !($cat_id = term_exists($cat_name, $taxonomy->name, $parent)) ) {
+                       $new_term = wp_insert_term($cat_name, $taxonomy->name, array('parent' => $parent));
+                       $cat_id = $new_term['term_id'];
+               }
+               $checked_categories[] = $cat_id;
+               if ( $parent ) // Do these all at once in a second
+                       continue;
+               $category = get_term( $cat_id, $taxonomy->name );
+               ob_start();
+                       wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
+               $data = ob_get_contents();
+               ob_end_clean();
+               $add = array(
+                       'what' => $taxonomy->name,
+                       'id' => $cat_id,
+                       'data' => str_replace( array("\n", "\t"), '', $data),
+                       'position' => -1
+               );
+       }
+
+       if ( $parent ) { // Foncy - replace the parent and all its children
+               $parent = get_term( $parent, $taxonomy->name );
+               $term_id = $parent->term_id;
+
+               while ( $parent->parent ) { // get the top parent
+                       $parent = &get_term( $parent->parent, $taxonomy->name );
+                       if ( is_wp_error( $parent ) )
+                               break;
+                       $term_id = $parent->term_id;
+               }
+
+               ob_start();
+                       wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
+               $data = ob_get_contents();
+               ob_end_clean();
+               $add = array(
+                       'what' => $taxonomy->name,
+                       'id' => $term_id,
+                       'data' => str_replace( array("\n", "\t"), '', $data),
+                       'position' => -1
+               );
+       }
+
+       ob_start();
+               wp_dropdown_categories( array(
+                       'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
+                       'hierarchical' => 1, 'show_option_none' => '&mdash; '.$taxonomy->labels->parent_item.' &mdash;'
+               ) );
+       $sup = ob_get_contents();
+       ob_end_clean();
+       $add['supplemental'] = array( 'newcat_parent' => $sup );
+
+       $x = new WP_Ajax_Response( $add );
+       $x->send();
+}
+
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
 case 'delete-comment' : // On success, die with time() instead of 1
@@ -237,27 +330,15 @@ case 'delete-comment' : // On success, die with time() instead of 1
                _wp_ajax_delete_comment_response( $comment->comment_ID );
        die( '0' );
        break;
-case 'delete-cat' :
-       check_ajax_referer( "delete-category_$id" );
-       if ( !current_user_can( 'manage_categories' ) )
-               die('-1');
-
-       $cat = get_category( $id );
-       if ( !$cat || is_wp_error( $cat ) )
-               die('1');
-
-       if ( wp_delete_category( $id ) )
-               die('1');
-       else
-               die('0');
-       break;
 case 'delete-tag' :
        $tag_id = (int) $_POST['tag_ID'];
        check_ajax_referer( "delete-tag_$tag_id" );
-       if ( !current_user_can( 'manage_categories' ) )
-               die('-1');
 
        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
+       $tax = get_taxonomy($taxonomy);
+
+       if ( !current_user_can( $tax->cap->delete_terms ) )
+               die('-1');
 
        $tag = get_term( $tag_id, $taxonomy );
        if ( !$tag || is_wp_error( $tag ) )
@@ -409,70 +490,6 @@ case 'dim-comment' : // On success, die with time() instead of 1
        _wp_ajax_delete_comment_response( $comment->comment_ID );
        die( '0' );
        break;
-case 'add-category' : // On the Fly
-       check_ajax_referer( $action );
-       if ( !current_user_can( 'manage_categories' ) )
-               die('-1');
-       $names = explode(',', $_POST['newcat']);
-       if ( 0 > $parent = (int) $_POST['newcat_parent'] )
-               $parent = 0;
-       $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
-       $checked_categories = array_map( 'absint', (array) $post_category );
-       $popular_ids = wp_popular_terms_checklist('category', 0, 10, false);
-
-       foreach ( $names as $cat_name ) {
-               $cat_name = trim($cat_name);
-               $category_nicename = sanitize_title($cat_name);
-               if ( '' === $category_nicename )
-                       continue;
-               $cat_id = wp_create_category( $cat_name, $parent );
-               $checked_categories[] = $cat_id;
-               if ( $parent ) // Do these all at once in a second
-                       continue;
-               $category = get_category( $cat_id );
-               ob_start();
-                       wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
-               $data = ob_get_contents();
-               ob_end_clean();
-               $add = array(
-                       'what' => 'category',
-                       'id' => $cat_id,
-                       'data' => str_replace( array("\n", "\t"), '', $data),
-                       'position' => -1
-               );
-       }
-       if ( $parent ) { // Foncy - replace the parent and all its children
-               $parent = get_category( $parent );
-               $term_id = $parent->term_id;
-
-               while ( $parent->parent ) { // get the top parent
-                       $parent = &get_category( $parent->parent );
-                       if ( is_wp_error( $parent ) )
-                               break;
-                       $term_id = $parent->term_id;
-               }
-
-               ob_start();
-                       wp_category_checklist( 0, $term_id, $checked_categories, $popular_ids, null, false );
-               $data = ob_get_contents();
-               ob_end_clean();
-               $add = array(
-                       'what' => 'category',
-                       'id' => $term_id,
-                       'data' => str_replace( array("\n", "\t"), '', $data),
-                       'position' => -1
-               );
-       }
-
-       ob_start();
-               wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) );
-       $sup = ob_get_contents();
-       ob_end_clean();
-       $add['supplemental'] = array( 'newcat_parent' => $sup );
-
-       $x = new WP_Ajax_Response( $add );
-       $x->send();
-       break;
 case 'add-link-category' : // On the Fly
        check_ajax_referer( $action );
        if ( !current_user_can( 'manage_categories' ) )
@@ -484,7 +501,7 @@ case 'add-link-category' : // On the Fly
                $slug = sanitize_title($cat_name);
                if ( '' === $slug )
                        continue;
-               if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) {
+               if ( !$cat_id = term_exists( $cat_name, 'link_category' ) ) {
                        $cat_id = wp_insert_term( $cat_name, 'link_category' );
                }
                $cat_id = $cat_id['term_id'];
@@ -498,59 +515,6 @@ case 'add-link-category' : // On the Fly
        }
        $x->send();
        break;
-case 'add-cat' : // From Manage->Categories
-       check_ajax_referer( 'add-category' );
-       if ( !current_user_can( 'manage_categories' ) )
-               die('-1');
-
-       if ( '' === trim($_POST['cat_name']) ) {
-               $x = new WP_Ajax_Response( array(
-                       'what' => 'cat',
-                       'id' => new WP_Error( 'cat_name', __('You did not enter a category name.') )
-               ) );
-               $x->send();
-       }
-
-       if ( category_exists( trim( $_POST['cat_name'] ), $_POST['category_parent'] ) ) {
-               $x = new WP_Ajax_Response( array(
-                       'what' => 'cat',
-                       'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ),
-               ) );
-               $x->send();
-       }
-
-       $cat = wp_insert_category( $_POST, true );
-
-       if ( is_wp_error($cat) ) {
-               $x = new WP_Ajax_Response( array(
-                       'what' => 'cat',
-                       'id' => $cat
-               ) );
-               $x->send();
-       }
-
-       if ( !$cat || (!$cat = get_category( $cat )) )
-               die('0');
-
-       $level = 0;
-       $cat_full_name = $cat->name;
-       $_cat = $cat;
-       while ( $_cat->parent ) {
-               $_cat = get_category( $_cat->parent );
-               $cat_full_name = $_cat->name . ' &#8212; ' . $cat_full_name;
-               $level++;
-       }
-       $cat_full_name = esc_attr($cat_full_name);
-
-       $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))
-       ) );
-       $x->send();
-       break;
 case 'add-link-cat' : // From Blogroll -> Categories
        check_ajax_referer( 'add-link-category' );
        if ( !current_user_can( 'manage_categories' ) )
@@ -588,19 +552,57 @@ case 'add-link-cat' : // From Blogroll -> Categories
        break;
 case 'add-tag' : // From Manage->Tags
        check_ajax_referer( 'add-tag' );
-       if ( !current_user_can( 'manage_categories' ) )
-               die('-1');
 
        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
+       $tax = get_taxonomy($taxonomy);
+
+       $x = new WP_Ajax_Response();
+
+       if ( !current_user_can( $tax->cap->edit_terms ) )
+               die('-1');
+
        $tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
 
        if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) {
-               echo '<div class="error"><p>' . __('An error has occured. Please reload the page and try again.') . '</p></div>';
-               exit;
+               $message = __('An error has occured. Please reload the page and try again.');
+               if ( is_wp_error($tag) && $tag->get_error_message() )
+                       $message = $tag->get_error_message();
+
+               $x->add( array(
+                       'what' => 'taxonomy',
+                       'data' => new WP_Error('error', $message )
+               ) );
+               $x->send();
        }
 
-       echo _tag_row( $tag, '', $taxonomy );
-       exit;
+       if ( isset($_POST['screen']) )
+               set_current_screen($_POST['screen']);
+
+       $level = 0;
+       $tag_full_name = false;
+       $tag_full_name = $tag->name;
+       if ( is_taxonomy_hierarchical($taxonomy) ) {
+               $_tag = $tag;
+               while ( $_tag->parent  ) {
+                       $_tag = get_term( $_tag->parent, $taxonomy );
+                       $tag_full_name = $_tag->name . ' &#8212; ' . $tag_full_name;
+                       $level++;
+               }
+               $noparents = _tag_row( $tag, $level, $taxonomy );
+       }
+       $tag->name = $tag_full_name;
+       $parents = _tag_row( $tag, 0, $taxonomy);
+
+       $x->add( array(
+               'what' => 'taxonomy',
+               'supplemental' => compact('parents', 'noparents')
+               ) );
+       $x->add( array(
+               'what' => 'term',
+               'position' => $level,
+               'supplemental' => get_term( $tag->term_id, $taxonomy, ARRAY_A ) //Refetch as $tag has been contaminated by the full name.
+               ) );
+       $x->send();
        break;
 case 'get-tagcloud' :
        if ( !current_user_can( 'edit_posts' ) )
@@ -613,8 +615,10 @@ case 'get-tagcloud' :
 
        $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
 
-       if ( empty( $tags ) )
-               die( __('No tags found!') );
+       if ( empty( $tags ) ) {
+               $tax = get_taxonomy( $taxonomy );
+               die( isset( $tax->no_tagcloud ) ? $tax->no_tagcloud : __('No tags found!') );
+       }
 
        if ( is_wp_error($tags) )
                die($tags->get_error_message());
@@ -701,7 +705,7 @@ case 'get-comments' :
        $x->send();
        break;
 case 'replyto-comment' :
-       check_ajax_referer( $action );
+       check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
 
        $comment_post_ID = (int) $_POST['comment_post_ID'];
        if ( !current_user_can( 'edit_post', $comment_post_ID ) )
@@ -770,7 +774,7 @@ case 'replyto-comment' :
        $x->send();
        break;
 case 'edit-comment' :
-       check_ajax_referer( 'replyto-comment' );
+       check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
 
        $comment_post_ID = (int) $_POST['comment_post_ID'];
        if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
@@ -807,20 +811,60 @@ case 'edit-comment' :
 
        $x->send();
        break;
+case 'add-menu-item' :
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               die('-1');
+
+       check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+
+       require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
+
+       $item_ids = wp_save_nav_menu_items( 0, $_POST['menu-item'] );
+       if ( is_wp_error( $item_ids ) )
+               die('-1');
+
+       foreach ( (array) $item_ids as $menu_item_id ) {
+               $menu_obj = get_post( $menu_item_id );
+               if ( ! empty( $menu_obj->ID ) ) {
+                       $menu_obj = wp_setup_nav_menu_item( $menu_obj );
+                       $menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items
+                       $menu_items[] = $menu_obj;
+               }
+       }
+
+       if ( ! empty( $menu_items ) ) {
+               $args = array(
+                       'after' => '',
+                       'before' => '',
+                       'link_after' => '',
+                       'link_before' => '',
+                       'walker' => new Walker_Nav_Menu_Edit,
+               );
+               echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
+       }
+       break;
 case 'add-meta' :
-       check_ajax_referer( 'add-meta' );
+       check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
        $c = 0;
        $pid = (int) $_POST['post_id'];
+       $post = get_post( $pid );
+
        if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
                if ( !current_user_can( 'edit_post', $pid ) )
                        die('-1');
                if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
                        die('1');
-               if ( $pid < 0 ) {
+               if ( $post->post_status == 'auto-draft' ) {
+                       $save_POST = $_POST; // Backup $_POST
+                       $_POST = array(); // Make it empty for edit_post()
+                       $_POST['action'] = 'draft'; // Warning fix
+                       $_POST['post_ID'] = $pid;
+                       $_POST['post_type'] = $post->post_type;
+                       $_POST['post_status'] = 'draft';
                        $now = current_time('timestamp', 1);
-                       if ( $pid = wp_insert_post( array(
-                               'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
-                       ) ) {
+                       $_POST['post_title'] = sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now));
+
+                       if ( $pid = edit_post() ) {
                                if ( is_wp_error( $pid ) ) {
                                        $x = new WP_Ajax_Response( array(
                                                'what' => 'meta',
@@ -828,6 +872,7 @@ case 'add-meta' :
                                        ) );
                                        $x->send();
                                }
+                               $_POST = $save_POST; // Now we can restore original $_POST again
                                if ( !$mid = add_meta( $pid ) )
                                        die(__('Please provide a custom field value.'));
                        } else {
@@ -847,15 +892,19 @@ case 'add-meta' :
                        'position' => 1,
                        'supplemental' => array('postid' => $pid)
                ) );
-       } else {
+       } else { // Update?
                $mid = (int) array_pop(array_keys($_POST['meta']));
                $key = $_POST['meta'][$mid]['key'];
                $value = $_POST['meta'][$mid]['value'];
+               if ( '' == trim($key) )
+                       die(__('Please provide a custom field name.'));
+               if ( '' == trim($value) )
+                       die(__('Please provide a custom field value.'));
                if ( !$meta = get_post_meta_by_id( $mid ) )
                        die('0'); // if meta doesn't exist
                if ( !current_user_can( 'edit_post', $meta->post_id ) )
                        die('-1');
-               if ( $meta->meta_value != stripslashes($value) ) {
+               if ( $meta->meta_value != stripslashes($value) || $meta->meta_key != stripslashes($key) ) {
                        if ( !$u = update_meta( $mid, $key, $value ) )
                                die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
                }
@@ -910,7 +959,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
        global $current_user;
 
        $_POST['post_category'] = explode(",", $_POST['catslist']);
-       if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
+       if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) )
                unset($_POST['post_category']);
 
        $do_autosave = (bool) $_POST['autosave'];
@@ -919,64 +968,62 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
        $data = '';
        /* translators: draft saved date format, see http://php.net/date */
        $draft_saved_date_format = __('g:i:s a');
-       $message = sprintf( __('Draft Saved at %s.'), date_i18n( $draft_saved_date_format ) );
+       /* translators: %s: date and time */
+       $message = sprintf( __('Draft saved at %s.'), date_i18n( $draft_saved_date_format ) );
 
        $supplemental = array();
        if ( isset($login_grace_period) )
                $supplemental['session_expired'] = add_query_arg( 'interim-login', 1, wp_login_url() );
 
        $id = $revision_id = 0;
-       if($_POST['post_ID'] < 0) {
+
+       $post_ID = (int) $_POST['post_ID'];
+       $_POST['ID'] = $post_ID;
+       $post = get_post($post_ID);
+       if ( 'auto-draft' == $post->post_status )
                $_POST['post_status'] = 'draft';
-               $_POST['temp_ID'] = $_POST['post_ID'];
-               if ( $do_autosave ) {
-                       $id = wp_write_post();
-                       $data = $message;
-               }
-       } else {
-               $post_ID = (int) $_POST['post_ID'];
-               $_POST['ID'] = $post_ID;
-               $post = get_post($post_ID);
 
-               if ( $last = wp_check_post_lock( $post->ID ) ) {
-                       $do_autosave = $do_lock = false;
+       if ( $last = wp_check_post_lock( $post->ID ) ) {
+               $do_autosave = $do_lock = false;
 
-                       $last_user = get_userdata( $last );
-                       $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
-                       $data = new WP_Error( 'locked', sprintf(
-                               $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
-                               esc_html( $last_user_name )
-                       ) );
+               $last_user = get_userdata( $last );
+               $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
+               $data = new WP_Error( 'locked', sprintf(
+                       $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
+                       esc_html( $last_user_name )
+               ) );
 
-                       $supplemental['disable_autosave'] = 'disable';
-               }
+               $supplemental['disable_autosave'] = 'disable';
+       }
 
-               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 ( '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 ( $do_autosave ) {
-                       // Drafts are just overwritten by autosave
-                       if ( 'draft' == $post->post_status ) {
-                               $id = edit_post();
-                       } else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
-                               $revision_id = wp_create_post_autosave( $post->ID );
-                               if ( is_wp_error($revision_id) )
-                                       $id = $revision_id;
-                               else
-                                       $id = $post->ID;
-                       }
-                       $data = $message;
-               } else {
-                       $id = $post->ID;
+       if ( $do_autosave ) {
+               // Drafts and auto-drafts are just overwritten by autosave
+               if ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) {
+                       $id = edit_post();
+               } else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
+                       $revision_id = wp_create_post_autosave( $post->ID );
+                       if ( is_wp_error($revision_id) )
+                               $id = $revision_id;
+                       else
+                               $id = $post->ID;
                }
+               $data = $message;
+       } else {
+               if ( isset( $_POST['auto_draft'] ) && '1' == $_POST['auto_draft'] )
+                       $id = 0; // This tells us it didn't actually save
+               else
+                       $id = $post->ID;
        }
 
-       if ( $do_lock && $id && is_numeric($id) )
+       if ( $do_lock && ( isset( $_POST['auto_draft'] ) && ( $_POST['auto_draft'] != '1' ) ) && $id && is_numeric($id) )
                wp_set_post_lock( $id );
 
        if ( $nonce_age == 2 ) {
@@ -1000,21 +1047,14 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
        ) );
        $x->send();
        break;
-case 'autosave-generate-nonces' :
-       check_ajax_referer( 'autosave', 'autosavenonce' );
-       $ID = (int) $_POST['post_ID'];
-       $post_type = ( 'page' == $_POST['post_type'] ) ? 'page' : 'post';
-       if ( current_user_can( "edit_{$post_type}", $ID ) )
-               die( json_encode( array( 'updateNonce' => wp_create_nonce( "update-{$post_type}_{$ID}" ), 'deleteURL' => str_replace( '&amp;', '&', wp_nonce_url( admin_url( $post_type . '.php?action=trash&post=' . $ID ), "trash-{$post_type}_{$ID}" ) ) ) ) );
-       do_action('autosave_generate_nonces');
-       die('0');
-break;
 case 'closed-postboxes' :
        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'] );
+       $closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed']) : array();
+       $closed = array_filter($closed);
+
+       $hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden']) : array();
+       $hidden = array_filter($hidden);
+
        $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
 
        if ( !preg_match( '/^[a-z_-]+$/', $page ) )
@@ -1024,11 +1064,11 @@ case 'closed-postboxes' :
                die('-1');
 
        if ( is_array($closed) )
-               update_usermeta($user->ID, 'closedpostboxes_'.$page, $closed);
+               update_user_option($user->ID, "closedpostboxes_$page", $closed, true);
 
        if ( is_array($hidden) ) {
-               $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown
-               update_usermeta($user->ID, 'meta-box-hidden_'.$page, $hidden);
+               $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown
+               update_user_option($user->ID, "metaboxhidden_$page", $hidden, true);
        }
 
        die('1');
@@ -1046,8 +1086,66 @@ case 'hidden-columns' :
                die('-1');
 
        if ( is_array($hidden) )
-               update_usermeta($user->ID, "manage-$page-columns-hidden", $hidden);
+               update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
+
+       die('1');
+       break;
+case 'menu-get-metabox' :
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               die('-1');
+
+       require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
+
+       if ( isset( $_POST['item-type'] ) && 'post_type' == $_POST['item-type'] ) {
+               $type = 'posttype';
+               $callback = 'wp_nav_menu_item_post_type_meta_box';
+               $items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
+       } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' == $_POST['item-type'] ) {
+               $type = 'taxonomy';
+               $callback = 'wp_nav_menu_item_taxonomy_meta_box';
+               $items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' );
+       }
+
+       if ( ! empty( $_POST['item-object'] ) && isset( $items[$_POST['item-object']] ) ) {
+               $item = apply_filters( 'nav_menu_meta_box_object', $items[ $_POST['item-object'] ] );
+               ob_start();
+               call_user_func_array($callback, array(
+                       null,
+                       array(
+                               'id' => 'add-' . $item->name,
+                               'title' => $item->labels->name,
+                               'callback' => $callback,
+                               'args' => $item,
+                       )
+               ));
+
+               $markup = ob_get_clean();
+
+               echo json_encode(array(
+                       'replace-id' => $type . '-' . $item->name,
+                       'markup' => $markup,
+               ));
+       }
+
+       exit;
+       break;
+case 'menu-quick-search':
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               die('-1');
+
+       require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
 
+       _wp_ajax_menu_quick_search( $_REQUEST );
+
+       exit;
+       break;
+case 'menu-locations-save':
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               die('-1');
+       check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+       if ( ! isset( $_POST['menu-locations'] ) )
+               die('0');
+       set_theme_mod( 'nav_menu_locations', $_POST['menu-locations'] );
        die('1');
        break;
 case 'meta-box-order':
@@ -1063,10 +1161,10 @@ case 'meta-box-order':
                die('-1');
 
        if ( $order )
-               update_user_option($user->ID, "meta-box-order_$page", $order);
+               update_user_option($user->ID, "meta-box-order_$page", $order, true);
 
        if ( $page_columns )
-               update_usermeta($user->ID, "screen_layout_$page", $page_columns);
+               update_user_option($user->ID, "screen_layout_$page", $page_columns, true);
 
        die('1');
        break;
@@ -1079,7 +1177,7 @@ case 'sample-permalink':
        check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
        $title = isset($_POST['new_title'])? $_POST['new_title'] : '';
-       $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
+       $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
        die(get_sample_permalink_html($post_id, $title, $slug));
 break;
 case 'inline-save':
@@ -1096,6 +1194,9 @@ case 'inline-save':
                        die( __('You are not allowed to edit this post.') );
        }
 
+       if ( isset($_POST['screen']) )
+               set_current_screen($_POST['screen']);
+
        if ( $last = wp_check_post_lock( $post_ID ) ) {
                $last_user = get_userdata( $last );
                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
@@ -1135,7 +1236,7 @@ case 'inline-save':
        if ( 'page' == $_POST['post_type'] ) {
                $post[] = get_post($_POST['post_ID']);
                page_rows($post);
-       } elseif ( 'post' == $_POST['post_type'] ) {
+       } elseif ( 'post' == $_POST['post_type'] || in_array($_POST['post_type'], get_post_types( array('public' => true) ) ) ) {
                $mode = $_POST['post_view'];
                $post[] = get_post($_POST['post_ID']);
                post_rows($post);
@@ -1146,32 +1247,18 @@ case 'inline-save':
 case 'inline-save-tax':
        check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
 
-       if ( ! current_user_can('manage_categories') )
+       $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : false;
+       if ( ! $taxonomy )
+               die( __('Cheatin&#8217; uh?') );
+       $tax = get_taxonomy($taxonomy);
+
+       if ( ! current_user_can( $tax->cap->edit_terms ) )
                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);
 
@@ -1190,12 +1277,19 @@ case 'inline-save-tax':
                        $updated = wp_update_term($id, $taxonomy, $_POST);
                        if ( $updated && !is_wp_error($updated) ) {
                                $tag = get_term( $updated['term_id'], $taxonomy );
-                               if ( !$tag || is_wp_error( $tag ) )
-                                       die( __('Tag not updated.') );
+                               if ( !$tag || is_wp_error( $tag ) ) {
+                                       if ( is_wp_error($tag) && $tag->get_error_message() )
+                                               die( $tag->get_error_message() );
+                                       die( __('Item not updated.') );
+                               }
+
+                               set_current_screen( 'edit-' . $taxonomy );
 
-                               echo _tag_row($tag, '', $taxonomy);
+                               echo _tag_row($tag, 0, $taxonomy);
                        } else {
-                               die( __('Tag not updated.') );
+                               if ( is_wp_error($updated) && $updated->get_error_message() )
+                                       die( $updated->get_error_message() );
+                               die( __('Item not updated.') );
                        }
 
                        break;
@@ -1209,7 +1303,11 @@ case 'find_posts':
        if ( empty($_POST['ps']) )
                exit;
 
-       $what = isset($_POST['pages']) ? 'page' : 'post';
+       if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) )
+               $what = $_POST['post_type'];
+       else
+               $what = 'post';
+
        $s = stripslashes($_POST['ps']);
        preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
        $search_terms = array_map('_search_terms_tidy', $matches[0]);
@@ -1226,8 +1324,10 @@ case 'find_posts':
 
        $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" );
 
-       if ( ! $posts )
-               exit( __('No posts found.') );
+       if ( ! $posts ) {
+               $posttype = get_post_type_object($what);
+               exit($posttype->labels->not_found);
+       }
 
        $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Date').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
        foreach ( $posts as $post ) {
@@ -1284,7 +1384,7 @@ case 'lj-importer' :
 case 'widgets-order' :
        check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
 
-       if ( !current_user_can('switch_themes') )
+       if ( !current_user_can('edit_theme_options') )
                die('-1');
 
        unset( $_POST['savewidgets'], $_POST['action'] );
@@ -1314,7 +1414,7 @@ case 'widgets-order' :
 case 'save-widget' :
        check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
 
-       if ( !current_user_can('switch_themes') || !isset($_POST['id_base']) )
+       if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) )
                die('-1');
 
        unset( $_POST['savewidgets'], $_POST['action'] );
@@ -1406,24 +1506,27 @@ case 'image-editor':
        die();
        break;
 case 'set-post-thumbnail':
-       $post_id = intval( $_POST['post_id'] );
-       if ( !current_user_can( 'edit_post', $post_id ) )
+       $post_ID = intval( $_POST['post_id'] );
+       if ( !current_user_can( 'edit_post', $post_ID ) )
                die( '-1' );
        $thumbnail_id = intval( $_POST['thumbnail_id'] );
 
+       check_ajax_referer( "set_post_thumbnail-$post_ID" );
+
        if ( $thumbnail_id == '-1' ) {
-               delete_post_meta( $post_id, '_thumbnail_id' );
+               delete_post_meta( $post_ID, '_thumbnail_id' );
                die( _wp_post_thumbnail_html() );
        }
 
        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
                $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
                if ( !empty( $thumbnail_html ) ) {
-                       update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );
+                       update_post_meta( $post_ID, '_thumbnail_id', $thumbnail_id );
                        die( _wp_post_thumbnail_html( $thumbnail_id ) );
                }
        }
        die( '0' );
+       break;
 default :
        do_action( 'wp_ajax_' . $_POST['action'] );
        die('0');
index a43a4e459b3e9039c31fc8540d7af5d07db93804..c43ef2e827ee39f8a115eddada9ccd9c0318b94a 100644 (file)
@@ -22,14 +22,13 @@ do_action( 'in_admin_footer' );
 $upgrade = apply_filters( 'update_footer', '' );
 echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.').'</span> | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>') ); ?>
 </p>
-<?php // if ( $is_IE ) browse_happy(); ?>
 <p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
 <div class="clear"></div>
 </div>
 <?php
 do_action('admin_footer', '');
 do_action('admin_print_footer_scripts');
-do_action("admin_footer-$hook_suffix");
+do_action("admin_footer-" . $GLOBALS['hook_suffix']);
 
 // get_site_option() won't exist when auto upgrading from <= 2.7
 if ( function_exists('get_site_option') ) {
index 81711f38464462270537260bb31d8c757ebebdac..61ba38b2147391f9dc58e8ebac519fd3fa84aef2 100644 (file)
@@ -7,7 +7,8 @@
  */
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
-if (!isset($_GET["page"])) require_once('admin.php');
+if ( ! defined( 'WP_ADMIN' ) )
+       require_once( './admin.php' );
 
 get_admin_page_title();
 $title = esc_html( strip_tags( $title ) );
@@ -25,28 +26,32 @@ wp_admin_css( 'css/global' );
 wp_admin_css();
 wp_admin_css( 'css/colors' );
 wp_admin_css( 'css/ie' );
+if ( is_multisite() )
+       wp_admin_css( 'css/ms' );
 wp_enqueue_script('utils');
 
-$hook_suffix = '';
-if ( isset($page_hook) )
-       $hook_suffix = "$page_hook";
-else if ( isset($plugin_page) )
-       $hook_suffix = "$plugin_page";
-else if ( isset($pagenow) )
-       $hook_suffix = "$pagenow";
-
 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
 ?>
 <script type="text/javascript">
 //<![CDATA[
 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
-var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
-var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>',  thousandsSeparator = '<?php echo $wp_locale->number_format['thousands_sep']; ?>', decimalPoint = '<?php echo $wp_locale->number_format['decimal_point']; ?>';
+var userSettings = {
+               'url': '<?php echo SITECOOKIEPATH; ?>',
+               'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
+               'time':'<?php echo time() ?>'
+       },
+       ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
+       pagenow = '<?php echo $current_screen->id; ?>',
+       typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
+       adminpage = '<?php echo $admin_body_class; ?>',
+       thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
+       decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
+       isRtl = <?php echo (int) is_rtl(); ?>;
 //]]>
 </script>
 <?php
 
-if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
+if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
        add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
        wp_enqueue_script('quicktags');
 }
@@ -59,9 +64,8 @@ do_action('admin_print_scripts');
 do_action("admin_head-$hook_suffix");
 do_action('admin_head');
 
-if ( get_user_setting('mfold') == 'f' ) {
+if ( get_user_setting('mfold') == 'f' )
        $admin_body_class .= ' folded';
-}
 
 if ( $is_iphone ) { ?>
 <style type="text/css">.row-actions{visibility:visible;}</style>
@@ -90,6 +94,7 @@ if ( '' == $blog_name ) {
        if ( $blog_name != $blog_name_excerpt )
                $blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
        $blog_name = $blog_name_excerpt;
+       unset($blog_name_excerpt);
 }
 $title_class = '';
 if ( function_exists('mb_strlen') ) {
@@ -101,28 +106,52 @@ if ( function_exists('mb_strlen') ) {
 }
 ?>
 
-<img id="header-logo" src="../wp-includes/images/blank.gif" alt="" width="32" height="32" /> <h1 id="site-heading" <?php echo $title_class ?>><a href="<?php echo trailingslashit( get_bloginfo('url') ); ?>" title="<?php _e('Visit Site') ?>"><span id="site-title"><?php echo $blog_name ?></span> <em id="site-visit-button"><?php _e('Visit Site') ?></em></a></h1>
+<img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="32" height="32" />
+<h1 id="site-heading" <?php echo $title_class ?>>
+       <a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
+               <span id="site-title"><?php echo $blog_name ?></span>
+       </a>
+<?php if ( current_user_can('manage_options') && '1' != get_option('blog_public') ): ?>
+       <a id="privacy-on-link" href="options-privacy.php" title="<?php echo esc_attr( apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') ) ); ?>"><?php echo apply_filters('privacy_on_link_text', __('Search Engines Blocked') ); ?></a>
+<?php endif; ?>
+</h1>
+
+<?php do_action('in_admin_header'); ?>
 
 <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>
+<p><?php
+$links = array();
+$links[5] = sprintf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity);
+$links[15] = '| <a href="' . wp_logout_url() . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a>';
+
+$links = apply_filters('admin_user_info_links', $links, $current_user);
+ksort($links);
+
+echo implode(' ', $links);
+?></p>
 </div>
 
-<?php favorite_actions($hook_suffix); ?>
+<?php favorite_actions($current_screen); ?>
 </div>
 </div>
 
 <div id="wpbody">
-<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
+<?php
+unset($title_class, $blog_name);
+
+require(ABSPATH . 'wp-admin/menu-header.php');
+
+$current_screen->parent_file = $parent_file;
+$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
+$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
+?>
 
 <div id="wpbody-content">
 <?php
-screen_meta($hook_suffix);
+screen_meta($current_screen);
 
 do_action('admin_notices');
 
-if ( $parent_file == 'options-general.php' ) {
+if ( $parent_file == 'options-general.php' )
        require(ABSPATH . 'wp-admin/options-head.php');
-}
index 4d321576053dfdbe4b50fe670a89fec3dd774cce..a759d452b091437032d4d6da060b5a4f8d6b658c 100644 (file)
 if ( !defined('WP_ADMIN') )
        define('WP_ADMIN', TRUE);
 
-if ( defined('ABSPATH') )
-       require_once(ABSPATH . 'wp-load.php');
-else
-       require_once('../wp-load.php');
+if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
+       define('WP_LOAD_IMPORTERS', true);
+
+require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
 
 if ( get_option('db_upgraded') ) {
        $wp_rewrite->flush_rules();
@@ -30,8 +30,25 @@ if ( get_option('db_upgraded') ) {
         */
        do_action('after_db_upgrade');
 } elseif ( get_option('db_version') != $wp_db_version ) {
-       wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
-       exit;
+       if ( !is_multisite() ) {
+               wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
+               exit;
+       } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
+               /**
+                * On really small MU installs run the upgrader every time,
+                * else run it less often to reduce load.
+                *
+                * @since 2.8.4b
+                */
+               $c = get_blog_count();
+               if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
+                       require_once( ABSPATH . WPINC . '/http.php' );
+                       $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
+                       do_action( 'after_mu_upgrade', $response );
+                       unset($response);
+               }
+               unset($c);
+       }
 }
 
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
@@ -48,32 +65,44 @@ if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
 
 set_screen_options();
 
-$posts_per_page = get_option('posts_per_page');
 $date_format = get_option('date_format');
 $time_format = get_option('time_format');
 
 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback'));
 
-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' );
 
 $editing = false;
 
-if (isset($_GET['page'])) {
+if ( isset($_GET['page']) ) {
        $plugin_page = stripslashes($_GET['page']);
        $plugin_page = plugin_basename($plugin_page);
 }
 
+if ( isset($_GET['post_type']) )
+       $typenow = sanitize_key($_GET['post_type']);
+else
+       $typenow = '';
+
+if ( isset($_GET['taxonomy']) )
+       $taxnow = sanitize_key($_GET['taxonomy']);
+else
+       $taxnow = '';
+
 require(ABSPATH . 'wp-admin/menu.php');
 
+if ( current_user_can( 'manage_options' ) )
+       @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
+
 do_action('admin_init');
 
-// Handle plugin admin pages.
-if (isset($plugin_page)) {
-       if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
+if ( isset($plugin_page) ) {
+       if ( !empty($typenow) )
+               $the_parent = $pagenow . '?post_type=' . $typenow;
+       else
+               $the_parent = $pagenow;
+       if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
                $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') ) {
@@ -86,7 +115,21 @@ if (isset($plugin_page)) {
                        exit;
                }
        }
+       unset($the_parent);
+}
+
+$hook_suffix = '';
+if ( isset($page_hook) )
+       $hook_suffix = $page_hook;
+else if ( isset($plugin_page) )
+       $hook_suffix = $plugin_page;
+else if ( isset($pagenow) )
+       $hook_suffix = $pagenow;
+
+set_current_screen();
 
+// Handle plugin admin pages.
+if ( isset($plugin_page) ) {
        if ( $page_hook ) {
                do_action('load-' . $page_hook);
                if (! isset($_GET['noheader']))
@@ -94,19 +137,22 @@ if (isset($plugin_page)) {
 
                do_action($page_hook);
        } else {
-               if ( validate_file($plugin_page) ) {
+               if ( validate_file($plugin_page) )
                        wp_die(__('Invalid plugin page'));
-               }
 
-               if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
+
+               if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) )
                        wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
 
                do_action('load-' . $plugin_page);
 
-               if (isset($_GET['noheader']))
+               if ( !isset($_GET['noheader']))
                        require_once(ABSPATH . 'wp-admin/admin-header.php');
 
-               include(WP_PLUGIN_DIR . "/$plugin_page");
+               if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") )
+                       include(WPMU_PLUGIN_DIR . "/$plugin_page");
+               else
+                       include(ABSPATH . PLUGINDIR . "/$plugin_page");
        }
 
        include(ABSPATH . 'wp-admin/admin-footer.php');
@@ -119,17 +165,13 @@ if (isset($plugin_page)) {
        if ( ! current_user_can('import') )
                wp_die(__('You are not allowed to import.'));
 
-       if ( validate_file($importer) ) {
-               wp_die(__('Invalid importer.'));
-       }
+       if ( validate_file($importer) )
+               wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
 
        // Allow plugins to define importers as well
-       if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! 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"))
-               {
-                       wp_die(__('Cannot load importer.'));
-               }
+                       wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
                include(ABSPATH . "wp-admin/import/$importer.php");
        }
 
@@ -144,6 +186,9 @@ if (isset($plugin_page)) {
 
        define('WP_IMPORTING', true);
 
+       if ( is_multisite() )
+               kses_init_filters();  // Always filter imported data with kses.
+
        call_user_func($wp_importers[$importer][2]);
 
        include(ABSPATH . 'wp-admin/admin-footer.php');
index a384453a283ccc7e9df6e163f62459279fb38c22..4210b0e0c4096987a8c12fb2e4f364a1bbd8258a 100644 (file)
@@ -21,7 +21,7 @@ elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
        $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
 unset($current_user);
-require_once('admin.php');
+require_once('./admin.php');
 
 header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
 
@@ -43,16 +43,18 @@ if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id
 check_admin_referer('media-form');
 
 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-if (is_wp_error($id)) {
-       echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div>';
+if ( is_wp_error($id) ) {
+       echo '<div class="error-div">
+       <a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss') . '</a>
+       <strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload due to an error'), esc_html($_FILES['async-upload']['name']) ) . '</strong><br />' .
+       esc_html($id->get_error_message()) . '</div>';
        exit;
 }
 
 if ( $_REQUEST['short'] ) {
        // short form response - attachment ID only
        echo $id;
-}
-else {
+} else {
        // long form response - big chunk o html
        $type = $_REQUEST['type'];
        echo apply_filters("async_upload_{$type}", $id);
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
deleted file mode 100644 (file)
index 9639281..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-<?php
-/**
- * Categories Management Panel
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** Load WordPress Bootstrap */
-require_once('admin.php');
-
-$title = __('Categories');
-
-wp_reset_vars( array('action', 'cat') );
-
-if ( isset( $_GET['action'] ) && isset($_GET['delete']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
-       $action = 'bulk-delete';
-
-switch($action) {
-
-case 'addcat':
-
-       check_admin_referer('add-category');
-
-       if ( !current_user_can('manage_categories') )
-               wp_die(__('Cheatin&#8217; uh?'));
-
-       if ( wp_insert_category($_POST ) )
-               wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' );
-       else
-               wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' );
-
-       exit;
-break;
-
-case 'delete':
-       if ( !isset( $_GET['cat_ID'] ) ) {
-               wp_redirect('categories.php');
-               exit;
-       }
-
-       $cat_ID = (int) $_GET['cat_ID'];
-       check_admin_referer('delete-category_' .  $cat_ID);
-
-       if ( !current_user_can('manage_categories') )
-               wp_die(__('Cheatin&#8217; uh?'));
-
-       // Don't delete the default cats.
-       if ( $cat_ID == get_option('default_category') )
-               wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
-
-       wp_delete_category($cat_ID);
-
-       wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) );
-       exit;
-
-break;
-
-case 'bulk-delete':
-       check_admin_referer('bulk-categories');
-
-       if ( !current_user_can('manage_categories') )
-               wp_die( __('You are not allowed to delete categories.') );
-
-       $cats = (array) $_GET['delete'];
-       $default_cat = get_option('default_category');
-       foreach ( $cats as $cat_ID ) {
-               $cat_ID = (int) $cat_ID;
-
-               // Don't delete the default cat.
-               if ( $cat_ID == $default_cat )
-                       wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
-
-               wp_delete_category($cat_ID);
-       }
-
-       wp_safe_redirect( wp_get_referer() );
-       exit;
-
-break;
-case 'edit':
-
-       $title = __('Edit Category');
-
-       require_once ('admin-header.php');
-       $cat_ID = (int) $_GET['cat_ID'];
-       $category = get_category_to_edit($cat_ID);
-       include('edit-category-form.php');
-
-break;
-
-case 'editedcat':
-       $cat_ID = (int) $_POST['cat_ID'];
-       check_admin_referer('update-category_' . $cat_ID);
-
-       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) )
-               $location = add_query_arg('message', 3, $location);
-       else
-               $location = add_query_arg('message', 5, $location);
-
-       wp_redirect($location);
-
-       exit;
-break;
-
-default:
-
-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;
-}
-
-wp_enqueue_script('admin-categories');
-if ( current_user_can('manage_categories') )
-       wp_enqueue_script('inline-edit-tax');
-
-require_once ('admin-header.php');
-
-$messages[1] = __('Category added.');
-$messages[2] = __('Category deleted.');
-$messages[3] = __('Category updated.');
-$messages[4] = __('Category not added.');
-$messages[5] = __('Category not updated.');
-?>
-
-<div class="wrap nosubsub">
-<?php screen_icon(); ?>
-<h2><?php echo esc_html( $title );
-if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
-</h2>
-
-<?php
-if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
-<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; ?>
-
-<form class="search-form topmargin" action="" method="get">
-<p class="search-box">
-       <label class="screen-reader-text" for="category-search-input"><?php _e('Search Categories'); ?>:</label>
-       <input type="text" id="category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php esc_attr_e( 'Search Categories' ); ?>" class="button" />
-</p>
-</form>
-<br class="clear" />
-
-<div id="col-container">
-
-<div id="col-right">
-<div class="col-wrap">
-<form id="posts-filter" action="" method="get">
-<div class="tablenav">
-
-<?php
-$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
-if ( empty($pagenum) )
-       $pagenum = 1;
-
-$cats_per_page = (int) get_user_option( 'categories_per_page', 0, false );
-if ( empty( $cats_per_page ) || $cats_per_page < 1 )
-       $cats_per_page = 20;
-$cats_per_page = apply_filters( 'edit_categories_per_page', $cats_per_page );
-
-if ( !empty($_GET['s']) )
-       $num_cats = count(get_categories(array('hide_empty' => 0, 'search' => $_GET['s'])));
-else
-       $num_cats = wp_count_terms('category');
-
-$page_links = paginate_links( array(
-       'base' => add_query_arg( 'pagenum', '%#%' ),
-       'format' => '',
-       'prev_text' => __('&laquo;'),
-       'next_text' => __('&raquo;'),
-       'total' => ceil($num_cats / $cats_per_page),
-       'current' => $pagenum
-));
-
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
-
-<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 esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-<?php wp_nonce_field('bulk-categories'); ?>
-</div>
-
-<br class="clear" />
-</div>
-
-<div class="clear"></div>
-
-<table class="widefat fixed" cellspacing="0">
-       <thead>
-       <tr>
-<?php print_column_headers('categories'); ?>
-       </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, $cats_per_page);
-?>
-       </tbody>
-</table>
-
-<div class="tablenav">
-<?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 esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
-<?php wp_nonce_field('bulk-categories'); ?>
-</div>
-
-<br class="clear" />
-</div>
-
-</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_cat_name(get_option('default_category')))) ?></p>
-<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
-</div>
-
-</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 esc_attr_e('Add Category'); ?>" /></p>
-<?php do_action('edit_category_form', $category); ?>
-</form></div>
-
-<?php } ?>
-
-</div>
-</div><!-- /col-left -->
-
-</div><!-- /col-container -->
-</div><!-- /wrap -->
-
-<?php
-inline_edit_term_row('categories');
-
-break;
-}
-
-include('admin-footer.php');
-
-?>
index 8b63a57a27ad742d1e72f5d4707576c375c2c0a8..58d6e326a5d7349c916716a8f12e1ad45ae2b0d0 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** Load WordPress Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 $parent_file = 'edit-comments.php';
 $submenu_file = 'edit-comments.php';
@@ -36,7 +36,7 @@ if ( isset( $_GET['dt'] ) ) {
  */
 function comment_footer_die( $msg ) {
        echo "<div class='wrap'><p>$msg</p></div>";
-       include('admin-footer.php');
+       include('./admin-footer.php');
        die;
 }
 
@@ -45,8 +45,15 @@ switch( $action ) {
 case 'editcomment' :
        $title = __('Edit Comment');
 
+       add_contextual_help( $current_screen, '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' .
+       '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' .
+       '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+       '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Panels#Comments" target="_blank">Comments Documentation</a>' ) . '</p>' .
+       '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank" >Support Forums</a>' ) . '</p>'
+       );
+
        wp_enqueue_script('comment');
-       require_once('admin-header.php');
+       require_once('./admin-header.php');
 
        $comment_id = absint( $_GET['c'] );
 
@@ -61,7 +68,7 @@ case 'editcomment' :
 
        $comment = get_comment_to_edit( $comment_id );
 
-       include('edit-form-comment.php');
+       include('./edit-form-comment.php');
 
        break;
 
@@ -70,22 +77,38 @@ case 'approve' :
 case 'trash'   :
 case 'spam'    :
 
-       require_once('admin-header.php');
-
        $comment_id = absint( $_GET['c'] );
+
+       if ( !$comment = get_comment_to_edit( $comment_id ) ) {
+               wp_redirect( admin_url('edit-comments.php?error=1') );
+               die();
+       }
+
+       if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
+               wp_redirect( admin_url('edit-comments.php?error=2') );
+               die();
+       }
+
+       // No need to re-approve/re-trash/re-spam a comment.
+       if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) {
+               wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
+               die();
+       }
+
+       require_once('./admin-header.php');
+
        $formaction    = $action . 'comment';
        $nonce_action  = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
        $nonce_action .= $comment_id;
 
-       if ( !$comment = get_comment_to_edit( $comment_id ) )
-               comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
-
-       if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
-               comment_footer_die( 'approve' != $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
 ?>
 <div class='wrap'>
 
 <div class="narrow">
+
+<?php screen_icon(); ?>
+<h2><?php esc_html_e( 'Moderate Comment' ); ?></h2>
+
 <?php
 switch ( $action ) {
        case 'spam' :
@@ -105,8 +128,24 @@ switch ( $action ) {
                $button      = __('Approve Comment');
                break;
 }
-?>
 
+if ( $comment->comment_approved != '0' ) { // if not unapproved
+       $message = '';
+       switch ( $comment->comment_approved ) {
+               case '1' :
+                       $message = __('This comment is currently approved.');
+                       break;
+               case 'spam' :
+                       $message  = __('This comment is currently marked as spam.');
+                       break;
+               case 'trash' :
+                       $message  = __('This comment is currently in the Trash.');
+                       break;
+       }
+       if ( $message )
+               echo '<div class="updated"><p>' . $message . '</p></div>';
+}
+?>
 <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
 
 <table class="form-table comment-ays">
@@ -127,12 +166,12 @@ switch ( $action ) {
 </tr>
 <?php } ?>
 <tr>
-<th scope="row" valign="top"><?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
+<th scope="row" valign="top"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
 
-<p><?php _e('Are you sure you want to do that?'); ?></p>
+<p><?php _e('Are you sure you want to do this?'); ?></p>
 
 <form action='comment.php' method='get'>
 
@@ -155,13 +194,19 @@ switch ( $action ) {
 <?php
        break;
 
-case 'deletecomment' :
-case 'trashcomment' :
-case 'untrashcomment' :
-case 'spamcomment' :
-case 'unspamcomment' :
+case 'deletecomment'    :
+case 'trashcomment'     :
+case 'untrashcomment'   :
+case 'spamcomment'      :
+case 'unspamcomment'    :
+case 'approvecomment'   :
+case 'unapprovecomment' :
        $comment_id = absint( $_REQUEST['c'] );
-       check_admin_referer( 'delete-comment_' . $comment_id );
+
+       if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
+               check_admin_referer( 'approve-comment_' . $comment_id );
+       else
+               check_admin_referer( 'delete-comment_' . $comment_id );
 
        $noredir = isset($_REQUEST['noredir']);
 
@@ -170,14 +215,16 @@ case 'unspamcomment' :
        if ( !current_user_can('edit_post', $comment->comment_post_ID ) )
                comment_footer_die( __('You are not allowed to edit comments on this post.') );
 
-       if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php') )
+       if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') )
                $redir = wp_get_referer();
-       elseif ( '' != wp_get_original_referer() && false == $noredir )
+       elseif ( '' != wp_get_original_referer() && ! $noredir )
                $redir = wp_get_original_referer();
+       elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
+               $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
        else
                $redir = admin_url('edit-comments.php');
 
-       $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir );
+       $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir );
 
        switch ( $action ) {
                case 'deletecomment' :
@@ -200,48 +247,20 @@ case 'unspamcomment' :
                        wp_unspam_comment($comment_id);
                        $redir = add_query_arg( array('unspammed' => '1'), $redir );
                        break;
+               case 'approvecomment' :
+                       wp_set_comment_status( $comment_id, 'approve' );
+                       $redir = add_query_arg( array( 'approved' => 1 ), $redir );
+                       break;
+               case 'unapprovecomment' :
+                       wp_set_comment_status( $comment_id, 'hold' );
+                       $redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
+                       break;
        }
 
        wp_redirect( $redir );
-
        die;
        break;
 
-case 'approvecomment'   :
-case 'unapprovecomment' :
-       $comment_id = absint( $_GET['c'] );
-       check_admin_referer( 'approve-comment_' . $comment_id );
-
-       $noredir = isset( $_GET['noredir'] );
-
-       if ( !$comment = get_comment( $comment_id ) )
-               comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
-
-       if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
-               if ( 'approvecomment' == $action )
-                       comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
-               else
-                       comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
-       }
-
-       if ( '' != wp_get_referer() && false == $noredir )
-               $redir = remove_query_arg( array('approved', 'unapproved'), wp_get_referer() );
-       else
-               $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
-
-       if ( 'approvecomment' == $action ) {
-               wp_set_comment_status( $comment_id, 'approve' );
-               $redir = add_query_arg( array( 'approved' => 1 ), $redir );
-       } else {
-               wp_set_comment_status( $comment_id, 'hold' );
-               $redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
-       }
-
-       wp_redirect( $redir );
-
-       exit();
-       break;
-
 case 'editedcomment' :
 
        $comment_id = absint( $_POST['comment_ID'] );
@@ -264,6 +283,6 @@ default:
 
 } // end switch
 
-include('admin-footer.php');
+include('./admin-footer.php');
 
 ?>
index 99239be4291c9e249c0e455ffb6ebe317f5e37a4..8cd8ec83649752152b702ca195e4dc6466a7b058 100644 (file)
@@ -1,80 +1 @@
-.bar {
-       border-right-color: transparent;
-       border-left-color: #99d;
-}
-
-.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-vs.gif') repeat-x scroll right -379px;
-}
-#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-vs.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-vs.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-vs.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-vs.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-vs.gif) repeat-x scroll right -109px;
-}
-
-#adminmenu a.wp-has-submenu {
-       background: #f1f1f1 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -379px;
-}
-
-#adminmenu .wp-submenu a {
-       background: #FFFFFF url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -310px;
-}
-
-#adminmenu li.current a,
-#adminmenu .wp-submenu a:hover {
-       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll  right -289px;
-}
-
-#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
-       background: #b5b5b5 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right top;
-}
-
-.meta-box-sortables .postbox:hover .handlediv {
-       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;
-}
+.bar{border-right-color:transparent;border-left-color:#99d;}.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-vs.gif') repeat-x scroll right -379px;}#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-vs.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-vs.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-vs.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-vs.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-vs.gif) repeat-x scroll right -109px;}#adminmenu a.wp-has-submenu{background:#f1f1f1 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -379px;}#adminmenu .wp-submenu a{background:#fff url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -310px;}#adminmenu li.wp-has-current-submenu a.wp-has-submenu{background:#b5b5b5 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right top;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;}#favorite-toggle{background:transparent url(../images/fav-arrow-vs-rtl.gif?ver=20100531) no-repeat right -4px;}
\ No newline at end of file
diff --git a/wp-admin/css/colors-classic-rtl.dev.css b/wp-admin/css/colors-classic-rtl.dev.css
new file mode 100644 (file)
index 0000000..38b070c
--- /dev/null
@@ -0,0 +1,79 @@
+.bar {
+       border-right-color: transparent;
+       border-left-color: #99d;
+}
+
+.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-vs.gif') repeat-x scroll right -379px;
+}
+#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-vs.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-vs.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-vs.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-vs.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-vs.gif) repeat-x scroll right -109px;
+}
+
+#adminmenu a.wp-has-submenu {
+       background: #f1f1f1 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #fff url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -310px;
+}
+
+#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
+       background: #b5b5b5 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right top;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;
+}
+
+#favorite-toggle {
+       background: transparent url(../images/fav-arrow-vs-rtl.gif?ver=20100531) no-repeat right -4px;
+}
\ No newline at end of file
index 427f262b42a646db5a6d22ecf3db4d6f51f372ba..abacd39f5047608f2e9c60f5b60c25e114776304 100644 (file)
@@ -1 +1 @@
-html{background-color:#f7f6f1;}* html input,* html .widget{border-color:#8cbdd5;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.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;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#ccc;}#poststuff .inside label.spam,#poststuff .inside label.deleted{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-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,ul#category-tabs li.tabs{border-color:#dfdfdf;}ul#category-tabs li.tabs{background-color:#f1f1f1;}input.disabled,textarea.disabled{background-color:#ccc;}.login #backtoblog a:hover,#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.stuffbox h3{background:#d5e6f2 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;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#093e56;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alt .alternate{background-color:#edfbfc;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#8cbdd5;}.highlight{background-color:#e4f2fd;color:#d54e21;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.rss-widget span.rss-date,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.button,.button-secondary,.submit input,input[type=button],input[type=submit]{border-color:#dfdfdf;color:#464646;}.button:hover,.button-secondary:hover,.submit input:hover,input[type=button]:hover,input[type=submit]:hover{color:#000;border-color:#adaca7;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#5b86ab;font-weight:bold;color:#fff;background:#5580a6 url(../images/button-grad-vs.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active-vs.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#2e5475;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#B0C3E2!important;background:#6590A6!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#dashboard_right_now .table{background:#faf9f7!important;}#side-sortables #category-tabs .tabs a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#b8d3e2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th,#install-plugins .plugins td,#install-plugins .plugins th{border-color:#dfdfdf;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.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:#d5e6f2 url(../images/blue-grad.png) repeat-x scroll left top;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#1c6280;}body.press-this .tabs a,body.press-this .tabs a:hover{background-color:#fff;border-color:#c6d9e9;border-bottom-color:#fff;color:#d54e21;}#adminmenu #awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow,#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li a:hover #awaiting-mod,#adminmenu li a:hover .update-plugins,#sidemenu li a:hover .update-plugins{background-color:#264761;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) 0 -1px 0;-khtml-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;-webkit-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;box-shadow:rgba(0,0,0,0.2) 0 -1px 0;}#adminmenu li.current a:hover #awaiting-mod,#adminmenu li.current a:hover .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;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on{color:#777;}.login #nav a{color:#21759b!important;}.login #nav a:hover{color:#d54e21!important;}#footer,#footer-upgrade{background:#1d507d;color:#b6d1e4;}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,.postbox,#your-profile #rich_editing{background-color:#fff;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#ebeeef;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#dfdfdf;}.widget,.postbox{background-color:#fff;}.ui-sortable .postbox h3{color:#093e56;}.widget .widget-top,.ui-sortable .postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag{background-color:#fffeeb;border-color:#ccc;color:#555;}.login #backtoblog a{color:#ccc;}#wphead{background-color:#1d507d;}body.login{border-top-color:#093e56;}#wphead h1 a{color:#fff;}#user_info{color:#b6d1e4;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{color:#fff;text-decoration:none;}#user_info a:hover,#user_info a:active,#footer a:hover,#footer a:active{text-decoration:underline;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover,#dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#dfdfdf;background-color:#dfdfdf;}#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:#f2f1eb;border-color:#dfdfdf;color:#999;}#poststuff #editor-toolbar .active{border-bottom-color:#e3eef7;background-color:#e3eef7;color:#333;}#post-status-info{background-color:#ededed;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin iframe{background:#fff;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{background-color:#e9e8e8;border-color:#b2b2b2;}.wp_themeSkin a.mceButtonEnabled:hover,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonSelected{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceButtonDisabled{border-color:#ccc!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#b2b2b2;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText{border-color:#777!important;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText{border-color:#777!important;}.wp_themeSkin select.mceListBox{border-color:#b2b2b2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{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{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceSplitButtonActive{background-color:#b2b2b2;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#b2b2b2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#b2b2b2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0a246a;background-color:#b6bdd2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0a246a;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}#quicktags,.wp_themeSkin tr.mceFirst td.mceToolbar{background:#e3eef7 url("../images/ed-bg-vs.gif") repeat-x scroll left top;}.wp_themeSkin tr.mceFirst td.mceToolbar{border-color:#dfdfdf;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;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;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;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;}#editorcontainer,#post-status-info,#titlediv #title,.editwidget .widget-inside{border-color:#dfdfdf;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#dfdfdf;}#adminmenu *{border-color:#dfdfdf;}#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-vs.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-vs.gif) no-repeat scroll left -109px;}#adminmenu a.menu-top{background:#eaf3fa url(../images/menu-bits-vs.gif) repeat-x scroll left -379px;}#adminmenu .wp-submenu a{background:#fff url(../images/menu-bits-vs.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:#3c6b95 url(../images/menu-bits-vs.gif) top left repeat-x;border-color:#1d507d;color:#fff;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}#adminmenu li.wp-has-current-submenu .wp-submenu,#adminmenu li.wp-has-current-submenu 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:#6583c0;}#adminmenu .wp-submenu .current a.current{background:transparent url(../images/menu-bits-vs.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) 0 1px 0;}#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;}#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;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#e4f2fd;}#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:#eae9e4;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;}.vim-current,.vim-current th,.vim-current td{background-color:#e4f2fd!important;}.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-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:#fff;border-color:#ddd;}.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-vs.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-vs.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.tabs 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:#5580a6 url(../images/fav-vs.png) repeat-x 0 center;border-color:#517ea5!important;border-bottom-color:#416686!important;}#favorite-actions .slide-down{background-image:url(../images/fav-top-vs.gif);background-position:0 0;background-repeat:repeat-x;}#favorite-inside{border-color:#5b86ac;background-color:#5580a6;}#favorite-toggle{background:transparent url(../images/fav-arrow-vs.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;}#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-profile,#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-vs.gif) no-repeat scroll center center;}#wphead #site-visit-button{background-color:#3c6b95;background-image:url(../images/visit-site-button-grad-vs.gif);color:#b6d1e4;text-shadow:#3f3f3f 0 -1px 0;}#wphead a:hover #site-visit-button{color:#fff;}#wphead a:focus #site-visit-button,#wphead a:active #site-visit-button{background-position:0 -27px;}.popular-tags,.feature-filter{background-color:#fff;border-color:#dfdfdf;}#theme-information .action-button{border-top-color:#dfdfdf;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#f1f1f1;border-color:#ddd;}#available-widgets .widget-holder{background-color:#fff;border-color:#ddd;}#widgets-left .sidebar-name{background-color:#aaa;background-image:url(../images/ed-bg-vs.gif);text-shadow:#FFF 0 1px 0;border-color:#dfdfdf;}#widgets-right .sidebar-name{background-image:url(../images/fav-vs.png);text-shadow:#3f3f3f 0 -1px 0;background-color:#636363;border-color:#636363;color:#fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}#widgets-left .sidebar-name-arrow{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px;}#widgets-right .sidebar-name-arrow{background:transparent url(../images/fav-arrow-vs.gif) no-repeat scroll 0 -1px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}
\ No newline at end of file
+html{background-color:#f7f6f1;}* html input,* html .widget{border-color:#8cbdd5;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.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;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#ccc;}#poststuff .inside label.spam,#poststuff .inside label.deleted{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-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{border-color:#dfdfdf;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{background-color:#f1f1f1;}input.disabled,textarea.disabled{background-color:#ccc;}.login #backtoblog a:hover,#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.stuffbox h3{background:#d5e6f2 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;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#093e56;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alt .alternate{background-color:#edfbfc;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#8cbdd5;}.highlight{background-color:#e4f2fd;color:#d54e21;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.rss-widget span.rss-date,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.button,.button-secondary,.submit input,input[type=button],input[type=submit]{border-color:#dfdfdf;color:#464646;}.button:hover,.button-secondary:hover,.submit input:hover,input[type=button]:hover,input[type=submit]:hover{color:#000;border-color:#adaca7;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#5b86ab;font-weight:bold;color:#fff;background:#5580a6 url(../images/button-grad-vs.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active-vs.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#2e5475;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#B0C3E2!important;background:#6590A6!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#side-sortables .category-tabs .tabs a,#side-sortables .add-menu-item-tabs .tabs a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#b8d3e2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th,#install-plugins .plugins td,#install-plugins .plugins th{border-color:#dfdfdf;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.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:#d5e6f2 url(../images/blue-grad.png) repeat-x scroll left top;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#1c6280;}body.press-this .tabs a,body.press-this .tabs a:hover{border-color:#c6d9e9;border-bottom-color:#fff;color:#d54e21;}#adminmenu #awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow,#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li a:hover #awaiting-mod,#adminmenu li a:hover .update-plugins,#sidemenu li a:hover .update-plugins{background-color:#264761;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) 0 -1px 0;-khtml-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;-webkit-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;box-shadow:rgba(0,0,0,0.2) 0 -1px 0;}#adminmenu li.current a:hover #awaiting-mod,#adminmenu li.current a:hover .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;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on{color:#777;}.login #nav a{color:#21759b!important;}.login #nav a:hover{color:#d54e21!important;}#footer,#footer-upgrade{background:#1d507d;color:#b6d1e4;}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,.postbox,#your-profile #rich_editing{background-color:#fff;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#ebeeef;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#dfdfdf;}.widget,.postbox{background-color:#fff;}.ui-sortable .postbox h3{color:#093e56;}.widget .widget-top,.ui-sortable .postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag,.update-nag{background-color:#FFFBCC;border-color:#E6DB55;color:#555;}.login #backtoblog a{color:#ccc;}#wphead{background-color:#1d507d;}body.login{border-top-color:#093e56;}#wphead h1 a{color:#fff;}#user_info{color:#b6d1e4;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{color:#fff;text-decoration:none;}#user_info a:hover,#user_info a:active,#footer a:hover,#footer a:active{text-decoration:underline;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover,#dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#dfdfdf;background-color:#dfdfdf;}#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:#f2f1eb;border-color:#dfdfdf;color:#999;}#poststuff #editor-toolbar .active{border-bottom-color:#e3eef7;background-color:#e3eef7;color:#333;}#post-status-info{background-color:#ededed;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin iframe{background:#fff;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{background-color:#e9e8e8;border-color:#b2b2b2;}.wp_themeSkin a.mceButtonEnabled:hover,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonSelected{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceButtonDisabled{border-color:#ccc!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#b2b2b2;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText{border-color:#777!important;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText{border-color:#777!important;}.wp_themeSkin select.mceListBox{border-color:#b2b2b2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{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{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceSplitButtonActive{background-color:#b2b2b2;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#b2b2b2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#b2b2b2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0a246a;background-color:#b6bdd2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0a246a;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}#quicktags,.wp_themeSkin tr.mceFirst td.mceToolbar{background:#d5e6f2 url("../images/ed-bg-vs.gif") repeat-x scroll left top;}.wp_themeSkin tr.mceFirst td.mceToolbar{border-color:#dfdfdf;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;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;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;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;}#editorcontainer,#post-status-info,#titlediv #title,.editwidget .widget-inside{border-color:#dfdfdf;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#dfdfdf;}#adminmenu *{border-color:#dfdfdf;}#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-vs.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-vs.gif) no-repeat scroll left -109px;}#adminmenu a.menu-top{background:#eaf3fa url(../images/menu-bits-vs.gif) repeat-x scroll left -379px;}#adminmenu .wp-submenu a{background:#fff url(../images/menu-bits-vs.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:#3c6b95 url(../images/menu-bits-vs.gif) top left repeat-x;border-color:#1d507d;color:#fff;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}#adminmenu li.wp-has-current-submenu .wp-submenu,#adminmenu li.wp-has-current-submenu 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:#6583c0;}#adminmenu .wp-submenu .current a.current{background:transparent url(../images/menu-bits-vs.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) 0 1px 0;}#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;}#adminmenu .menu-icon-dashboard div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -61px -33px;}#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-dashboard.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -61px -1px;}#adminmenu .menu-icon-post div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -272px -33px;}#adminmenu .menu-icon-post:hover div.wp-menu-image,#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -272px -1px;}#adminmenu .menu-icon-media div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -121px -33px;}#adminmenu .menu-icon-media:hover div.wp-menu-image,#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -121px -1px;}#adminmenu .menu-icon-links div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -91px -33px;}#adminmenu .menu-icon-links:hover div.wp-menu-image,#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -91px -1px;}#adminmenu .menu-icon-page div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -151px -33px;}#adminmenu .menu-icon-page:hover div.wp-menu-image,#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -151px -1px;}#adminmenu .menu-icon-comments div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -31px -33px;}#adminmenu .menu-icon-comments:hover div.wp-menu-image,#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-comments.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -31px -1px;}#adminmenu .menu-icon-appearance div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -1px -33px;}#adminmenu .menu-icon-appearance:hover div.wp-menu-image,#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -1px -1px;}#adminmenu .menu-icon-plugins div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -181px -33px;}#adminmenu .menu-icon-plugins:hover div.wp-menu-image,#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -181px -1px;}#adminmenu .menu-icon-users div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -301px -33px;}#adminmenu .menu-icon-users:hover div.wp-menu-image,#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -301px -1px;}#adminmenu .menu-icon-tools div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -211px -33px;}#adminmenu .menu-icon-tools:hover div.wp-menu-image,#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -211px -1px;}#adminmenu .menu-icon-settings div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -241px -33px;}#adminmenu .menu-icon-settings:hover div.wp-menu-image,#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -241px -1px;}#adminmenu .menu-icon-site div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -361px -33px;}#adminmenu .menu-icon-site:hover div.wp-menu-image,#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -361px -1px;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#e4f2fd;}#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:#eae9e4;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;}.vim-current,.vim-current th,.vim-current td{background-color:#e4f2fd!important;}.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-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:#fff;border-color:#ddd;}.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-vs.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-vs.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.tabs a,#post-body ul.add-menu-item-tabs li.tabs 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:#5580a6 url(../images/fav-vs.png) repeat-x 0 center;border-color:#517ea5!important;border-bottom-color:#416686!important;}#favorite-actions .slide-down{background-image:url(../images/fav-top-vs.gif);background-position:0 0;background-repeat:repeat-x;}#favorite-inside{border-color:#5b86ac;background-color:#5580a6;}#favorite-toggle{background:transparent url(../images/fav-arrow-vs.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;}#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?ver=20100531) no-repeat -552px -5px;}#icon-index{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -137px -5px;}#icon-upload{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -251px -5px;}#icon-link-manager,#icon-link,#icon-link-category{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -190px -5px;}#icon-edit-pages,#icon-page{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -312px -5px;}#icon-edit-comments{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -72px -5px;}#icon-themes{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -11px -5px;}#icon-plugins{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -370px -5px;}#icon-users,#icon-profile,#icon-user-edit{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -600px -5px;}#icon-tools,#icon-admin{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -432px -5px;}#icon-options-general{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -492px -5px;}#icon-ms-admin{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -659px -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-vs.png) no-repeat scroll center center;}#wphead #site-visit-button{background-color:#3c6b95;background-image:url(../images/visit-site-button-grad-vs.gif);color:#b6d1e4;text-shadow:#3f3f3f 0 -1px 0;}#wphead a:hover #site-visit-button{color:#fff;}#wphead a:focus #site-visit-button,#wphead a:active #site-visit-button{background-position:0 -27px;}.popular-tags,.feature-filter{background-color:#fff;border-color:#dfdfdf;}#theme-information .action-button{border-top-color:#dfdfdf;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#f1f1f1;border-color:#ddd;}#available-widgets .widget-holder{background-color:#fff;border-color:#ddd;}#widgets-left .sidebar-name{background-color:#aaa;background-image:url(../images/ed-bg-vs.gif);text-shadow:#fff 0 1px 0;border-color:#dfdfdf;}#widgets-right .sidebar-name{background-image:url(../images/fav-vs.png);text-shadow:#3f3f3f 0 -1px 0;background-color:#636363;border-color:#636363;color:#fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}#widgets-left .sidebar-name-arrow{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px;}#widgets-right .sidebar-name-arrow{background:transparent url(../images/fav-arrow-vs.gif) no-repeat scroll 0 -1px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}#nav-menu-header,.menu-item-handle{background:url("../images/blue-grad.png") repeat-x scroll left top #d5e6f2;}#menu-management .nav-tab-active{background:#eaf3fa;border-bottom-color:#eaf3fa;}
\ No newline at end of file
index 9f2441863c0bcd2a4d29748231a27140a138081b..3d9924f706fd0a0a7f021e75b1a8ce265683e952 100644 (file)
@@ -4,7 +4,7 @@ html {
 
 * html input,
 * html .widget {
-    border-color: #8cbdd5;
+       border-color: #8cbdd5;
 }
 
 textarea,
@@ -110,11 +110,13 @@ div.dashboard-widget-submit {
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs {
        border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs {
        background-color: #f1f1f1;
 }
 
@@ -380,11 +382,8 @@ div.dashboard-widget-submit input:hover,
        border-color: #dfdfdf;
 }
 
-#dashboard_right_now .table {
-       background:#faf9f7 !important;
-}
-
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a,
+#side-sortables .add-menu-item-tabs .tabs a {
        color: #333;
 }
 
@@ -442,7 +441,7 @@ div.dashboard-widget-submit input:hover,
 }
 
 .update-message {
-       color: #000000;
+       color: #000;
 }
 
 a.page-numbers {
@@ -497,7 +496,6 @@ a,
 /* Because we don't want visited on these links */
 body.press-this .tabs a,
 body.press-this .tabs a:hover {
-       background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        color: #d54e21;
@@ -697,9 +695,9 @@ table.widefat span.spam a,
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#update-nag {
-       background-color: #fffeeb;
-       border-color: #ccc;
+#update-nag, .update-nag {
+       background-color: #FFFBCC;
+       border-color: #E6DB55;
        color: #555;
 }
 
@@ -949,7 +947,7 @@ table.widefat .spam a:hover,
 
 #quicktags,
 .wp_themeSkin tr.mceFirst td.mceToolbar {
-       background: #e3eef7 url("../images/ed-bg-vs.gif") repeat-x scroll left top;
+       background: #d5e6f2 url("../images/ed-bg-vs.gif") repeat-x scroll left top;
 }
 .wp_themeSkin tr.mceFirst td.mceToolbar {
        border-color: #dfdfdf;
@@ -1145,105 +1143,114 @@ table.widefat .spam a:hover,
 }
 
 /* menu icons */
-#adminmenu #menu-dashboard div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -33px;
+#adminmenu .menu-icon-dashboard div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -61px -33px;
+}
+
+#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,
+#adminmenu  .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,
+#adminmenu  .menu-icon-dashboard.current div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -61px -1px;
+}
+
+#adminmenu .menu-icon-post div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -272px -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-icon-post:hover div.wp-menu-image,
+#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -272px -1px;
 }
 
-#adminmenu #menu-posts div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -33px;
+#adminmenu .menu-icon-media div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -121px -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-icon-media:hover div.wp-menu-image,
+#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -121px -1px;
 }
 
-#adminmenu #menu-media div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -33px;
+#adminmenu .menu-icon-links div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -91px -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-icon-links:hover div.wp-menu-image,
+#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -91px -1px;
 }
 
-#adminmenu #menu-links div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -33px;
+#adminmenu .menu-icon-page div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -151px -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-icon-page:hover div.wp-menu-image,
+#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -151px -1px;
 }
 
-#adminmenu #menu-pages div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -33px;
+#adminmenu .menu-icon-comments div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -31px -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-icon-comments:hover div.wp-menu-image,
+#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,
+#adminmenu .menu-icon-comments.current div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -31px -1px;
 }
 
-#adminmenu #menu-comments div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -33px;
+#adminmenu .menu-icon-appearance div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -1px -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-icon-appearance:hover div.wp-menu-image,
+#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -1px -1px;
 }
 
-#adminmenu #menu-appearance div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -33px;
+#adminmenu .menu-icon-plugins div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -181px -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-icon-plugins:hover div.wp-menu-image,
+#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -181px -1px;
 }
 
-#adminmenu #menu-plugins div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -33px;
+#adminmenu .menu-icon-users div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -301px -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-icon-users:hover div.wp-menu-image,
+#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -301px -1px;
 }
 
-#adminmenu #menu-users div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -33px;
+#adminmenu .menu-icon-tools div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -211px -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-icon-tools:hover div.wp-menu-image,
+#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -211px -1px;
 }
 
-#adminmenu #menu-tools div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -33px;
+#adminmenu .menu-icon-settings div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -241px -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-icon-settings:hover div.wp-menu-image,
+#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -241px -1px;
 }
 
-#adminmenu #menu-settings div.wp-menu-image {
-       background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -33px;
+#adminmenu .menu-icon-site div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -361px -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;
+#adminmenu .menu-icon-site:hover div.wp-menu-image,
+#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -361px -1px;
 }
 /* end menu */
 
@@ -1463,7 +1470,8 @@ fieldset.inline-edit-col-right .inline-edit-col {
        background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a,
+#post-body ul.add-menu-item-tabs li.tabs a {
        color: #333;
 }
 
@@ -1527,53 +1535,57 @@ fieldset.inline-edit-col-right .inline-edit-col {
 
 #icon-edit,
 #icon-post {
-       background: transparent url(../images/icons32-vs.png) no-repeat -552px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -552px -5px;
 }
 
 #icon-index {
-       background: transparent url(../images/icons32-vs.png) no-repeat -137px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -137px -5px;
 }
 
 #icon-upload {
-       background: transparent url(../images/icons32-vs.png) no-repeat -251px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -251px -5px;
 }
 
 #icon-link-manager,
 #icon-link,
 #icon-link-category {
-       background: transparent url(../images/icons32-vs.png) no-repeat -190px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -190px -5px;
 }
 
 #icon-edit-pages,
 #icon-page {
-       background: transparent url(../images/icons32-vs.png) no-repeat -312px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -312px -5px;
 }
 
 #icon-edit-comments {
-       background: transparent url(../images/icons32-vs.png) no-repeat -72px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -72px -5px;
 }
 
 #icon-themes {
-       background: transparent url(../images/icons32-vs.png) no-repeat -11px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -11px -5px;
 }
 
 #icon-plugins {
-       background: transparent url(../images/icons32-vs.png) no-repeat -370px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -370px -5px;
 }
 
 #icon-users,
 #icon-profile,
 #icon-user-edit {
-       background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -600px -5px;
 }
 
 #icon-tools,
 #icon-admin {
-       background: transparent url(../images/icons32-vs.png) no-repeat -432px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -432px -5px;
 }
 
 #icon-options-general {
-       background: transparent url(../images/icons32-vs.png) no-repeat -492px -5px;
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -492px -5px;
+}
+
+#icon-ms-admin {
+       background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -659px -5px;
 }
 
 .view-switch #view-switch-list {
@@ -1593,7 +1605,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #header-logo {
-       background: transparent url(../images/wp-logo-vs.gif) no-repeat scroll center center;
+       background: transparent url(../images/wp-logo-vs.png) no-repeat scroll center center;
 }
 
 #wphead #site-visit-button {
@@ -1629,18 +1641,18 @@ fieldset.inline-edit-col-right .inline-edit-col {
 div.widgets-sortables,
 #widgets-left .inactive {
        background-color: #f1f1f1;
-    border-color: #ddd;
+       border-color: #ddd;
 }
 
 #available-widgets .widget-holder {
-    background-color: #fff;
-    border-color: #ddd;
+       background-color: #fff;
+       border-color: #ddd;
 }
 
 #widgets-left .sidebar-name {
        background-color: #aaa;
        background-image: url(../images/ed-bg-vs.gif);
-       text-shadow: #FFFFFF 0 1px 0;
+       text-shadow: #fff 0 1px 0;
        border-color: #dfdfdf;
 }
 
@@ -1706,3 +1718,12 @@ div.widgets-sortables,
 .comment-ays th {
        background-color: #f1f1f1;
 }
+
+#nav-menu-header, .menu-item-handle {
+       background: url("../images/blue-grad.png") repeat-x scroll left top #d5e6f2;
+}
+
+#menu-management .nav-tab-active {
+       background: #eaf3fa;
+       border-bottom-color: #eaf3fa;
+}
\ No newline at end of file
index b6d88bb24d1523a2dae30a79c891d4948e19065b..18930fdcb63b1407f80812e82828bcca80905d73 100644 (file)
@@ -1,83 +1 @@
-.bar {
-       border-right-color: transparent;
-       border-left-color: #99d;
-}
-
-.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;
-}
-
-#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;
-}
+.bar{border-right-color:transparent;border-left-color:#99d;}.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?ver=20100531') repeat-x scroll right -379px;}#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?ver=20100531) 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?ver=20100531) 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?ver=20100531) 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?ver=20100531) 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?ver=20100531) repeat-x scroll right -109px;}#adminmenu a.wp-has-submenu{background:#f1f1f1 url(../images/menu-bits-rtl.gif?ver=20100531) repeat-x scroll right -379px;}#adminmenu .wp-submenu a{background:#fff url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -310px;}#adminmenu li.wp-has-current-submenu a.wp-has-submenu{background:#b5b5b5 url(../images/menu-bits-rtl.gif?ver=20100531) repeat-x scroll right top;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -111px;}#favorite-toggle{background:transparent url(../images/fav-arrow-rtl.gif?ver=20100531) no-repeat right -4px;}
\ No newline at end of file
diff --git a/wp-admin/css/colors-fresh-rtl.dev.css b/wp-admin/css/colors-fresh-rtl.dev.css
new file mode 100644 (file)
index 0000000..8071127
--- /dev/null
@@ -0,0 +1,78 @@
+.bar {
+       border-right-color: transparent;
+       border-left-color: #99d;
+}
+
+.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?ver=20100531') repeat-x scroll right -379px;
+}
+#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?ver=20100531) 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?ver=20100531) 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?ver=20100531) 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?ver=20100531) 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?ver=20100531) repeat-x scroll right -109px;
+}
+
+#adminmenu a.wp-has-submenu {
+       background: #f1f1f1 url(../images/menu-bits-rtl.gif?ver=20100531) repeat-x scroll right -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #fff url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -310px;
+}
+
+#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
+       background: #b5b5b5 url(../images/menu-bits-rtl.gif?ver=20100531) repeat-x scroll right top;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -111px;
+}
+#favorite-toggle {
+       background: transparent url(../images/fav-arrow-rtl.gif?ver=20100531) no-repeat right -4px;
+}
index f9448c8d7aab9b3ef9acd8985382e8198b255de3..6937d35bedf3f82410e56f6aa6e94d79f79e21fa 100644 (file)
@@ -1 +1 @@
-html{background-color:#f9f9f9;}* html input,* html .widget{border-color:#dfdfdf;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.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;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#ccc;}#poststuff .inside label.spam,#poststuff .inside label.deleted{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-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,ul#category-tabs li.tabs{border-color:#dfdfdf;}ul#category-tabs li.tabs{background-color:#f1f1f1;}input.disabled,textarea.disabled{background-color:#ccc;}.login #backtoblog a:hover,#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.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;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#464646;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alternate,.alt{background-color:#f9f9f9;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#DFDFDF;}.highlight{background-color:#e4f2fd;color:#d54e21;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.rss-widget span.rss-date,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.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;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#298cba;font-weight:bold;color:#fff;background:#21759B url(../images/button-grad.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#13455b;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#9FD0D5!important;background:#298CBA!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#side-sortables #category-tabs .tabs a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#B8D3E2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th,#install-plugins .plugins td,#install-plugins .plugins th{border-color:#dfdfdf;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.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;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#21759b;}body.press-this .tabs a,body.press-this .tabs a:hover{background-color:#fff;border-color:#c6d9e9;border-bottom-color:#fff;color:#d54e21;}#adminmenu #awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow,#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li a:hover #awaiting-mod,#adminmenu li a:hover .update-plugins,#sidemenu li a:hover .update-plugins{background-color:#264761;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) 0 -1px 0;-khtml-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;-webkit-box-shadow:rgba(0,0,0,0.2) 0 -1px 0;box-shadow:rgba(0,0,0,0.2) 0 -1px 0;}#adminmenu li.current a:hover #awaiting-mod,#adminmenu li.current a:hover .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;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on{color:#777;}.login #nav a{color:#21759b!important;}.login #nav a:hover{color:#d54e21!important;}#footer,#footer-upgrade{background:#464646;color:#999;}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,#your-profile #rich_editing{background-color:#fff;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#eee;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#dfdfdf;}.widget,.postbox{background-color:#fff;}.ui-sortable .postbox h3{color:#464646;}.widget .widget-top,.ui-sortable .postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag{background-color:#fffeeb;border-color:#ccc;color:#555;}.login #backtoblog a{color:#ccc;}#wphead{background-color:#464646;}body.login{border-top-color:#464646;}#wphead h1 a{color:#fff;}#user_info{color:#999;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{color:#ccc;text-decoration:none;}#user_info a:hover,#footer a:hover{color:#fff;text-decoration:underline!important;}#user_info a:active,#footer a:active{color:#ccc!important;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover #dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#dfdfdf;background-color:#dfdfdf;}#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;}#post-status-info{background-color:#EDEDED;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin iframe{background:#fff;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{background-color:#e9e8e8;border-color:#B2B2B2;}.wp_themeSkin a.mceButtonEnabled:hover,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonSelected{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceButtonDisabled{border-color:#ccc!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#B2B2B2;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText{border-color:#777!important;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText{border-color:#777!important;}.wp_themeSkin select.mceListBox{border-color:#B2B2B2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{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{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceSplitButtonActive{background-color:#B2B2B2;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0A246A;background-color:#B6BDD2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0A246A;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}.wp_themeSkin tr.mceFirst td.mceToolbar{background:#dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top;border-color:#dfdfdf;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;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;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;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;}#editorcontainer,#post-status-info,#titlediv #title,.editwidget .widget-inside{border-color:#dfdfdf;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#ddd;}#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:#FFF 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) 0 -1px 0;}#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) 0 1px 0;}#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;}#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;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#E4F2FD;}#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;}.vim-current,.vim-current th,.vim-current td{background-color:#E4F2FD!important;}.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-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:#FFF;border-color:#ddd;}.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.tabs 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;}#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-profile,#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;}#wphead #site-visit-button{background-color:#585858;background-image:url(../images/visit-site-button-grad.gif);color:#aaa;text-shadow:#3F3F3F 0 -1px 0;}#wphead a:hover #site-visit-button{color:#fff;}#wphead a:focus #site-visit-button,#wphead a:active #site-visit-button{background-position:0 -27px;}.popular-tags,.feature-filter{background-color:#FFF;border-color:#DFDFDF;}#theme-information .action-button{border-top-color:#DFDFDF;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#f1f1f1;border-color:#ddd;}#available-widgets .widget-holder{background-color:#fff;border-color:#ddd;}#widgets-left .sidebar-name{background-color:#aaa;background-image:url(../images/ed-bg.gif);text-shadow:#FFF 0 1px 0;border-color:#dfdfdf;}#widgets-right .sidebar-name{background-image:url(../images/fav.png);text-shadow:#3f3f3f 0 -1px 0;background-color:#636363;border-color:#636363;color:#fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}#widgets-left .sidebar-name-arrow{background:transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;}#widgets-right .sidebar-name-arrow{background:transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}
\ No newline at end of file
+html{background-color:#f9f9f9;}* html input,* html .widget{border-color:#dfdfdf;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.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;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#ccc;}#poststuff .inside label.spam,#poststuff .inside label.deleted{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-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{border-color:#dfdfdf;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{background-color:#f1f1f1;}input.disabled,textarea.disabled{background-color:#ccc;}#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.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;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#464646;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alternate,.alt{background-color:#f9f9f9;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#DFDFDF;}.highlight{background-color:#e4f2fd;color:#d54e21;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.rss-widget span.rss-date,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.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;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#298cba;font-weight:bold;color:#fff;background:#21759B url(../images/button-grad.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#13455b;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#9FD0D5!important;background:#298CBA!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#side-sortables .category-tabs .tabs a,#side-sortables .add-menu-item-tabs .tabs a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#B8D3E2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th,#install-plugins .plugins td,#install-plugins .plugins th{border-color:#dfdfdf;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.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;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#21759b;}body.press-this .tabs a,body.press-this .tabs a:hover{background-color:#fff;border-color:#c6d9e9;border-bottom-color:#fff;color:#d54e21;}#adminmenu #awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow{background-color:#464646;color:#fff;-moz-box-shadow:#fff 0 -1px 0;-khtml-box-shadow:#fff 0 -1px 0;-webkit-box-shadow:#fff 0 -1px 0;box-shadow:#fff 0 -1px 0;}#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li.current a #awaiting-mod,#adminmenu li a.wp-has-current-submenu .update-plugins{background-color:#464646;color:#fff;-moz-box-shadow:#fff 0 -1px 0;-khtml-box-shadow:#fff 0 -1px 0;-webkit-box-shadow:#fff 0 -1px 0;box-shadow:#fff 0 -1px 0;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on{color:#777;}.login #nav a{color:#21759b!important;}.login #nav a:hover{color:#d54e21!important;}#footer{color:#777;border-color:#d1d1d1;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,#your-profile #rich_editing{background-color:#fff;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#eee;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#dfdfdf;}.widget,.postbox{background-color:#fff;}.ui-sortable .postbox h3{color:#464646;}.widget .widget-top,.ui-sortable .postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag,.update-nag{background-color:#FFFBCC;border-color:#E6DB55;color:#555;}.login #backtoblog a{color:#464646;}#wphead{border-bottom:#c6c6c6 1px solid;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));}#wphead h1 a{color:#464646;}#user_info{color:#777;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{color:#222;text-decoration:none;}#user_info a:hover,#footer a:hover{color:#000;text-decoration:underline!important;}#user_info a:active,#footer a:active{color:#ccc!important;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover #dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#dfdfdf;background-color:#dfdfdf;}#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;}#post-status-info{background-color:#EDEDED;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin iframe{background:#fff;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{background-color:#e9e8e8;border-color:#B2B2B2;}.wp_themeSkin a.mceButtonEnabled:hover,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonSelected{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceButtonDisabled{border-color:#ccc!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#B2B2B2;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText{border-color:#777!important;background-color:#d5d5d5;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText{border-color:#777!important;}.wp_themeSkin select.mceListBox{border-color:#B2B2B2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{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{background-color:#d5d5d5;border-color:#777!important;}.wp_themeSkin .mceSplitButtonActive{background-color:#B2B2B2;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0A246A;background-color:#B6BDD2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0A246A;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}.wp_themeSkin tr.mceFirst td.mceToolbar{background:#dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top;border-color:#dfdfdf;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;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;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;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;}#editorcontainer,#post-status-info,#titlediv #title,.editwidget .widget-inside{border-color:#dfdfdf;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#ddd;}#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?ver=20100610) 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?ver=20100610) no-repeat scroll left -109px;}#adminmenu a.menu-top{background:#f1f1f1 url(../images/menu-bits.gif?ver=20100610) repeat-x scroll left -379px;}#adminmenu .wp-submenu a{background:#fff url(../images/menu-bits.gif?ver=20100610) 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;}.wp-has-current-submenu .wp-submenu{border-top:none!important;}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{border-bottom:#aaa 1px solid;}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,#adminmenu li.current a.menu-top{background:#e0e0e0 url(../images/menu-bits.gif?ver=20100610) top left repeat-x;border:#aaa 1px solid;color:#000;}#adminmenu li.wp-has-current-submenu .wp-submenu,#adminmenu li.wp-has-current-submenu ul li a{border-right-color:#aaa!important;border-left-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 .wp-submenu .current a.current{background:transparent url(../images/menu-bits.gif?ver=20100610) 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;}#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;}#adminmenu .menu-icon-dashboard div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -61px -33px;}#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-dashboard.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -61px -1px;}#adminmenu .menu-icon-post div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -272px -33px;}#adminmenu .menu-icon-post:hover div.wp-menu-image,#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -272px -1px;}#adminmenu .menu-icon-media div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -121px -33px;}#adminmenu .menu-icon-media:hover div.wp-menu-image,#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -121px -1px;}#adminmenu .menu-icon-links div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -91px -33px;}#adminmenu .menu-icon-links:hover div.wp-menu-image,#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -91px -1px;}#adminmenu .menu-icon-page div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -151px -33px;}#adminmenu .menu-icon-page:hover div.wp-menu-image,#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -151px -1px;}#adminmenu .menu-icon-comments div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -31px -33px;}#adminmenu .menu-icon-comments:hover div.wp-menu-image,#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-comments.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -31px -1px;}#adminmenu .menu-icon-appearance div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -1px -33px;}#adminmenu .menu-icon-appearance:hover div.wp-menu-image,#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -1px -1px;}#adminmenu .menu-icon-plugins div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -181px -33px;}#adminmenu .menu-icon-plugins:hover div.wp-menu-image,#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -181px -1px;}#adminmenu .menu-icon-users div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -301px -33px;}#adminmenu .menu-icon-users:hover div.wp-menu-image,#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -301px -1px;}#adminmenu .menu-icon-tools div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -211px -33px;}#adminmenu .menu-icon-tools:hover div.wp-menu-image,#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -211px -1px;}#adminmenu .menu-icon-settings div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -241px -33px;}#adminmenu .menu-icon-settings:hover div.wp-menu-image,#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -241px -1px;}#adminmenu .menu-icon-site div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -361px -33px;}#adminmenu .menu-icon-site:hover div.wp-menu-image,#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -361px -1px;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#E4F2FD;}#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;}.vim-current,.vim-current th,.vim-current td{background-color:#E4F2FD!important;}.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-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:#fff;border-color:#ddd;}.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?ver=20100610) 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?ver=20100610') 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.tabs a,#post-body ul.add-menu-item-tabs li.tabs 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{border-color:#c0c0c0;background:#f1f1f1;background:-moz-linear-gradient(bottom,#e7e7e7,#fff);background:-webkit-gradient(linear,left bottom,left top,from(#e7e7e7),to(#fff));}#favorite-inside{border-color:#c0c0c0;background-color:#fff;}#favorite-toggle{background:transparent url(../images/fav-arrow.gif?ver=20100531) no-repeat 0 -4px;}#favorite-actions a{color:#464646;}#favorite-actions a:hover{color:#000;}#favorite-inside a:hover{text-decoration:underline;}#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?ver=20100531) no-repeat -552px -5px;}#icon-index{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -137px -5px;}#icon-upload{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -251px -5px;}#icon-link-manager,#icon-link,#icon-link-category{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -190px -5px;}#icon-edit-pages,#icon-page{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -312px -5px;}#icon-edit-comments{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -72px -5px;}#icon-themes{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -11px -5px;}#icon-plugins{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -370px -5px;}#icon-users,#icon-profile,#icon-user-edit{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -600px -5px;}#icon-tools,#icon-admin{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -432px -5px;}#icon-options-general{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -492px -5px;}#icon-ms-admin{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -659px -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.png?ver=20100531) no-repeat scroll center center;}.popular-tags,.feature-filter{background-color:#fff;border-color:#DFDFDF;}#theme-information .action-button{border-top-color:#DFDFDF;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#f1f1f1;border-color:#ddd;}#available-widgets .widget-holder{background-color:#fff;border-color:#ddd;}#widgets-left .sidebar-name{background-color:#aaa;background-image:url(../images/ed-bg.gif);text-shadow:#fff 0 1px 0;border-color:#dfdfdf;}#widgets-right .sidebar-name{background-image:url(../images/fav.png);text-shadow:#3f3f3f 0 -1px 0;background-color:#636363;border-color:#636363;color:#fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}#widgets-left .sidebar-name-arrow{background:transparent url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px;}#widgets-right .sidebar-name-arrow{background:transparent url(../images/widgets-arrow.gif?ver=20100531) no-repeat scroll 0 -1px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}#nav-menu-header,.menu-item-handle{background:url("../images/gray-grad.png") repeat-x scroll left top #dfdfdf;}#menu-management .nav-tab-active{background:#ececec;border-bottom-color:#ececec;}
\ No newline at end of file
index 41a86aedfed162364c3276b4f9f3ffe5ca0b0c7a..f7790130e4edfd13d6ae752eda4b05645f77892c 100644 (file)
@@ -4,7 +4,7 @@ html {
 
 * html input,
 * html .widget {
-    border-color: #dfdfdf;
+       border-color: #dfdfdf;
 }
 
 textarea,
@@ -110,11 +110,13 @@ div.dashboard-widget-submit {
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs {
        border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs {
        background-color: #f1f1f1;
 }
 
@@ -123,7 +125,6 @@ textarea.disabled {
        background-color: #ccc;
 }
 /* #upload-menu li a.upload-tab-link, */
-.login #backtoblog a:hover,
 #plugin-information .action-button a,
 #plugin-information .action-button a:hover,
 #plugin-information .action-button a:visited {
@@ -380,7 +381,8 @@ div.dashboard-widget-submit input:hover,
        border-color: #dfdfdf;
 }
 
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a,
+#side-sortables .add-menu-item-tabs .tabs a {
        color: #333;
 }
 
@@ -438,7 +440,7 @@ div.dashboard-widget-submit input:hover,
 }
 
 .update-message {
-       color: #000000;
+       color: #000;
 }
 
 a.page-numbers {
@@ -502,38 +504,27 @@ body.press-this .tabs a:hover {
 #adminmenu #awaiting-mod,
 #adminmenu .update-plugins,
 #sidemenu a .update-plugins,
-#rightnow .reallynow,
-#plugin-information .action-button {
-       background-color: #d54e21;
+#rightnow .reallynow {
+       background-color: #464646;
        color: #fff;
+       -moz-box-shadow: #fff 0 -1px 0;
+       -khtml-box-shadow: #fff 0 -1px 0;
+       -webkit-box-shadow: #fff 0 -1px 0;
+       box-shadow: #fff 0 -1px 0;
 }
-
-#adminmenu li a:hover #awaiting-mod,
-#adminmenu li a:hover .update-plugins,
-#sidemenu li a:hover .update-plugins {
-       background-color: #264761;
+#plugin-information .action-button {
+       background-color: #d54e21;
        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) 0 -1px 0;
-       -khtml-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
-       -webkit-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
-       box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
-}
-
-#adminmenu li.current a:hover #awaiting-mod,
-#adminmenu li.current a:hover .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;
+#adminmenu  li a.wp-has-current-submenu .update-plugins{
+       background-color: #464646;
        color: #fff;
+       -moz-box-shadow: #fff 0 -1px 0;
+       -khtml-box-shadow: #fff 0 -1px 0;
+       -webkit-box-shadow: #fff 0 -1px 0;
+       box-shadow: #fff 0 -1px 0;
 }
 
 div#media-upload-header,
@@ -577,10 +568,12 @@ input.readonly, textarea.readonly {
        color: #d54e21 !important;
 }
 
-#footer,
-#footer-upgrade {
-       background: #464646;
-       color: #999;
+#footer {
+       color: #777;
+       border-color: #d1d1d1;
+       background: #d9d9d9; /* fallback color */
+       background:-moz-linear-gradient(bottom,  #d7d7d7,  #e4e4e4);
+       background:-webkit-gradient(linear, left bottom, left top, from(#d7d7d7), to(#e4e4e4));
 }
 
 #media-items,
@@ -692,43 +685,42 @@ table.widefat span.spam a,
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#update-nag {
-       background-color: #fffeeb;
-       border-color: #ccc;
+#update-nag, .update-nag {
+       background-color: #FFFBCC;
+       border-color: #E6DB55;
        color: #555;
 }
 
 .login #backtoblog a {
-       color: #ccc;
+       color: #464646;
 }
 
 #wphead {
-       background-color: #464646;
-}
-
-body.login {
-       border-top-color: #464646;
+       border-bottom:#c6c6c6 1px solid;
+       background: #d9d9d9; /* fallback color */
+       background:-moz-linear-gradient(bottom,  #d7d7d7,  #e4e4e4);
+       background:-webkit-gradient(linear, left bottom, left top, from(#d7d7d7), to(#e4e4e4));
 }
 
 #wphead h1 a {
-       color: #fff;
+       color: #464646;
 }
 
 #user_info {
-       color: #999;
+       color: #777;
 }
 
 #user_info a:link,
 #user_info a:visited,
 #footer a:link,
 #footer a:visited {
-       color: #ccc;
+       color: #222;
        text-decoration: none;
 }
 
 #user_info a:hover,
 #footer a:hover {
-       color: #fff;
+       color: #000;
        text-decoration: underline !important;
 }
 
@@ -1048,20 +1040,20 @@ table.widefat .spam a:hover,
 
 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -207px;
+       background: transparent url(../images/menu-bits.gif?ver=20100610) 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;
+       background: transparent url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px;
 }
 
 #adminmenu a.menu-top {
-       background: #f1f1f1 url(../images/menu-bits.gif) repeat-x scroll left -379px;
+       background: #f1f1f1 url(../images/menu-bits.gif?ver=20100610) repeat-x scroll left -379px;
 }
 
 #adminmenu .wp-submenu a {
-       background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
+       background: #fff url(../images/menu-bits.gif?ver=20100610) no-repeat scroll 0 -310px;
 }
 
 #adminmenu .wp-has-current-submenu ul li a {
@@ -1072,17 +1064,25 @@ table.widefat .spam a:hover,
        background: url(../images/menu-dark.gif) top left no-repeat !important;
 }
 
+.wp-has-current-submenu .wp-submenu {
+       border-top: none !important;
+}
+
+#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu {
+       border-bottom: #aaa 1px solid;
+}
+
 #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.current a.menu-top {
+       background: #e0e0e0 url(../images/menu-bits.gif?ver=20100610) top left repeat-x;
+       border: #aaa 1px solid;
+       color: #000;
 }
 
 #adminmenu li.wp-has-current-submenu .wp-submenu,
 #adminmenu li.wp-has-current-submenu ul li a {
-       border-color: #aaa !important;
+       border-right-color: #aaa !important;
+       border-left-color: #aaa !important;
 }
 
 #adminmenu li.wp-has-current-submenu ul li a {
@@ -1093,12 +1093,8 @@ table.widefat .spam a:hover,
        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;
+       background: transparent url(../images/menu-bits.gif?ver=20100610) no-repeat scroll  0 -289px;
 }
 
 #adminmenu .wp-submenu a:hover {
@@ -1113,7 +1109,6 @@ table.widefat .spam a:hover,
        background-color: #f5f5f5;
        background-image: none;
        border-color: #e3e3e3;
-       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
 }
 
 #adminmenu .wp-submenu ul {
@@ -1140,124 +1135,133 @@ table.widefat .spam a:hover,
 }
 
 /* menu icons */
-#adminmenu #menu-dashboard div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -61px -33px;
+#adminmenu .menu-icon-dashboard div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -61px -33px;
+}
+
+#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,
+#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,
+#adminmenu .menu-icon-dashboard.current div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -61px -1px;
+}
+
+#adminmenu .menu-icon-post div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -272px -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-icon-post:hover div.wp-menu-image,
+#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -272px -1px;
 }
 
-#adminmenu #menu-posts div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -272px -33px;
+#adminmenu .menu-icon-media div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -121px -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-icon-media:hover div.wp-menu-image,
+#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -121px -1px;
 }
 
-#adminmenu #menu-media div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -121px -33px;
+#adminmenu .menu-icon-links div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -91px -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-icon-links:hover div.wp-menu-image,
+#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -91px -1px;
 }
 
-#adminmenu #menu-links div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -91px -33px;
+#adminmenu .menu-icon-page div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -151px -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-icon-page:hover div.wp-menu-image,
+#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -151px -1px;
 }
 
-#adminmenu #menu-pages div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -151px -33px;
+#adminmenu .menu-icon-comments div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -31px -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-icon-comments:hover div.wp-menu-image,
+#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,
+#adminmenu .menu-icon-comments.current div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -31px -1px;
 }
 
-#adminmenu #menu-comments div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -31px -33px;
+#adminmenu .menu-icon-appearance div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -1px -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-icon-appearance:hover div.wp-menu-image,
+#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -1px -1px;
 }
 
-#adminmenu #menu-appearance div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -1px -33px;
+#adminmenu .menu-icon-plugins div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -181px -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-icon-plugins:hover div.wp-menu-image,
+#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -181px -1px;
 }
 
-#adminmenu #menu-plugins div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -181px -33px;
+#adminmenu .menu-icon-users div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -301px -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-icon-users:hover div.wp-menu-image,
+#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -301px -1px;
 }
 
-#adminmenu #menu-users div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -301px -33px;
+#adminmenu .menu-icon-tools div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -211px -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-icon-tools:hover div.wp-menu-image,
+#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -211px -1px;
 }
 
-#adminmenu #menu-tools div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -211px -33px;
+#adminmenu .menu-icon-settings div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -241px -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-icon-settings:hover div.wp-menu-image,
+#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -241px -1px;
 }
 
-#adminmenu #menu-settings div.wp-menu-image {
-       background: transparent url("../images/menu.png") no-repeat scroll -241px -33px;
+#adminmenu .menu-icon-site div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -361px -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;
+#adminmenu .menu-icon-site:hover div.wp-menu-image,
+#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -361px -1px;
 }
 /* end menu */
 
 
 /* Diff */
 table.diff .diff-deletedline {
-       background-color: #ffdddd;
+       background-color: #fdd;
 }
 
 table.diff .diff-deletedline del {
-       background-color: #ff9999;
+       background-color: #f99;
 }
 
 table.diff .diff-addedline {
-       background-color: #ddffdd;
+       background-color: #dfd;
 }
 
 table.diff .diff-addedline ins {
-       background-color: #99ff99;
+       background-color: #9f9;
 }
 
 #att-info {
@@ -1357,7 +1361,7 @@ div.star.select:hover {
 }
 
 .inline-editor ul.cat-checklist {
-       background-color: #FFFFFF;
+       background-color: #fff;
        border-color: #ddd;
 }
 
@@ -1384,7 +1388,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 .meta-box-sortables .postbox:hover .handlediv {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
+       background: transparent url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -111px;
 }
 
 #major-publishing-actions {
@@ -1397,7 +1401,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 
 .tablenav .tablenav-pages a {
        border-color: #e3e3e3;
-       background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
+       background: #eee url('../images/menu-bits.gif?ver=20100610') repeat-x scroll left -379px;
 }
 
 .tablenav .tablenav-pages a:hover {
@@ -1458,7 +1462,8 @@ fieldset.inline-edit-col-right .inline-edit-col {
        background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a,
+#post-body ul.add-menu-item-tabs li.tabs a {
        color: #333;
 }
 
@@ -1479,36 +1484,33 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #favorite-first {
-       background: #797979 url(../images/fav.png) repeat-x left center;
-       border-color: #777 !important;
-       border-bottom-color: #666 !important;
+       border-color: #c0c0c0;
+       background: #f1f1f1; /* fallback color */
+       background:-moz-linear-gradient(bottom,  #e7e7e7,  #fff);
+       background:-webkit-gradient(linear, left bottom, left top, from(#e7e7e7), to(#fff));
 }
 
 #favorite-inside {
-       border-color: #797979;
-       background-color: #797979;
+       border-color: #c0c0c0;
+       background-color: #fff;
 }
 
 #favorite-toggle {
-       background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
+       background: transparent url(../images/fav-arrow.gif?ver=20100531) no-repeat 0 -4px;
 }
 
 #favorite-actions a {
-       color: #ddd;
+       color: #464646;
 }
 
 #favorite-actions a:hover {
-       color: #fff;
+       color: #000;
 }
 
 #favorite-inside a:hover {
        text-decoration: underline;
 }
 
-#favorite-actions .slide-down {
-       border-bottom-color: #626262;
-}
-
 #screen-meta a.show-settings {
        background-color: transparent;
        text-shadow: rgba(255,255,255,0.7) 0 1px 0;
@@ -1516,53 +1518,57 @@ fieldset.inline-edit-col-right .inline-edit-col {
 
 #icon-edit,
 #icon-post {
-       background: transparent url(../images/icons32.png) no-repeat -552px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -552px -5px;
 }
 
 #icon-index {
-       background: transparent url(../images/icons32.png) no-repeat -137px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -137px -5px;
 }
 
 #icon-upload {
-       background: transparent url(../images/icons32.png) no-repeat -251px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -251px -5px;
 }
 
 #icon-link-manager,
 #icon-link,
 #icon-link-category {
-       background: transparent url(../images/icons32.png) no-repeat -190px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -190px -5px;
 }
 
 #icon-edit-pages,
 #icon-page {
-       background: transparent url(../images/icons32.png) no-repeat -312px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -312px -5px;
 }
 
 #icon-edit-comments {
-       background: transparent url(../images/icons32.png) no-repeat -72px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -72px -5px;
 }
 
 #icon-themes {
-       background: transparent url(../images/icons32.png) no-repeat -11px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -11px -5px;
 }
 
 #icon-plugins {
-       background: transparent url(../images/icons32.png) no-repeat -370px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -370px -5px;
 }
 
 #icon-users,
 #icon-profile,
 #icon-user-edit {
-       background: transparent url(../images/icons32.png) no-repeat -600px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -600px -5px;
 }
 
 #icon-tools,
 #icon-admin {
-       background: transparent url(../images/icons32.png) no-repeat -432px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -432px -5px;
 }
 
 #icon-options-general {
-       background: transparent url(../images/icons32.png) no-repeat -492px -5px;
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -492px -5px;
+}
+
+#icon-ms-admin {
+       background: transparent url(../images/icons32.png?ver=20100531) no-repeat -659px -5px;
 }
 
 .view-switch #view-switch-list {
@@ -1582,28 +1588,12 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #header-logo {
-       background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
-}
-
-#wphead #site-visit-button {
-       background-color:#585858;
-       background-image: url(../images/visit-site-button-grad.gif);
-       color:#aaa;
-       text-shadow: #3F3F3F 0 -1px 0;
-}
-
-#wphead a:hover #site-visit-button {
-       color:#fff;
-}
-
-#wphead a:focus #site-visit-button,
-#wphead a:active #site-visit-button {
-       background-position:0 -27px;
+       background: transparent url(../images/wp-logo.png?ver=20100531) no-repeat scroll center center;
 }
 
 .popular-tags,
 .feature-filter {
-       background-color: #FFFFFF;
+       background-color: #fff;
        border-color: #DFDFDF;
 }
 
@@ -1618,18 +1608,18 @@ fieldset.inline-edit-col-right .inline-edit-col {
 div.widgets-sortables,
 #widgets-left .inactive {
        background-color: #f1f1f1;
-    border-color: #ddd;
+       border-color: #ddd;
 }
 
 #available-widgets .widget-holder {
-    background-color: #fff;
-    border-color: #ddd;
+       background-color: #fff;
+       border-color: #ddd;
 }
 
 #widgets-left .sidebar-name {
        background-color: #aaa;
        background-image: url(../images/ed-bg.gif);
-       text-shadow: #FFFFFF 0 1px 0;
+       text-shadow: #fff 0 1px 0;
        border-color: #dfdfdf;
 }
 
@@ -1651,11 +1641,11 @@ div.widgets-sortables,
 }
 
 #widgets-left .sidebar-name-arrow {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
+       background: transparent url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px;
 }
 
 #widgets-right .sidebar-name-arrow {
-       background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px;
+       background: transparent url(../images/widgets-arrow.gif?ver=20100531) no-repeat scroll 0 -1px;
 }
 
 .in-widget-title {
@@ -1695,3 +1685,12 @@ div.widgets-sortables,
 .comment-ays th {
        background-color: #f1f1f1;
 }
+
+#nav-menu-header, .menu-item-handle {
+       background: url("../images/gray-grad.png") repeat-x scroll left top #dfdfdf;
+}
+
+#menu-management .nav-tab-active {
+       background: #ececec;
+       border-bottom-color: #ececec;
+}
\ No newline at end of file
index 60a97bafeadc45421e91baf6b138906cbb2824ba..8b6f73a31abe4c23edc2f13d5c8c54ad3a3211da 100644 (file)
@@ -1,93 +1 @@
-#dashboard-widgets-wrap .has-sidebar {
-       margin-right: 0;
-       margin-left: -51%;
-}
-#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
-       margin-right: 0;
-       margin-left: 51%;
-}
-.view-all {
-       right: auto;
-       left: 0;
-}
-#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;
-       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;
-       clear: left;
-}
-#dashboard-widgets h3 .postbox-title-action {
-       right: auto;
-       left: 30px;
-}
-#the-comment-list .pingback {
-       padding-left: 0 !important;
-       padding-right: 9px !important;
-}
-/* Recent Comments */
-#the-comment-list .comment-item {
-       padding: 1em 70px 1em 10px;
-}
-#the-comment-list .comment-item .avatar {
-       float: right;
-       margin-left: 0;
-       margin-right: -60px;
-}
-/* Feeds */
-.rss-widget cite {
-       text-align: left;
-}
-.rss-widget span.rss-date {
-       font-family: Tahoma, Arial;
-       margin-left: 0;
-       margin-right: 3px;
-}
-/* QuickPress */
-#dashboard_quick_press h4 {
-       float: right;
-       text-align: left;
-}
-#dashboard_quick_press h4 label {
-       margin-right: 0;
-       margin-left: 10px;
-}
-#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .textarea-wrap {
-       margin: 0 5em 1em 0;
-}
-#dashboard_quick_press #media-buttons {
-       margin: 0 5em .5em 0;
-       padding: 0 10px 0 0;
-}
-#dashboard-widgets #dashboard_quick_press form p.submit {
-       margin-left: 0;
-       margin-right: 4.6em;
-}
-#dashboard-widgets #dashboard_quick_press form p.submit input {
-       float: right;
-}
-#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;
-}
+#dashboard-widgets-wrap .has-sidebar{margin-right:0;margin-left:-51%;}#dashboard-widgets-wrap .has-sidebar .has-sidebar-content{margin-right:0;margin-left:51%;}.view-all{right:auto;left:0;}#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 p.sub{font-style:normal;left:auto;right:15px;}#dashboard_right_now td.b{padding-right:0;padding-left:6px;text-align:left;font-family:Tahoma,Arial;}#dashboard_right_now .t{padding-right:0;padding-left:12px;}#dashboard_right_now .table_content{float:right;}#dashboard_right_now .table_discussion{float:left;}#dashboard_right_now .versions{clear:right;}#dashboard_right_now .versions a{font-family:Tahoma,Arial;}#dashboard_right_now a.button{float:left;clear:left;}#dashboard-widgets h3 .postbox-title-action{right:auto;left:30px;}#the-comment-list .pingback{padding-left:0!important;padding-right:9px!important;}#the-comment-list .comment-item{padding:1em 70px 1em 10px;}#the-comment-list .comment-item .avatar{float:right;margin-left:0;margin-right:-60px;}.rss-widget cite{text-align:left;}.rss-widget span.rss-date{font-family:Tahoma,Arial;margin-left:0;margin-right:3px;}#dashboard_quick_press h4{float:right;text-align:left;}#dashboard_quick_press h4 label{margin-right:0;margin-left:10px;}#dashboard_quick_press .input-text-wrap,#dashboard_quick_press .textarea-wrap{margin:0 5em 1em 0;}#dashboard_quick_press #media-buttons{margin:0 5em .5em 0;padding:0 10px 0 0;}#dashboard-widgets #dashboard_quick_press form p.submit{margin-left:0;margin-right:4.6em;}#dashboard-widgets #dashboard_quick_press form p.submit input{float:right;}#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;}#dashboard-widgets #dashboard_quick_press form p.submit img.waiting{margin:4px 0 0 6px;}#dashboard_recent_drafts h4 abbr{font-family:Tahoma,Arial;margin-left:0;margin-right:3px;}
\ No newline at end of file
diff --git a/wp-admin/css/dashboard-rtl.dev.css b/wp-admin/css/dashboard-rtl.dev.css
new file mode 100644 (file)
index 0000000..78f2e87
--- /dev/null
@@ -0,0 +1,110 @@
+#dashboard-widgets-wrap .has-sidebar {
+       margin-right: 0;
+       margin-left: -51%;
+}
+#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
+       margin-right: 0;
+       margin-left: 51%;
+}
+.view-all {
+       right: auto;
+       left: 0;
+}
+#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 p.sub  {
+       font-style:normal;
+       left:auto;
+       right:15px;
+}
+#dashboard_right_now td.b {
+       padding-right: 0;
+       padding-left: 6px;
+       text-align: left;
+       font-family: Tahoma, Arial;
+}
+#dashboard_right_now .t {
+       padding-right: 0;
+       padding-left: 12px;
+}
+#dashboard_right_now .table_content {
+       float:right;
+}
+#dashboard_right_now .table_discussion {
+       float:left;
+}
+#dashboard_right_now .versions {
+       clear:right;
+}
+#dashboard_right_now .versions a {
+       font-family: Tahoma, Arial;
+}
+#dashboard_right_now a.button {
+       float: left;
+       clear: left;
+}
+#dashboard-widgets h3 .postbox-title-action {
+       right: auto;
+       left: 30px;
+}
+#the-comment-list .pingback {
+       padding-left: 0 !important;
+       padding-right: 9px !important;
+}
+/* Recent Comments */
+#the-comment-list .comment-item {
+       padding: 1em 70px 1em 10px;
+}
+#the-comment-list .comment-item .avatar {
+       float: right;
+       margin-left: 0;
+       margin-right: -60px;
+}
+/* Feeds */
+.rss-widget cite {
+       text-align: left;
+}
+.rss-widget span.rss-date {
+       font-family: Tahoma, Arial;
+       margin-left: 0;
+       margin-right: 3px;
+}
+/* QuickPress */
+#dashboard_quick_press h4 {
+       float: right;
+       text-align: left;
+}
+#dashboard_quick_press h4 label {
+       margin-right: 0;
+       margin-left: 10px;
+}
+#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .textarea-wrap {
+       margin: 0 5em 1em 0;
+}
+#dashboard_quick_press #media-buttons {
+       margin: 0 5em .5em 0;
+       padding: 0 10px 0 0;
+}
+#dashboard-widgets #dashboard_quick_press form p.submit {
+       margin-left: 0;
+       margin-right: 4.6em;
+}
+#dashboard-widgets #dashboard_quick_press form p.submit input {
+       float: right;
+}
+#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;
+}
+#dashboard-widgets #dashboard_quick_press form p.submit img.waiting {
+       margin: 4px 0 0 6px;
+}
+/* Recent Drafts */
+#dashboard_recent_drafts h4 abbr {
+       font-family: Tahoma, Arial;
+       margin-left:0;
+       margin-right: 3px;
+}
\ No newline at end of file
index 51a8ea9d2ec69695aeec7385eff6ed7cfa8fbcee..e87fec528363f15e7b9cd835c0e48ebda90fa505 100644 (file)
@@ -1 +1 @@
-.postbox p,.postbox ul,.postbox ol,.postbox blockquote,#wp-version-message{font-size:11px;}.edit-box{display:none;}h3:hover .edit-box{display:inline;}form .input-text-wrap{border-style:solid;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-width:1px;padding:2px;border-color:#ccc;}#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;}#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish{min-width:0;}div.postbox div.inside{margin:10px;position:relative;}#dashboard-widgets a{text-decoration:none;}#dashboard-widgets h3 a{text-decoration:underline;}#dashboard-widgets h3 .postbox-title-action{position:absolute;right:30px;padding:0;}#dashboard-widgets h4{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:13px;margin:0 0 .2em;padding:0;}#dashboard_right_now p.sub,#dashboard_right_now .table,#dashboard_right_now .versions{margin:-12px;}#dashboard_right_now .inside{font-size:12px;}#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;}#dashboard_right_now .table{background:#f9f9f9;border-top:#ececec 1px solid;border-bottom:#ececec 1px solid;margin:0 -9px 10px;padding:0 10px;}#dashboard_right_now table{width:100%;}#dashboard_right_now table td{border-top:#ececec 1px solid;padding:3px 0;white-space:nowrap;}#dashboard_right_now table tr.first td{border-top:none;}#dashboard_right_now td.b{padding-right:6px;text-align:right;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:14px;}#dashboard_right_now td.b a{font-size:18px;}#dashboard_right_now td.b a:hover{color:#d54e21;}#dashboard_right_now .t{font-size:12px;padding-right:12px;padding-top:6px;color:#777;}#dashboard_right_now .t a{white-space:nowrap;}#dashboard_right_now td.first,#dashboard_right_now td.last{width:1%;}#dashboard_right_now .spam{color:red;}#dashboard_right_now .waiting{color:#e66f00;}#dashboard_right_now .approved{color:green;}#dashboard_right_now .versions{padding:6px 10px 12px;}#dashboard_right_now .versions .b{font-weight:bold;}#dashboard_right_now a.button{float:right;clear:right;position:relative;top:-5px;}#dashboard_recent_comments h3{margin-bottom:0;}#dashboard_recent_comments .inside{margin-top:0;}#dashboard_recent_comments .comment-meta .approve{font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;font-size:10px;}#the-comment-list{position:relative;}#the-comment-list .comment-item{padding:1em 10px;border-top:1px solid;}#the-comment-list .pingback{padding-left:9px!important;}#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;margin:0 10px 5px 0;}#the-comment-list .comment-item h4{line-height:1.4;margin-top:-.2em;font-weight:normal;color:#999;}#the-comment-list .comment-item h4 cite{font-style:normal;font-weight:normal;}#the-comment-list .comment-item blockquote,#the-comment-list .comment-item blockquote p{margin:0;padding:0;display:inline;}#dashboard_recent_comments #the-comment-list .trackback blockquote,#dashboard_recent_comments #the-comment-list .pingback blockquote{display:block;}#the-comment-list .comment-item p.row-actions{margin:3px 0 0;padding:0;font-size:10px;}#dashboard_quick_press h4{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;float:left;width:5.5em;clear:both;font-weight:normal;text-align:right;padding-top:5px;font-size:12px;}#dashboard_quick_press h4 label{margin-right:10px;}#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;}#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;}#dashboard_recent_drafts ul{margin:0;padding:0;list-style:none;}#dashboard_recent_drafts ul li{margin-bottom:.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;padding:0;}.rss-widget ul{margin:0;padding:0;list-style:none;}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;margin-bottom:12px;}.rss-widget span.rss-date{margin-left:3px;}.rss-widget cite{display:block;text-align:right;margin:0 0 1em;padding:0;}.rss-widget cite:before{content:'\2014';}#dashboard_plugins h4{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}#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;}#dashboard_plugins h5 a{font-weight:normal;line-height:1.7em;}#dashboard_plugins p{margin:0 0 1.4em;line-height:1.4em;}.dashboard-comment-wrap{overflow:hidden;word-wrap:break-word;}
\ No newline at end of file
+.postbox p,.postbox ul,.postbox ol,.postbox blockquote,#wp-version-message{font-size:11px;}.edit-box{display:none;}h3:hover .edit-box{display:inline;}form .input-text-wrap{border-style:solid;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-width:1px;padding:2px;border-color:#ccc;}#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;}#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish{min-width:0;}div.postbox div.inside{margin:10px;position:relative;}#dashboard-widgets a{text-decoration:none;}#dashboard-widgets h3 a{text-decoration:underline;}#dashboard-widgets h3 .postbox-title-action{position:absolute;right:30px;padding:0;}#dashboard-widgets h4{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:13px;margin:0 0 .2em;padding:0;}#dashboard_right_now p.sub,#dashboard_right_now .table,#dashboard_right_now .versions{margin:-12px;}#dashboard_right_now .inside{font-size:12px;padding-top:20px;}#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;position:absolute;top:-17px;left:15px;}#dashboard_right_now .table{margin:0 -9px;padding:0 10px;position:relative;}#dashboard_right_now .table_content{float:left;border-top:#ececec 1px solid;width:45%;}#dashboard_right_now .table_discussion{float:right;border-top:#ececec 1px solid;width:45%;}#dashboard_right_now table td{padding:3px 0;white-space:nowrap;}#dashboard_right_now table tr.first td{border-top:none;}#dashboard_right_now td.b{padding-right:6px;text-align:right;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:14px;width:1%;}#dashboard_right_now td.b a{font-size:18px;}#dashboard_right_now td.b a:hover{color:#d54e21;}#dashboard_right_now .t{font-size:12px;padding-right:12px;padding-top:6px;color:#777;}#dashboard_right_now .t a{white-space:nowrap;}#dashboard_right_now .spam{color:red;}#dashboard_right_now .waiting{color:#e66f00;}#dashboard_right_now .approved{color:green;}#dashboard_right_now .versions{padding:6px 10px 12px;clear:left;}#dashboard_right_now .versions .b{font-weight:bold;}#dashboard_right_now a.button{float:right;clear:right;position:relative;top:-5px;}#dashboard_recent_comments h3{margin-bottom:0;}#dashboard_recent_comments .inside{margin-top:0;}#dashboard_recent_comments .comment-meta .approve{font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;font-size:10px;}#the-comment-list{position:relative;}#the-comment-list .comment-item{padding:1em 10px;border-top:1px solid;}#the-comment-list .pingback{padding-left:9px!important;}#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;margin:0 10px 5px 0;}#the-comment-list .comment-item h4{line-height:1.4;margin-top:-.2em;font-weight:normal;color:#999;}#the-comment-list .comment-item h4 cite{font-style:normal;font-weight:normal;}#the-comment-list .comment-item blockquote,#the-comment-list .comment-item blockquote p{margin:0;padding:0;display:inline;}#dashboard_recent_comments #the-comment-list .trackback blockquote,#dashboard_recent_comments #the-comment-list .pingback blockquote{display:block;}#the-comment-list .comment-item p.row-actions{margin:3px 0 0;padding:0;font-size:10px;}#dashboard_quick_press h4{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;float:left;width:5.5em;clear:both;font-weight:normal;text-align:right;padding-top:5px;font-size:12px;}#dashboard_quick_press h4 label{margin-right:10px;}#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;}#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;}#dashboard-widgets #dashboard_quick_press form p.submit img.waiting{vertical-align:middle;visibility:hidden;margin:4px 6px 0 0;}#dashboard_recent_drafts ul{margin:0;padding:0;list-style:none;}#dashboard_recent_drafts ul li{margin-bottom:.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;padding:0;}.rss-widget ul{margin:0;padding:0;list-style:none;}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;margin-bottom:12px;}.rss-widget span.rss-date{margin-left:3px;}.rss-widget cite{display:block;text-align:right;margin:0 0 1em;padding:0;}.rss-widget cite:before{content:'\2014';}#dashboard_plugins h4{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}#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;}#dashboard_plugins h5 a{font-weight:normal;line-height:1.7em;}#dashboard_plugins p{margin:0 0 1.4em;line-height:1.4em;}.dashboard-comment-wrap{overflow:hidden;word-wrap:break-word;}
\ No newline at end of file
index fe477b1c30e3b8fe8a3e7b3f95e7fc73857e7bc6..d8ae32e27a29e85f4f35622cf449645b2dc2b2c0 100644 (file)
@@ -91,6 +91,7 @@ div.postbox div.inside {
 
 #dashboard_right_now .inside {
        font-size: 12px;
+       padding-top: 20px;
 }
 
 #dashboard_right_now p.sub {
@@ -99,22 +100,30 @@ div.postbox div.inside {
        padding: 5px 10px 15px;
        color: #777;
        font-size: 13px;
+       position: absolute;
+       top: -17px;
+       left: 15px;
 }
 
 #dashboard_right_now .table {
-       background: #f9f9f9;
-       border-top: #ececec 1px solid;
-       border-bottom: #ececec 1px solid;
-       margin: 0 -9px 10px;
+       margin: 0 -9px;
        padding: 0 10px;
+       position: relative;
 }
 
-#dashboard_right_now table {
-       width: 100%;
+#dashboard_right_now .table_content {
+       float: left;
+       border-top: #ececec 1px solid;
+       width: 45%;
 }
 
-#dashboard_right_now table  td {
+#dashboard_right_now .table_discussion {
+       float: right;
        border-top: #ececec 1px solid;
+       width: 45%;
+}
+
+#dashboard_right_now table td {
        padding: 3px 0;
        white-space: nowrap;
 }
@@ -128,6 +137,7 @@ div.postbox div.inside {
        text-align: right;
        font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
        font-size: 14px;
+       width: 1%;
 }
 
 #dashboard_right_now td.b a {
@@ -149,11 +159,6 @@ div.postbox div.inside {
        white-space: nowrap;
 }
 
-#dashboard_right_now td.first,
-#dashboard_right_now td.last {
-       width: 1%;
-}
-
 #dashboard_right_now .spam {
        color: red;
 }
@@ -168,6 +173,7 @@ div.postbox div.inside {
 
 #dashboard_right_now .versions {
        padding: 6px 10px 12px;
+       clear: left;
 }
 
 #dashboard_right_now .versions .b {
@@ -302,6 +308,12 @@ div.postbox div.inside {
        float: right;
 }
 
+#dashboard-widgets #dashboard_quick_press form p.submit img.waiting {
+       vertical-align: middle;
+       visibility: hidden;
+       margin: 4px 6px 0 0;
+}
+
 /* Recent Drafts */
 #dashboard_recent_drafts ul {
        margin: 0;
@@ -391,4 +403,3 @@ a.rsswidget {
        overflow: hidden;
        word-wrap: break-word;
 }
-
index f5f7632e50f15c06baf9b38bc7859cb1b3dd68db..d7a34800eacdb7cba0b06186809c1b452966c340 100644 (file)
@@ -1,82 +1 @@
-/* 2 column liquid layout */
-#adminmenu {
-       float: right;
-       clear: right;
-       margin-right:-160px;
-       margin-left: 5px;
-}
-body.folded #adminmenu {
-       margin-left: 0;
-       margin-right: -45px;
-}
-/* inner 2 column liquid layout */
-.inner-sidebar {
-       float: left;
-       clear: left;
-}
-
-.has-right-sidebar #post-body {
-       clear:right;
-       float:right;
-       margin-right:0;
-       margin-left:-340px;
-}
-
-.has-right-sidebar #post-body-content {
-       margin-left: 300px;
-       margin-right:0;
-}
-
-#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 {
-       text-align: right;
-}
-.widefat th input {
-       margin: 0 8px 0 0;
-}
-.wrap h2 {
-       font-family: arial;
-       padding: 14px 0 3px 15px;
-}
-.wrap h2.long-header {
-       padding-left: 0;
-}
-.updated, .error {
-       clear: both;
-}
-
-.screen-reader-text, .screen-reader-text span {
-       left:auto;
-       text-indent:-1000em;
-}
\ No newline at end of file
+#adminmenu{float:right;clear:right;margin-right:-160px;margin-left:5px;}body.folded #adminmenu{margin-left:0;margin-right:-45px;}.inner-sidebar{float:left;clear:left;}.has-right-sidebar #post-body{clear:right;float:right;margin-right:0;margin-left:-340px;}.has-right-sidebar #post-body-content{margin-left:300px;margin-right:0;}#wpbody{margin-left:0;margin-right:175px;}.folded #wpbody{margin-left:0;margin-right:60px;}#wpbody-content{float:right;}#col-right{float:left;clear:left;}.wrap{margin:0 5px 0 15px;}body,td,textarea,input,select{font-family:Tahoma,arial;}.alignleft{float:right;}.alignright{float:left;}.subsubsub{float:right;}.widefat th{text-align:right;}.widefat th input{margin:0 8px 0 0;}.wrap h2{font-family:arial;padding:14px 0 3px 15px;font-style:normal;}.wrap h2.long-header{padding-left:0;}.updated,.error{clear:both;}.screen-reader-text,.screen-reader-text span{left:auto;text-indent:-1000em;}
\ No newline at end of file
diff --git a/wp-admin/css/global-rtl.dev.css b/wp-admin/css/global-rtl.dev.css
new file mode 100644 (file)
index 0000000..85d21c3
--- /dev/null
@@ -0,0 +1,83 @@
+/* 2 column liquid layout */
+#adminmenu {
+       float: right;
+       clear: right;
+       margin-right:-160px;
+       margin-left: 5px;
+}
+body.folded #adminmenu {
+       margin-left: 0;
+       margin-right: -45px;
+}
+/* inner 2 column liquid layout */
+.inner-sidebar {
+       float: left;
+       clear: left;
+}
+
+.has-right-sidebar #post-body {
+       clear:right;
+       float:right;
+       margin-right:0;
+       margin-left:-340px;
+}
+
+.has-right-sidebar #post-body-content {
+       margin-left: 300px;
+       margin-right:0;
+}
+
+#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 {
+       text-align: right;
+}
+.widefat th input {
+       margin: 0 8px 0 0;
+}
+.wrap h2 {
+       font-family: arial;
+       padding: 14px 0 3px 15px;
+       font-style: normal;
+}
+.wrap h2.long-header {
+       padding-left: 0;
+}
+.updated, .error {
+       clear: both;
+}
+
+.screen-reader-text, .screen-reader-text span {
+       left:auto;
+       text-indent:-1000em;
+}
\ No newline at end of file
index 30fd194e2f89f7eecb88cd912cff68cd6fe0a7fb..3729410f8c5364d66379be277f4d837bbb990050 100644 (file)
@@ -1 +1 @@
-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;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;}ins{text-decoration:none;}del{text-decoration:line-through;}#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-sidebar{float:right;clear:right;display:none;width:281px;position:relative;}.inner-sidebar #side-sortables{width:280px;min-height:300px;}.has-right-sidebar .inner-sidebar{display:block;}.has-right-sidebar #post-body{float:left;clear:left;width:100%;margin-right:-340px;}.has-right-sidebar #post-body-content{margin-right:300px;}#col-container{overflow:hidden;padding:0;margin:0;}#col-left{padding:0;margin:0;overflow:hidden;width:39%;}#col-right{float:right;clear:right;overflow:hidden;padding:0;margin:0;width:59%;}.alignleft{float:left;}.alignright{float:right;}.textleft{text-align:left;}.textright{text-align:right;}.clear{clear:both;}.screen-reader-text,.screen-reader-text span{position:absolute;left:-1000em;height:1px;width:1px;overflow:hidden;}.hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js{display:none;}input[type="text"],input[type="password"],textarea{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}input[type="checkbox"],input[type="radio"]{vertical-align:middle;}html,body{height:100%;}body,td,textarea,input,select{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;font-size:13px;}body,textarea{line-height:1.4em;}input,select{line-height:1em;}p{margin:1em 0;}blockquote{margin:1em;}label{cursor:pointer;}li,dd{margin-bottom:6px;}p,li,dl,dd,dt{line-height:140%;}textarea,input,select{margin:1px;padding:3px;}h1{display:block;font-size:2em;font-weight:bold;margin:.67em 0;}h2{display:block;font-size:1.5em;font-weight:bold;margin:.83em 0;}h3{display:block;font-size:1.17em;font-weight:bold;margin:1em 0;}h4{display:block;font-size:1em;font-weight:bold;margin:1.33em 0;}h5{display:block;font-size:.83em;font-weight:bold;margin:1.67em 0;}h6{display:block;font-size:.67em;font-weight:bold;margin:2.33em 0;}ul.ul-disc{list-style:disc outside;}ul.ul-square{list-style:square outside;}ol.ol-decimal{list-style:decimal outside;}ul.ul-disc,ul.ul-square,ol.ol-decimal{margin-left:1.8em;}ul.ul-disc>li,ul.ul-square>li,ol.ol-decimal>li{margin:0 0 .5em;}.subsubsub{list-style:none;margin:8px 0 5px;padding:0;white-space:nowrap;font-size:11px;float:left;}.subsubsub a{line-height:2;padding:.2em;text-decoration:none;}.subsubsub a .count,.subsubsub a.current .count{color:#999;font-weight:normal;}.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;border-spacing:0;width:100%;clear:both;margin:0;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.widefat *{word-wrap:break-word;}.widefat a{text-decoration:none;}.widefat td,.widefat th{border-bottom-width:1px;border-bottom-style:solid;font-size:11px;}.widefat td{padding:3px 7px;vertical-align:top;}.widefat td p,.widefat td ol,.widefat td ul{font-size:11px;}.widefat th{padding:7px 7px 8px;text-align:left;line-height:1.3em;}.widefat th input{margin:0 0 0 8px;padding:0;vertical-align:text-top;}.widefat .check-column{width:2.2em;padding:0;}.widefat tbody th.check-column{padding:7px 0 22px;vertical-align:top;}.widefat .num,.column-comments,.column-links,.column-posts{text-align:center;}.widefat th#comments{vertical-align:middle;}.wrap{margin:0 15px 0 5px;}.updated,.error{border-width:1px;border-style:solid;padding:0 .6em;margin:5px 15px 2px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.updated p,.error p{margin:.5em 0;line-height:1;padding:2px;}.wrap .updated,.wrap .error{margin:5px 0 15px;}.wrap h2{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) 0 1px 0;}.wrap h2.long-header{padding-right:0;}
\ No newline at end of file
+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;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;}ins{text-decoration:none;}del{text-decoration:line-through;}#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-sidebar{float:right;clear:right;display:none;width:281px;position:relative;}.inner-sidebar #side-sortables{width:280px;min-height:300px;}.has-right-sidebar .inner-sidebar{display:block;}.has-right-sidebar #post-body{float:left;clear:left;width:100%;margin-right:-340px;}.has-right-sidebar #post-body-content{margin-right:300px;}#col-container{overflow:hidden;padding:0;margin:0;}#col-left{padding:0;margin:0;overflow:hidden;width:39%;}#col-right{float:right;clear:right;overflow:hidden;padding:0;margin:0;width:59%;}.alignleft{float:left;}.alignright{float:right;}.textleft{text-align:left;}.textright{text-align:right;}.clear{clear:both;}.screen-reader-text,.screen-reader-text span{position:absolute;left:-1000em;height:1px;width:1px;overflow:hidden;}.hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js{display:none;}input[type="text"],input[type="password"],textarea{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}input[type="checkbox"],input[type="radio"]{vertical-align:middle;}html,body{height:100%;}body,td,textarea,input,select{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;font-size:13px;}body,textarea{line-height:1.4em;}input,select{line-height:15px;}p{margin:1em 0;}blockquote{margin:1em;}label{cursor:pointer;}li,dd{margin-bottom:6px;}p,li,dl,dd,dt{line-height:140%;}textarea,input,select{margin:1px;padding:3px;}h1{display:block;font-size:2em;font-weight:bold;margin:.67em 0;}h2{display:block;font-size:1.5em;font-weight:bold;margin:.83em 0;}h3{display:block;font-size:1.17em;font-weight:bold;margin:1em 0;}h4{display:block;font-size:1em;font-weight:bold;margin:1.33em 0;}h5{display:block;font-size:.83em;font-weight:bold;margin:1.67em 0;}h6{display:block;font-size:.67em;font-weight:bold;margin:2.33em 0;}ul.ul-disc{list-style:disc outside;}ul.ul-square{list-style:square outside;}ol.ol-decimal{list-style:decimal outside;}ul.ul-disc,ul.ul-square,ol.ol-decimal{margin-left:1.8em;}ul.ul-disc>li,ul.ul-square>li,ol.ol-decimal>li{margin:0 0 .5em;}.subsubsub{list-style:none;margin:8px 0 5px;padding:0;white-space:nowrap;font-size:11px;float:left;}.subsubsub a{line-height:2;padding:.2em;text-decoration:none;}.subsubsub a .count,.subsubsub a.current .count{color:#999;font-weight:normal;}.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;border-spacing:0;width:100%;clear:both;margin:0;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.widefat *{word-wrap:break-word;}.widefat a{text-decoration:none;}.widefat td,.widefat th{border-bottom-width:1px;border-bottom-style:solid;font-size:11px;}.widefat td{padding:3px 7px;vertical-align:top;}.widefat td p,.widefat td ol,.widefat td ul{font-size:11px;}.widefat th{padding:7px 7px 8px;text-align:left;line-height:1.3em;}.widefat th input{margin:0 0 0 8px;padding:0;vertical-align:text-top;}.widefat .check-column{width:2.2em;padding:0;}.widefat tbody th.check-column{padding:7px 0 22px;vertical-align:top;}.widefat .num,.column-comments,.column-links,.column-posts{text-align:center;}.widefat th#comments{vertical-align:middle;}.wrap{margin:0 15px 0 5px;}.updated,.error{border-width:1px;border-style:solid;padding:0 .6em;margin:5px 15px 2px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.updated p,.error p{margin:.5em 0;line-height:1;padding:2px;}.wrap .updated,.wrap .error{margin:5px 0 15px;}.wrap h2{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) 0 1px 0;}.wrap h2.long-header{padding-right:0;}
\ No newline at end of file
index d480244105dd56aeee5520cc992443e0f2b22a46..35f69c51bdf062423bfc90092d07cbe8cee3dbc4 100644 (file)
@@ -239,7 +239,7 @@ textarea {
 
 input,
 select {
-       line-height: 1em;
+       line-height: 15px;
 }
 
 p {
@@ -478,7 +478,7 @@ ol.ol-decimal > li {
        margin: 0;
        padding: 14px 15px 3px 0;
        line-height: 35px;
-       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
 }
 
 .wrap h2.long-header {
index 067f59a071935b38d5f827bc66baa33c86e61094..40f5b76b0d3fe05757383f13aa7868b744bd662e 100644 (file)
@@ -1,95 +1 @@
-* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
-       background: url(../images/menu-bits-rtl.gif) no-repeat scroll right -109px;
-}
-
-* 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-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 {
-       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 {
-       padding-right: 0;
-       padding-left: 1px;
-}
-.tagchecklist span a {
-       margin: 4px -9px 0 0;
-}
-.widefat th input {
-       margin: 0 5px 0 0;
-}
-/* ---------- add by navid */
-#TB_window {
-       width: 670px;
-       position: absolute;
-       top: 50%;
-       left: 50%;
-       margin-right: 335px !important;
-}
-#dashboard_plugins {
-       direction: ltr;
-}
-#dashboard_plugins h3.hndle {
-       direction: rtl;
-}
-#dashboard_incoming_links ul li,
-#dashboard_secondary ul li,
-#dashboard_primary ul li,
-p.row-actions {
-       width: 100%;
-}
-#favorite-inside {
-       position: absolute;
-       right:0;
-}
-#post-status-info {
-       height: 25px;
-}
-#screen-meta {
-       position: static;
-}
-p.submit { /* quick edit and reply in edit-comments.php */
-       height:22px;
-}
-.inner-sidebar { /* fix edit single comment */
-       position: static;
-}
-form#widgets-filter { /* fix widget page */
-       position: static;
-}
-
-* html .meta-box-sortables .postbox .handlediv {
-       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;
-}
+html{direction:ltr;}body{direction:rtl;}* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle{background:url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -109px;}* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle{background:url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -206px;}* html #adminmenu{margin-left:0;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{margin:7px 10px 0 0;float:left;}#user_info+div#favorite-actions{right:auto;left:15px;}#wphead-info{float:left;}div#dashboard-widgets{padding-right:0;padding-left:1px;}.tagchecklist span a{margin:4px -9px 0 0;}.widefat th input{margin:0 5px 0 0;}#TB_window{width:670px;position:absolute;top:50%;left:50%;margin-right:335px!important;}#dashboard_plugins{direction:ltr;}#dashboard_plugins h3.hndle{direction:rtl;}#dashboard_incoming_links ul li,#dashboard_secondary ul li,#dashboard_primary ul li,p.row-actions{width:100%;}#favorite-inside{position:absolute;right:0;}#post-status-info{height:25px;}#screen-meta{position:static;}p.submit{height:22px;}.inner-sidebar{position:static;}form#widgets-filter{position:static;}* html .meta-box-sortables .postbox .handlediv{background:transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;}.menu-max-depth-0 #menu-management{width:460px;}.menu-max-depth-1 #menu-management{width:490px;}.menu-max-depth-2 #menu-management{width:520px;}.menu-max-depth-3 #menu-management{width:550px;}.menu-max-depth-4 #menu-management{width:580px;}.menu-max-depth-5 #menu-management{width:610px;}.menu-max-depth-6 #menu-management{width:640px;}.menu-max-depth-7 #menu-management{width:670px;}.menu-max-depth-8 #menu-management{width:700px;}.menu-max-depth-9 #menu-management{width:730px;}.menu-max-depth-10 #menu-management{width:760px;}.menu-max-depth-11 #menu-management{width:790px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:-30px;}.menu-item-depth-2{margin-left:-60px;}.menu-item-depth-3{margin-left:-90px;}.menu-item-depth-4{margin-left:-120px;}.menu-item-depth-5{margin-left:-150px;}.menu-item-depth-6{margin-left:-180px;}.menu-item-depth-7{margin-left:-210px;}.menu-item-depth-8{margin-left:-240px;}.menu-item-depth-9{margin-left:-270px;}.menu-item-depth-10{margin-left:-300px;}.menu-item-depth-11{margin-left:-330px;}#menu-to-edit li dl{padding:0!important;margin:0!important;}.ui-sortable-helper .menu-item-transport{margin-top:13px;}.ui-sortable-helper .menu-item-transport .menu-item-transport{margin-top:0;}.sortable-placeholder{margin-top:0!important;margin-left:0!important;margin-bottom:13px!important;padding:0!important;}.auto-add-pages{clear:both;float:none;}#nav-menus-frame .open-label span{float:none;display:inline-block;}#nav-menus-frame .delete-action{float:none;}
\ No newline at end of file
diff --git a/wp-admin/css/ie-rtl.dev.css b/wp-admin/css/ie-rtl.dev.css
new file mode 100644 (file)
index 0000000..c35fc89
--- /dev/null
@@ -0,0 +1,156 @@
+html {
+       direction: ltr;
+}
+body {
+       direction: rtl;
+}
+* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -109px;
+}
+
+* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -206px;
+}
+* html #adminmenu {
+       margin-left:0;
+       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 {
+       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 {
+       padding-right: 0;
+       padding-left: 1px;
+}
+.tagchecklist span a {
+       margin: 4px -9px 0 0;
+}
+.widefat th input {
+       margin: 0 5px 0 0;
+}
+/* ---------- add by navid */
+#TB_window {
+       width: 670px;
+       position: absolute;
+       top: 50%;
+       left: 50%;
+       margin-right: 335px !important;
+}
+#dashboard_plugins {
+       direction: ltr;
+}
+#dashboard_plugins h3.hndle {
+       direction: rtl;
+}
+#dashboard_incoming_links ul li,
+#dashboard_secondary ul li,
+#dashboard_primary ul li,
+p.row-actions {
+       width: 100%;
+}
+#favorite-inside {
+       position: absolute;
+       right:0;
+}
+#post-status-info {
+       height: 25px;
+}
+#screen-meta {
+       position: static;
+}
+p.submit { /* quick edit and reply in edit-comments.php */
+       height:22px;
+}
+.inner-sidebar { /* fix edit single comment */
+       position: static;
+}
+form#widgets-filter { /* fix widget page */
+       position: static;
+}
+
+* html .meta-box-sortables .postbox .handlediv {
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;
+}
+
+/* nav menus */
+.menu-max-depth-0 #menu-management { width: 460px; }
+.menu-max-depth-1 #menu-management { width: 490px; }
+.menu-max-depth-2 #menu-management { width: 520px; }
+.menu-max-depth-3 #menu-management { width: 550px; }
+.menu-max-depth-4 #menu-management { width: 580px; }
+.menu-max-depth-5 #menu-management { width: 610px; }
+.menu-max-depth-6 #menu-management { width: 640px; }
+.menu-max-depth-7 #menu-management { width: 670px; }
+.menu-max-depth-8 #menu-management { width: 700px; }
+.menu-max-depth-9 #menu-management { width: 730px; }
+.menu-max-depth-10 #menu-management { width: 760px; }
+.menu-max-depth-11 #menu-management { width: 790px; }
+
+.menu-item-depth-0 { margin-left: 0px; }
+.menu-item-depth-1 { margin-left: -30px; }
+.menu-item-depth-2 { margin-left: -60px; }
+.menu-item-depth-3 { margin-left: -90px; }
+.menu-item-depth-4 { margin-left: -120px; }
+.menu-item-depth-5 { margin-left: -150px; }
+.menu-item-depth-6 { margin-left: -180px; }
+.menu-item-depth-7 { margin-left: -210px; }
+.menu-item-depth-8 { margin-left: -240px; }
+.menu-item-depth-9 { margin-left: -270px; }
+.menu-item-depth-10 { margin-left: -300px; }
+.menu-item-depth-11 { margin-left: -330px; }
+
+#menu-to-edit li dl {
+       padding: 0 !important;
+       margin: 0 !important;
+}
+.ui-sortable-helper .menu-item-transport {
+       margin-top: 13px;
+}
+       .ui-sortable-helper .menu-item-transport .menu-item-transport {
+               margin-top: 0;
+       }
+.sortable-placeholder {
+       margin-top: 0 !important;
+       margin-left: 0 !important;
+       margin-bottom: 13px !important;
+       padding: 0 !important;
+}
+.auto-add-pages {
+       clear: both;
+       float: none;
+}
+#nav-menus-frame .open-label span {
+       float: none;
+       display: inline-block;
+}
+#nav-menus-frame .delete-action {
+       float: none;
+}
index 7e84e0c58656088fad6026e0d7f2bfa264d633a5..bacde2918e73cb904982121d36ddefb00b2b5629 100644 (file)
@@ -1,444 +1 @@
-/* Fixes for IE bugs */
-
-input.button,
-input.button-secondary,
-input.button-highlighted {
-       padding: 0;
-}
-
-#minor-publishing-actions input,
-#major-publishing-actions input {
-       min-width: auto;
-       padding-left: 0;
-       padding-right: 0;
-}
-
-#wpbody-content .postbox {
-       border: 1px solid #dfdfdf;
-}
-
-#wpbody-content .postbox h3 {
-       margin-bottom: -1px;
-}
-
-* html .meta-box-sortables .postbox .handlediv {
-       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
-}
-
-* html .edit-box {
-       display: inline;
-}
-
-* html .inner-sidebar #side-sortables,
-* html .postbox-container .meta-box-sortables {
-       height: 300px;
-}
-
-* 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 #adminmenu {
-       margin-left: -80px;
-}
-
-* html .folded #adminmenu {
-       margin-left: -22px;
-}
-
-* html #wpcontent #adminmenu li.menu-top {
-       display: inline;
-       padding: 0;
-       margin: 0;
-}
-
-* html #footer {
-       margin: 0;
-}
-
-.folded #adminmenu li.menu-top {
-       display: block;
-       zoom: 100%;
-}
-
-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%;
-}
-
-.folded #adminmenu li.wp-menu-separator {
-       width: 28px;
-}
-
-#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
-       padding: 3px 4px 4px 10px;
-       zoom: 100%;
-}
-
-.folded #adminmenu .menu-top {
-       height: 30px;
-}
-
-.folded #adminmenu .wp-submenu {
-       margin: -1px 0 0 0;
-}
-
-#template,
-#template div,
-#editcat,
-#addcat,
-* html .stuffbox h3 {
-       zoom: 100%;
-}
-
-.submitbox {
-       margin-top: 10px;
-}
-
-/* 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;
-}
-
-#wphead-info {
-       float: right;
-}
-
-#titlediv #title {
-       width: 98%;
-}
-
-a.button {
-       line-height: 1.4em;
-       margin: 1px;
-       padding: 4px 6px;
-}
-
-* html div.widget-liquid-left,
-* html div.widget-liquid-right {
-       display: block;
-       position: relative;
-}
-
-#screen-options-wrap {
-       overflow: hidden;
-}
-
-#favorite-actions {
-       z-index: 12;
-}
-
-#favorite-inside,
-#favorite-inside a,
-.favorite-action {
-       zoom: 100%;
-}
-
-#the-comment-list .comment-item,
-#post-status-info,
-#wpwrap,
-#wpcontent,
-#wrap,
-#postdivrich,
-#postdiv,
-#poststuff,
-.metabox-holder,
-#titlediv,
-#post-body,
-#editorcontainer,
-.tablenav,
-.widget-liquid-left,
-.widget-liquid-right,
-#widgets-left,
-.widgets-sortables,
-#dragHelper,
-.widget .widget-top,
-.widget,
-.widget-control-actions,
-.tagchecklist,
-#col-container,
-#col-left,
-#col-right,
-.fileedit-sub {
-       display: block;
-       zoom: 100%;
-}
-
-p.search-box {
-       position: static;
-       float: right;
-       margin: -3px 0 4px;
-}
-
-* html #editorcontainer {
-       padding: 0;
-}
-
-#editorcontainer #content {
-       overflow: auto;
-       margin: auto;
-       width: 98%;
-}
-
-form#template div {
-       width: 100%;
-}
-
-#ed_toolbar input,
-#ed_reply_toolbar input {
-       overflow: visible;
-       padding: 0 4px;
-}
-
-#poststuff h2 {
-       font-size: 1.6em;
-}
-
-* html #poststuff h2 {
-       margin-left: 0;
-}
-
-#bh {
-       margin: 7px 10px 0 0;
-       float: right;
-}
-
-/* without this dashboard widgets appear in one column for some screen widths */
-div#dashboard-widgets {
-       padding-right: 1px;
-}
-
-.tagchecklist span, .tagchecklist span a {
-       display: inline-block;
-       display: block;
-}
-
-.tagchecklist span a {
-       margin: 4px 0 0 -9px;
-}
-
-.tablenav .button-secondary, .nav .button-secondary {
-       padding: 0 1px;
-       vertical-align: middle;
-}
-
-.tablenav select {
-       font-size: 13px;
-       display: inline-block;
-       vertical-align: top;
-       margin-top: 2px;
-}
-
-.tablenav .actions select {
-       width: 155px;
-}
-
-table.ie-fixed {
-       table-layout: fixed;
-}
-
-.widefat tr, .widefat th {
-       margin-bottom: 0;
-       border-spacing: 0;
-}
-
-.widefat th input {
-       margin: 0 0 0 5px;
-}
-
-.widefat .check-column {
-       padding: 6px 0 2px;
-}
-
-.widefat tbody th.check-column {
-       padding: 4px 0 22px;
-}
-
-.widefat {
-       empty-cells: show;
-       border-collapse: collapse;
-}
-
-.tablenav a.button-secondary {
-       display: inline-block;
-       padding: 2px 5px;
-}
-
-* html .stuffbox,
-* html .stuffbox input,
-* html .stuffbox textarea {
-       border: 1px solid #DFDFDF;
-}
-
-* html .feature-filter .feature-group li {
-       width: 145px;
-}
-
-* html .widget-top .widget-title-action a {
-    background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px;
-}
-
-* html div.widget-liquid-left {
-    width: 99%;
-}
-
-#wp_inactive_widgets {
-       padding-bottom: 8px;
-}
-
-* html .widgets-sortables {
-       height: 50px;
-}
-
-* html a#content_resize {
-       right: -2px;
-}
-
-* html .widget-title h4 {
-       width: 205px;
-}
-
-* html #removing-widget .in-widget-title {
-       display: none;
-}
-
-#available-widgets .widget-holder {
-       padding-bottom: 65px;
-}
-
-#widgets-left .inactive {
-       padding-bottom: 10px;
-}
-
-.widget-liquid-right .widget,
-#wp_inactive_widgets .widget {
-       position: relative;
-}
-
-* html .media-item .pinkynail {
-       height: 32px;
-       width: 40px;
-}
-
-#wpcontent .button-primary-disabled {
-       color: #9FD0D5;
-       background: #298CBA;
-}
-
-#wpcontent #ajax-loading {
-       vertical-align: baseline;
-}
-
-* html .describe .field input.text,
-* html .describe .field textarea {
-       width: 440px;
-}
-
-#the-comment-list .unapproved tr,
-#the-comment-list .unapproved td {
-       background-color: #ffffe0;
-}
-
-.imgedit-submit {
-       width: 300px;
-}
-
-* html input {
-       border: 1px solid #dfdfdf;
-}
+#wpbody-content input.button,#wpbody-content input.button-secondary,#wpbody-content input.button-highlighted{padding:2px 3px;}#minor-publishing-actions input,#major-publishing-actions input{min-width:auto;padding-left:0;padding-right:0;}#wpbody-content .postbox{border:1px solid #dfdfdf;}#wpbody-content .postbox h3{margin-bottom:-1px;}* html .meta-box-sortables .postbox .handlediv{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;}* html .edit-box{display:inline;}* html .inner-sidebar #side-sortables,* html .postbox-container .meta-box-sortables{height:300px;}* 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 #adminmenu{margin-left:-80px;}* html .folded #adminmenu{margin-left:-22px;}* html #wpcontent #adminmenu li.menu-top{display:inline;padding:0;margin:0;}* html #footer{margin:0;}.folded #adminmenu li.menu-top{display:block;zoom:100%;}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?ver=20100610) no-repeat scroll left -109px;}* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle{background:url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -206px;}* html #adminmenu div.wp-menu-image{height:29px;}#wpcontent #adminmenu .wp-submenu li{padding:0;}#adminmenu,.major-publishing-actions,.wp-submenu,.wp-submenu li,.wp-menu-toggle{zoom:100%;}.folded #adminmenu li.wp-menu-separator{width:28px;}#wpcontent #adminmenu .wp-submenu li.wp-submenu-head{padding:3px 4px 4px 10px;zoom:100%;}.folded #adminmenu .menu-top{height:30px;}.folded #adminmenu .wp-submenu{margin:-1px 0 0 0;}#template,#template div,#editcat,#addcat,* html .stuffbox h3{zoom:100%;}.submitbox{margin-top:10px;}#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;}input{line-height:1;}* html .row-actions{visibility:visible;}#dashboard-widgets h3 a{height:20px;line-height:20px;}#wphead-info{float:right;}#titlediv #title{width:98%;}a.button{line-height:1.4em;margin:1px;padding:2px 6px;}* html div.widget-liquid-left,* html div.widget-liquid-right{display:block;position:relative;}#screen-options-wrap{overflow:hidden;}#favorite-actions{z-index:12;}#favorite-inside,#favorite-inside a,.favorite-action{zoom:100%;}#the-comment-list .comment-item,#post-status-info,#wpwrap,#wpcontent,#wrap,#postdivrich,#postdiv,#poststuff,.metabox-holder,#titlediv,#post-body,#editorcontainer,.tablenav,.widget-liquid-left,.widget-liquid-right,#widgets-left,.widgets-sortables,#dragHelper,.widget .widget-top,.widget,.widget-control-actions,.tagchecklist,#col-container,#col-left,#col-right,.fileedit-sub{display:block;zoom:100%;}p.search-box{position:static;float:right;margin:-3px 0 4px;}* html #editorcontainer{padding:0;}#editorcontainer #content{overflow:auto;margin:auto;width:98%;}form#template div{width:100%;}#ed_toolbar input,#ed_reply_toolbar input{overflow:visible;padding:0 4px;}#poststuff h2{font-size:1.6em;}* html #poststuff h2{margin-left:0;}#bh{margin:7px 10px 0 0;float:right;}div#dashboard-widgets{padding-right:1px;}.tagchecklist span,.tagchecklist span a{display:inline-block;display:block;}.tagchecklist span a{margin:4px 0 0 -9px;}.tablenav .button-secondary,.nav .button-secondary{padding:0 1px;vertical-align:middle;}.tablenav select{font-size:13px;display:inline-block;vertical-align:top;margin-top:2px;}.tablenav .actions select{width:155px;}table.ie-fixed{table-layout:fixed;}.widefat tr,.widefat th{margin-bottom:0;border-spacing:0;}.widefat th input{margin:0 0 0 5px;}.widefat .check-column{padding:6px 0 2px;}.widefat tbody th.check-column{padding:4px 0 22px;}.widefat{empty-cells:show;border-collapse:collapse;}.tablenav a.button-secondary{display:inline-block;padding:2px 5px;}* html .stuffbox,* html .stuffbox input,* html .stuffbox textarea{border:1px solid #DFDFDF;}* html .feature-filter .feature-group li{width:145px;}* html .widget-top .widget-title-action a{background:url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;}* html div.widget-liquid-left{width:99%;}#wp_inactive_widgets{padding-bottom:8px;}* html .widgets-sortables{height:50px;}* html a#content_resize{right:-2px;}* html .widget-title h4{width:205px;}* html #removing-widget .in-widget-title{display:none;}#available-widgets .widget-holder{padding-bottom:65px;}#widgets-left .inactive{padding-bottom:10px;}.widget-liquid-right .widget,#wp_inactive_widgets .widget{position:relative;}* html .media-item .pinkynail{height:32px;width:40px;}#wpcontent .button-primary-disabled{color:#9FD0D5;background:#298CBA;}#wpcontent #ajax-loading{vertical-align:baseline;}* html .describe .field input.text,* html .describe .field textarea{width:440px;}#the-comment-list .unapproved tr,#the-comment-list .unapproved td{background-color:#ffffe0;}.imgedit-submit{width:300px;}* html input{border:1px solid #dfdfdf;}#nav-menu-header,#nav-menus-frame,#wpbody,.menu li{zoom:100%;}#update-nav-menu #post-body{overflow:hidden;}.menu li{min-width:100%;}.menu li.sortable-placeholder{min-width:400px;}
\ No newline at end of file
diff --git a/wp-admin/css/ie.dev.css b/wp-admin/css/ie.dev.css
new file mode 100644 (file)
index 0000000..2e81461
--- /dev/null
@@ -0,0 +1,464 @@
+/* Fixes for IE bugs */
+
+#wpbody-content input.button,
+#wpbody-content input.button-secondary,
+#wpbody-content input.button-highlighted {
+       padding: 2px 3px;
+}
+
+#minor-publishing-actions input,
+#major-publishing-actions input {
+       min-width: auto;
+       padding-left: 0;
+       padding-right: 0;
+}
+
+#wpbody-content .postbox {
+       border: 1px solid #dfdfdf;
+}
+
+#wpbody-content .postbox h3 {
+       margin-bottom: -1px;
+}
+
+* html .meta-box-sortables .postbox .handlediv {
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
+}
+
+* html .edit-box {
+       display: inline;
+}
+
+* html .inner-sidebar #side-sortables,
+* html .postbox-container .meta-box-sortables {
+       height: 300px;
+}
+
+* 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 #adminmenu {
+       margin-left: -80px;
+}
+
+* html .folded #adminmenu {
+       margin-left: -22px;
+}
+
+* html #wpcontent #adminmenu li.menu-top {
+       display: inline;
+       padding: 0;
+       margin: 0;
+}
+
+* html #footer {
+       margin: 0;
+}
+
+.folded #adminmenu li.menu-top {
+       display: block;
+       zoom: 100%;
+}
+
+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?ver=20100610) no-repeat scroll left -109px;
+}
+
+* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -206px;
+}
+
+* html #adminmenu div.wp-menu-image {
+       height: 29px;
+}
+
+#wpcontent #adminmenu .wp-submenu li {
+       padding: 0;
+}
+
+#adminmenu,
+.major-publishing-actions,
+.wp-submenu,
+.wp-submenu li,
+.wp-menu-toggle {
+       zoom: 100%;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       width: 28px;
+}
+
+#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
+       padding: 3px 4px 4px 10px;
+       zoom: 100%;
+}
+
+.folded #adminmenu .menu-top {
+       height: 30px;
+}
+
+.folded #adminmenu .wp-submenu {
+       margin: -1px 0 0 0;
+}
+
+#template,
+#template div,
+#editcat,
+#addcat,
+* html .stuffbox h3 {
+       zoom: 100%;
+}
+
+.submitbox {
+       margin-top: 10px;
+}
+
+/* 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;
+}
+
+#wphead-info {
+       float: right;
+}
+
+#titlediv #title {
+       width: 98%;
+}
+
+a.button {
+       line-height: 1.4em;
+       margin: 1px;
+       padding: 2px 6px;
+}
+
+* html div.widget-liquid-left,
+* html div.widget-liquid-right {
+       display: block;
+       position: relative;
+}
+
+#screen-options-wrap {
+       overflow: hidden;
+}
+
+#favorite-actions {
+       z-index: 12;
+}
+
+#favorite-inside,
+#favorite-inside a,
+.favorite-action {
+       zoom: 100%;
+}
+
+#the-comment-list .comment-item,
+#post-status-info,
+#wpwrap,
+#wpcontent,
+#wrap,
+#postdivrich,
+#postdiv,
+#poststuff,
+.metabox-holder,
+#titlediv,
+#post-body,
+#editorcontainer,
+.tablenav,
+.widget-liquid-left,
+.widget-liquid-right,
+#widgets-left,
+.widgets-sortables,
+#dragHelper,
+.widget .widget-top,
+.widget,
+.widget-control-actions,
+.tagchecklist,
+#col-container,
+#col-left,
+#col-right,
+.fileedit-sub {
+       display: block;
+       zoom: 100%;
+}
+
+p.search-box {
+       position: static;
+       float: right;
+       margin: -3px 0 4px;
+}
+
+* html #editorcontainer {
+       padding: 0;
+}
+
+#editorcontainer #content {
+       overflow: auto;
+       margin: auto;
+       width: 98%;
+}
+
+form#template div {
+       width: 100%;
+}
+
+#ed_toolbar input,
+#ed_reply_toolbar input {
+       overflow: visible;
+       padding: 0 4px;
+}
+
+#poststuff h2 {
+       font-size: 1.6em;
+}
+
+* html #poststuff h2 {
+       margin-left: 0;
+}
+
+#bh {
+       margin: 7px 10px 0 0;
+       float: right;
+}
+
+/* without this dashboard widgets appear in one column for some screen widths */
+div#dashboard-widgets {
+       padding-right: 1px;
+}
+
+.tagchecklist span, .tagchecklist span a {
+       display: inline-block;
+       display: block;
+}
+
+.tagchecklist span a {
+       margin: 4px 0 0 -9px;
+}
+
+.tablenav .button-secondary, .nav .button-secondary {
+       padding: 0 1px;
+       vertical-align: middle;
+}
+
+.tablenav select {
+       font-size: 13px;
+       display: inline-block;
+       vertical-align: top;
+       margin-top: 2px;
+}
+
+.tablenav .actions select {
+       width: 155px;
+}
+
+table.ie-fixed {
+       table-layout: fixed;
+}
+
+.widefat tr, .widefat th {
+       margin-bottom: 0;
+       border-spacing: 0;
+}
+
+.widefat th input {
+       margin: 0 0 0 5px;
+}
+
+.widefat .check-column {
+       padding: 6px 0 2px;
+}
+
+.widefat tbody th.check-column {
+       padding: 4px 0 22px;
+}
+
+.widefat {
+       empty-cells: show;
+       border-collapse: collapse;
+}
+
+.tablenav a.button-secondary {
+       display: inline-block;
+       padding: 2px 5px;
+}
+
+* html .stuffbox,
+* html .stuffbox input,
+* html .stuffbox textarea {
+       border: 1px solid #DFDFDF;
+}
+
+* html .feature-filter .feature-group li {
+       width: 145px;
+}
+
+* html .widget-top .widget-title-action a {
+       background: url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;
+}
+
+* html div.widget-liquid-left {
+       width: 99%;
+}
+
+#wp_inactive_widgets {
+       padding-bottom: 8px;
+}
+
+* html .widgets-sortables {
+       height: 50px;
+}
+
+* html a#content_resize {
+       right: -2px;
+}
+
+* html .widget-title h4 {
+       width: 205px;
+}
+
+* html #removing-widget .in-widget-title {
+       display: none;
+}
+
+#available-widgets .widget-holder {
+       padding-bottom: 65px;
+}
+
+#widgets-left .inactive {
+       padding-bottom: 10px;
+}
+
+.widget-liquid-right .widget,
+#wp_inactive_widgets .widget {
+       position: relative;
+}
+
+* html .media-item .pinkynail {
+       height: 32px;
+       width: 40px;
+}
+
+#wpcontent .button-primary-disabled {
+       color: #9FD0D5;
+       background: #298CBA;
+}
+
+#wpcontent #ajax-loading {
+       vertical-align: baseline;
+}
+
+* html .describe .field input.text,
+* html .describe .field textarea {
+       width: 440px;
+}
+
+#the-comment-list .unapproved tr,
+#the-comment-list .unapproved td {
+       background-color: #ffffe0;
+}
+
+.imgedit-submit {
+       width: 300px;
+}
+
+* html input {
+       border: 1px solid #dfdfdf;
+}
+
+#nav-menu-header,
+#nav-menus-frame,
+#wpbody,
+.menu li {
+       zoom:100%;
+}
+
+#update-nav-menu #post-body {
+       overflow:hidden;
+}
+
+.menu li {
+       min-width:100%;
+}
+
+.menu li.sortable-placeholder {
+       min-width:400px;
+}
index f44484f7e3344d99a3f56b9e38bfcb79ce3fedc4..e422eced92be8cea5d021876357f07f26439a02b 100644 (file)
@@ -1,16 +1 @@
-body {
-       font-family: Tahoma, arial;
-}
-h1 {
-       font-family: arial;
-       margin: 5px -4px 0 0;
-}
-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 {
-       text-align: right;
-}
+body{font-family:Tahoma,arial;}h1{font-family:arial;margin:5px -4px 0 0;}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{text-align:right;}#user_login,#admin_email,#pass1,#pass2{direction:ltr;}
\ No newline at end of file
diff --git a/wp-admin/css/install-rtl.dev.css b/wp-admin/css/install-rtl.dev.css
new file mode 100644 (file)
index 0000000..9e0be99
--- /dev/null
@@ -0,0 +1,23 @@
+body {
+       font-family: Tahoma, arial;
+}
+h1 {
+       font-family: arial;
+       margin: 5px -4px 0 0;
+}
+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 {
+       text-align: right;
+}
+#user_login, #admin_email, #pass1, #pass2 {
+       direction: ltr;
+}
\ No newline at end of file
index 834a3b18a85d3bbbe4518d63b185ac902e0a5591..3655b4053bebc358f3007f35c8a629f19b61629d 100644 (file)
@@ -1 +1 @@
-html{background:#f7f7f7;}body{background:#fff;color:#333;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;margin:2em auto 0 auto;width:700px;padding:1em 2em;-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;}h1{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;font-size:12px;line-height:18px;}code{font-size:13px;}ul,ol{padding:5px 5px 5px 22px;}#logo{margin:6px 0 14px 0;border-bottom:none;}.step{margin:20px 0 15px;}.step,th{text-align:left;padding:0;}.submit input,.button,.button-secondary{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,.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;}.form-table{border-collapse:collapse;margin-top:1em;width:100%;}.form-table td{margin-bottom:9px;padding:10px;border-bottom:8px solid #fff;font-size:12px;}.form-table th{font-size:13px;text-align:left;padding:16px 10px 10px 10px;border-bottom:8px solid #fff;width:110px;vertical-align:top;}.form-table tr{background:#f3f3f3;}.form-table code{line-height:18px;font-size:18px;}.form-table p{margin:4px 0 0 0;font-size:11px;}.form-table input{line-height:20px;font-size:15px;padding:2px;}#error-page{margin-top:50px;}#error-page p{font-size:12px;line-height:18px;margin:25px 0 20px;}#error-page code{font-family:Consolas,Monaco,Courier,monospace;}
\ No newline at end of file
+html{background:#f9f9f9;}body{background:#fff;color:#333;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;margin:2em auto;width:700px;padding:1em 2em;-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;}h1{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,dd,dt{padding-bottom:2px;font-size:12px;line-height:18px;}code,.code{font-size:13px;}ul,ol,dl{padding:5px 5px 5px 22px;}a img{border:0;}abbr{border:0;font-variant:normal;}#logo{margin:6px 0 14px 0;border-bottom:none;text-align:center;}.step{margin:20px 0 15px;}.step,th{text-align:left;padding:0;}.submit input,.button,.button-secondary{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,.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;}textarea{border:1px solid #bbb;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.form-table{border-collapse:collapse;margin-top:1em;width:100%;}.form-table td{margin-bottom:9px;padding:10px;border-bottom:8px solid #fff;font-size:12px;}.form-table th{font-size:13px;text-align:left;padding:16px 10px 10px 10px;border-bottom:8px solid #fff;width:130px;vertical-align:top;}.form-table tr{background:#f3f3f3;}.form-table code{line-height:18px;font-size:18px;}.form-table p{margin:4px 0 0 0;font-size:11px;}.form-table input{line-height:20px;font-size:15px;padding:2px;}.form-table th p{font-weight:normal;}#error-page{margin-top:50px;}#error-page p{font-size:12px;line-height:18px;margin:25px 0 20px;}#error-page code,.code{font-family:Consolas,Monaco,Courier,monospace;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 5px 5px 1px;padding:5px;text-align:center;width:200px;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}.message{border:1px solid #e6db55;padding:.3em .6em;margin:5px 0 15px;background-color:#ffffe0;}
\ No newline at end of file
index 6be5ba7554597d9637a7721721526189bb303bf0..672c011b557e280317e005e0e9bb02d782c0bd3c 100644 (file)
@@ -1,10 +1,12 @@
-html { background: #f7f7f7; }
+html {
+       background: #f9f9f9;
+}
 
 body {
        background: #fff;
        color: #333;
        font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
-       margin: 2em auto 0 auto;
+       margin: 2em auto;
        width: 700px;
        padding: 1em 2em;
        -moz-border-radius: 11px;
@@ -14,9 +16,14 @@ body {
        border: 1px solid #dfdfdf;
 }
 
-a { color: #2583ad; text-decoration: none; }
+a {
+       color: #2583ad;
+       text-decoration: none;
+}
 
-a:hover { color: #d54e21; }
+a:hover {
+       color: #d54e21;
+}
 
 h1 {
        border-bottom: 1px solid #dadada;
@@ -28,25 +35,43 @@ h1 {
        padding-bottom: 7px;
 }
 
-h2 { font-size: 16px; }
+h2 {
+       font-size: 16px;
+}
 
-p, li {
+p, li, dd, dt {
        padding-bottom: 2px;
        font-size: 12px;
        line-height: 18px;
 }
 
-code { font-size: 13px; }
-
-ul, ol { padding: 5px 5px 5px 22px; }
+code, .code {
+       font-size: 13px;
+}
 
-#logo { margin: 6px 0 14px 0; border-bottom: none;}
+ul, ol, dl {
+       padding: 5px 5px 5px 22px;
+}
 
+a img {
+       border:0
+}
+abbr {
+       border: 0;
+       font-variant: normal;
+}
+#logo {
+       margin: 6px 0 14px 0;
+       border-bottom: none;
+       text-align:center
+}
 .step {
        margin: 20px 0 15px;
 }
-
-.step, th { text-align: left; padding: 0; }
+.step, th {
+       text-align: left;
+       padding: 0;
+}
 
 .submit input, .button, .button-secondary {
        font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
@@ -80,6 +105,14 @@ ul, ol { padding: 5px 5px 5px 22px; }
        background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
 }
 
+textarea {
+       border: 1px solid #bbb;
+       -moz-border-radius: 4px;
+       -khtml-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+}
+
 .form-table {
        border-collapse: collapse;
        margin-top: 1em;
@@ -98,7 +131,7 @@ ul, ol { padding: 5px 5px 5px 22px; }
        text-align: left;
        padding: 16px 10px 10px 10px;
        border-bottom: 8px solid #fff;
-       width: 110px;
+       width: 130px;
        vertical-align: top;
 }
 
@@ -122,7 +155,13 @@ ul, ol { padding: 5px 5px 5px 22px; }
        padding: 2px;
 }
 
-#error-page { margin-top: 50px; }
+.form-table th p {
+       font-weight: normal;
+}
+
+#error-page {
+       margin-top: 50px;
+}
 
 #error-page p {
        font-size: 12px;
@@ -130,4 +169,44 @@ ul, ol { padding: 5px 5px 5px 22px; }
        margin: 25px 0 20px;
 }
 
-#error-page code { font-family: Consolas, Monaco, Courier, monospace; }
+#error-page code, .code {
+       font-family: Consolas, Monaco, Courier, monospace;
+}
+
+#pass-strength-result {
+       background-color: #eee;
+       border-color: #ddd !important;
+       border-style: solid;
+       border-width: 1px;
+       margin: 5px 5px 5px 1px;
+       padding: 5px;
+       text-align: center;
+       width: 200px;
+}
+
+#pass-strength-result.bad {
+       background-color: #ffb78c;
+       border-color: #ff853c !important;
+}
+
+#pass-strength-result.good {
+       background-color: #ffec8b;
+       border-color: #ffcc00 !important;
+}
+
+#pass-strength-result.short {
+       background-color: #ffa0a0;
+       border-color: #f04040 !important;
+}
+
+#pass-strength-result.strong {
+       background-color: #c3ff88;
+       border-color: #8dff1c !important;
+}
+
+.message {
+       border: 1px solid #e6db55;
+       padding: 0.3em 0.6em;
+       margin: 5px 0 15px;
+       background-color: #ffffe0;
+}
index 4a5c5f0a8112a25c0b61192e0dc370281cd1b065..11040fae6423f6240c58839c1e1e542a96b37ef6 100644 (file)
@@ -1,30 +1 @@
-body {
-       font-family: Tahoma, arial;
-}
-form {
-       margin-right: 8px;
-       margin-left: 0;
-}
-form .forgetmenot {
-       float: right;
-}
-#login form .submit input {
-       font-family: Tahoma, arial;
-}
-form .submit { float: left; }
-#backtoblog a {
-       left: auto;
-       right: 15px;
-}
-#login_error, .message {
-       margin: 0 8px 16px 0;
-}
-#nav { margin: 0 8px 0 0; }
-#user_pass, #user_login, #user_email {
-       margin-left: 6px;
-       margin-right: 0;
-       direction:ltr;
-}
-h1 a {
-       text-decoration: none;
-}
+body{font-family:Tahoma,arial;}form{margin-right:8px;margin-left:0;}form .forgetmenot{float:right;}#login form .submit input{font-family:Tahoma,arial;}form .submit{float:left;}#backtoblog a{padding:8px 15px 0 0;}#login_error,.message{margin:0 8px 16px 0;}#nav{margin:0 8px 0 0;}#user_pass,#user_login,#user_email{margin-left:6px;margin-right:0;direction:ltr;}h1 a{text-decoration:none;}
\ No newline at end of file
diff --git a/wp-admin/css/login-rtl.dev.css b/wp-admin/css/login-rtl.dev.css
new file mode 100644 (file)
index 0000000..954b320
--- /dev/null
@@ -0,0 +1,29 @@
+body {
+       font-family: Tahoma, arial;
+}
+form {
+       margin-right: 8px;
+       margin-left: 0;
+}
+form .forgetmenot {
+       float: right;
+}
+#login form .submit input {
+       font-family: Tahoma, arial;
+}
+form .submit { float: left; }
+#backtoblog a {
+       padding: 8px 15px 0 0;
+}
+#login_error, .message {
+       margin: 0 8px 16px 0;
+}
+#nav { margin: 0 8px 0 0; }
+#user_pass, #user_login, #user_email {
+       margin-left: 6px;
+       margin-right: 0;
+       direction:ltr;
+}
+h1 a {
+       text-decoration: none;
+}
index a880c03794952833c93f12c0db1598b0492a1619..c5920596b281cac0fccc1ba3daac2373d483345d 100644 (file)
@@ -1 +1 @@
-*{margin:0;padding:0;}body{border-top-width:30px;border-top-style:solid;font:11px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}form{margin-left:8px;padding:16px 16px 40px 16px;font-weight:normal;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;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;}.button-primary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;padding:3px 10px;border:none;font-size:12px;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;cursor:pointer;text-decoration:none;margin-top:-3px;}#login form p{margin-bottom:0;}label{color:#777;font-size:13px;}form .forgetmenot label{font-size:11px;line-height:19px;}form .submit,.alignright{float:right;}form p{margin-bottom:24px;}h1 a{background:url(../images/logo-login.gif) no-repeat top center;width:326px;height:67px;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;left:15px;text-decoration:none;}#login{width:320px;margin:7em auto;}#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{font-size:24px;width:97%;padding:3px;margin-top:2px;margin-right:6px;margin-bottom:16px;border:1px solid #e5e5e5;background:#fbfbfb;}input{color:#555;}.clear{clear:both;}
\ No newline at end of file
+*{margin:0;padding:0;}body{padding-top:30px;font:11px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}form{margin-left:8px;padding:16px 16px 40px 16px;font-weight:normal;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;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;}.button-primary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;padding:3px 10px;border:none;font-size:12px;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;cursor:pointer;text-decoration:none;margin-top:-3px;}#login form p{margin-bottom:0;}label{color:#777;font-size:13px;}form .forgetmenot label{font-size:11px;line-height:19px;}form .submit,.alignright{float:right;}form p{margin-bottom:24px;}h1 a{background:url(../images/logo-login.gif) no-repeat top center;width:326px;height:67px;text-indent:-9999px;overflow:hidden;padding-bottom:15px;display:block;}#nav{text-shadow:rgba(255,255,255,1) 0 1px 0;}#backtoblog{position:absolute;top:0;left:0;border-bottom:#c6c6c6 1px solid;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));height:30px;width:100%;}#backtoblog a{text-decoration:none;display:block;padding:8px 0 0 15px;}#login{width:320px;margin:7em auto;}#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{font-size:24px;width:97%;padding:3px;margin-top:2px;margin-right:6px;margin-bottom:16px;border:1px solid #e5e5e5;background:#fbfbfb;}input{color:#555;}.clear{clear:both;}
\ No newline at end of file
index 842debc1732d839adee0870ff185e0d7d827f0c7..b2a1f559ecb4c2dc00e869ec9acd3418f0a7c893 100644 (file)
@@ -1,8 +1,7 @@
 * { margin: 0; padding: 0; }
 
 body {
-       border-top-width: 30px;
-       border-top-style: solid;
+       padding-top: 30px;
        font: 11px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
@@ -81,11 +80,22 @@ h1 a {
        text-shadow: rgba(255,255,255,1) 0 1px 0;
 }
 
-#backtoblog {
+#backtoblog {
        position: absolute;
-       top: 7px;
-       left: 15px;
+       top: 0;
+       left: 0;
+       border-bottom: #c6c6c6 1px solid;
+       background: #d9d9d9; /* fallback color */
+       background: -moz-linear-gradient(bottom,  #d7d7d7,  #e4e4e4);
+       background: -webkit-gradient(linear, left bottom, left top, from(#d7d7d7), to(#e4e4e4));
+       height: 30px;
+       width: 100%;
+}
+
+#backtoblog a {
        text-decoration: none;
+       display: block;
+       padding: 8px 0 0 15px;
 }
 
 #login { width: 320px; margin: 7em auto; }
index fed86444261e9f2a2b83122d271aad82b22f8600..5b9e94145142a8765b18b92b2cfa5c179a3aa907 100644 (file)
@@ -1,85 +1 @@
-body#media-upload ul#sidemenu {
-       left: auto;
-       right: 0;
-}
-#search-filter {
-       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 {
-       background-position: center right;
-}
-tr.image-size div.image-size-item {
-       float: right;
-}
-tr.image-size label {
-       margin: 0 1em 0 0;
-}
-.filename.original {
-       float: right;
-}
-.crunching {
-       text-align: left;
-       margin-right: 0;
-       margin-left: 5px;
-}
-button.dismiss {
-       right: auto;
-       left: 5px;
-}
-.file-error {
-       margin: 0 50px 5px 0;
-}
-.progress {
-       left: auto;
-       right: 0;
-}
-.describe td {
-       padding: 0 0 0 5px;
-}
-.bar {
-       border-right-width: 0;
-       border-left-width: 3px;
-       border-right-style: none;
-       border-left-style: solid;
-}
-
-/* Specific to Uploader */
-#media-upload .media-upload-form p {
-       margin: 0 0 1em 1em;
-}
-.filename {
-       float: right;
-       margin-left: 0;
-       margin-right: 10px;
-}
-#media-upload .describe th.label {
-       text-align: right;
-}
-.menu_order {
-       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;
-}
+body#media-upload ul#sidemenu{left:auto;right:0;}#search-filter{text-align:left;}.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;}tr.image-size div.image-size-item{float:right;}tr.image-size label{margin:0 1em 0 0;}.filename.original{float:right;}.crunching{text-align:left;margin-right:0;margin-left:5px;}button.dismiss{right:auto;left:5px;}.file-error{margin:0 50px 5px 0;}.progress{left:auto;right:0;}.describe td{padding:0 0 0 5px;}.bar{border-right-width:0;border-left-width:3px;border-right-style:none;border-left-style:solid;}#media-upload .media-upload-form p{margin:0 0 1em 1em;}.filename{float:right;margin-left:0;margin-right:10px;}#media-upload .describe th.label{text-align:right;}.menu_order{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;}
\ No newline at end of file
diff --git a/wp-admin/css/media-rtl.dev.css b/wp-admin/css/media-rtl.dev.css
new file mode 100644 (file)
index 0000000..fed8644
--- /dev/null
@@ -0,0 +1,85 @@
+body#media-upload ul#sidemenu {
+       left: auto;
+       right: 0;
+}
+#search-filter {
+       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 {
+       background-position: center right;
+}
+tr.image-size div.image-size-item {
+       float: right;
+}
+tr.image-size label {
+       margin: 0 1em 0 0;
+}
+.filename.original {
+       float: right;
+}
+.crunching {
+       text-align: left;
+       margin-right: 0;
+       margin-left: 5px;
+}
+button.dismiss {
+       right: auto;
+       left: 5px;
+}
+.file-error {
+       margin: 0 50px 5px 0;
+}
+.progress {
+       left: auto;
+       right: 0;
+}
+.describe td {
+       padding: 0 0 0 5px;
+}
+.bar {
+       border-right-width: 0;
+       border-left-width: 3px;
+       border-right-style: none;
+       border-left-style: solid;
+}
+
+/* Specific to Uploader */
+#media-upload .media-upload-form p {
+       margin: 0 0 1em 1em;
+}
+.filename {
+       float: right;
+       margin-left: 0;
+       margin-right: 10px;
+}
+#media-upload .describe th.label {
+       text-align: right;
+}
+.menu_order {
+       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 3ab802f951b717273d3058c6ea5f0d2a7057c45f..bfb35fc4671cf6d2b47667a26c489fd7aff4f3f1 100644 (file)
@@ -1 +1 @@
-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:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.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;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.error{padding:2px 8px;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#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;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{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:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#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;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#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;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#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;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}
\ No newline at end of file
+div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;left:0;bottom:-1px;float:none;overflow:hidden;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.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;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.error{padding:2px 8px;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#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;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#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;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#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;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#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;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}
\ No newline at end of file
index 1c5e692160f91bd1bee2463b1b2de00f9f56cbeb..297005c23f4d4c5e3fcd8630c668dd60cb2266bd 100644 (file)
@@ -5,15 +5,15 @@ div#media-upload-header {
        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: absolute;
-       left: 0px;
+       left: 0;
        bottom: -1px;
+       float: none;
+       overflow: hidden;
 }
 
 div#media-upload-error {
@@ -187,7 +187,6 @@ abbr.required {
 }
 
 #media-upload .describe {
-       padding: 5px;
        width: 100%;
        clear: both;
        cursor: default;
diff --git a/wp-admin/css/ms.css b/wp-admin/css/ms.css
new file mode 100644 (file)
index 0000000..4815259
--- /dev/null
@@ -0,0 +1 @@
+#dashboard_right_now p.musub{margin-top:12px;border-top:1px solid #ececec;padding-left:16px;position:static;}#dashboard_right_now td.b a.musublink{font-size:16px;}#dashboard_right_now div.musubtable{border-top:none;}#dashboard_right_now div.musubtable .t{white-space:normal;}.ms-sites-php .postbox h3{cursor:auto;}.ms-sites-php .postbox .description{margin:10px 0 0;padding:0 10px 10px;border-bottom:1px solid #DFDFDF;}tr.site-deleted{background:#ff8573;}tr.site-spammed{background:#faa;}tr.site-archived{background:#ffebe8;}tr.site-mature{background:#fecac2;}
\ No newline at end of file
diff --git a/wp-admin/css/ms.dev.css b/wp-admin/css/ms.dev.css
new file mode 100644 (file)
index 0000000..738c834
--- /dev/null
@@ -0,0 +1,44 @@
+/* Dashboard: MS Specific Data */
+#dashboard_right_now p.musub {
+       margin-top: 12px;
+       border-top: 1px solid #ececec;
+       padding-left: 16px;
+       position: static;
+}
+
+#dashboard_right_now td.b a.musublink {
+       font-size: 16px;
+}
+
+#dashboard_right_now div.musubtable {
+       border-top: none;
+}
+
+#dashboard_right_now div.musubtable .t {
+       white-space: normal;
+}
+
+/* No drag and drop on ms-sites.php */
+.ms-sites-php .postbox h3 {
+       cursor: auto;
+}
+
+.ms-sites-php .postbox .description {
+       margin:10px 0 0px;
+       padding:0px 10px 10px;
+       border-bottom:1px solid #DFDFDF;
+}
+
+/* Background Color for Site Status */
+tr.site-deleted {
+       background: #ff8573;
+}
+tr.site-spammed {
+       background: #faa;
+}
+tr.site-archived {
+       background:#ffebe8;
+}
+tr.site-mature {
+       background: #fecac2;
+}
diff --git a/wp-admin/css/nav-menu-rtl.css b/wp-admin/css/nav-menu-rtl.css
new file mode 100644 (file)
index 0000000..9d24ddd
--- /dev/null
@@ -0,0 +1 @@
+#nav-menus-frame{margin-right:300px;margin-left:0;}#wpbody-content #menu-settings-column{margin-right:-300px;margin-left:0;float:right;}#menu-management-liquid{float:right;}#menu-management{margin-left:20px;margin-right:0;}#post-body{padding:0 10px 10px 0;}.post-body-plain{padding:10px 0 0 10px;}#menu-management .nav-tabs-arrow-left{right:0;left:auto;}#menu-management .nav-tabs-arrow-right{left:0;right:auto;text-align:left;}#menu-management .nav-tabs{padding-right:20px;padding-left:10px;}.js #menu-management .nav-tabs{float:right;margin-right:0;margin-left:-400px;}#select-nav-menu-container{text-align:left;}#wpbody .open-label{float:right;}#wpbody .open-label span{padding-left:10px;padding-right:0;}.js .input-with-default-title{font-style:normal;font-weight:bold;}.postbox .howto input{float:left;}#nav-menu-theme-locations .button-controls{text-align:left;}.meta-sep,.submitdelete,.submitcancel{float:right;}#cancel-save{margin-right:20px;margin-left:0;}.list-controls{float:right;}.add-to-menu{float:left;}#add-custom-link label span{float:right;padding-left:5px;padding-right:0;}.howto span{float:right;}.list li .menu-item-title input{margin-left:3px;margin-right:0;}.menu-item-handle{padding-right:10px;padding-left:0;}.menu-item-edit-active .menu-item-handle{-moz-border-radius:6px 6px 0 0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0;}.menu-item-handle .item-title{margin-left:13em;margin-right:0;}.menu-item-depth-0{margin-right:0;margin-left:0;}.menu-item-depth-1{margin-right:30px;margin-left:0;}.menu-item-depth-2{margin-right:60px;margin-left:0;}.menu-item-depth-3{margin-right:90px;margin-left:0;}.menu-item-depth-4{margin-right:120px;margin-left:0;}.menu-item-depth-5{margin-right:150px;margin-left:0;}.menu-item-depth-6{margin-right:180px;margin-left:0;}.menu-item-depth-7{margin-right:210px;margin-left:0;}.menu-item-depth-8{margin-right:240px;margin-left:0;}.menu-item-depth-9{margin-right:270px;margin-left:0;}.menu-item-depth-10{margin-right:300px;margin-left:0;}.menu-item-depth-11{margin-right:330px;margin-left:0;}.menu-item-depth-0 .menu-item-transport{margin-right:0;margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-right:-30px;margin-left:0;}.menu-item-depth-2 .menu-item-transport{margin-right:-60px;margin-left:0;}.menu-item-depth-3 .menu-item-transport{margin-right:-90px;margin-left:0;}.menu-item-depth-4 .menu-item-transport{margin-right:-120px;margin-left:0;}.menu-item-depth-5 .menu-item-transport{margin-right:-150px;margin-left:0;}.menu-item-depth-6 .menu-item-transport{margin-right:-180px;margin-left:0;}.menu-item-depth-7 .menu-item-transport{margin-right:-210px;margin-left:0;}.menu-item-depth-8 .menu-item-transport{margin-right:-240px;margin-left:0;}.menu-item-depth-9 .menu-item-transport{margin-right:-270px;margin-left:0;}.menu-item-depth-10 .menu-item-transport{margin-right:-300px;margin-left:0;}.menu-item-depth-11 .menu-item-transport{margin-right:-330px;margin-left:0;}.item-type{padding-left:10px;padding-right:0;}.item-controls{left:20px;right:auto;}.item-controls .item-order{padding-left:10px;padding-right:0;}.item-edit{background-image:url("../images/menu-bits-rtl.gif?ver=20100531");background-position:100% -105px;left:-20px;right:auto;-moz-border-radius-bottomright:3px;-moz-border-radius-bottomleft:0;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:3px;border-bottom-left-radius:0;}.menu-item-settings{padding:10px 10px 10px 0;border-width:0 1px 1px 1px;}.link-to-original{font-style:normal;font-weight:bold;}.link-to-original a{padding-right:4px;padding-left:0;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-left:10px;margin-right:0;float:right;}.major-publishing-actions .publishing-action{text-align:left;float:left;}.major-publishing-actions .delete-action{text-align:right;float:right;padding-left:15px;padding-right:0;}.menu-name-label{margin-left:15px;margin-right:0;}.auto-add-pages{float:right;}
\ No newline at end of file
diff --git a/wp-admin/css/nav-menu-rtl.dev.css b/wp-admin/css/nav-menu-rtl.dev.css
new file mode 100644 (file)
index 0000000..523e216
--- /dev/null
@@ -0,0 +1,206 @@
+#nav-menus-frame {
+       margin-right: 300px;
+       margin-left: 0;
+}
+
+#wpbody-content #menu-settings-column {
+       margin-right: -300px;
+       margin-left: 0;
+       float: right;
+}
+
+/* Menu Container */
+#menu-management-liquid {
+       float: right;
+}
+#menu-management {
+       margin-left: 20px;
+       margin-right: 0;
+}
+
+
+       #post-body {
+               padding:0 10px 10px 0;
+       }
+
+       .post-body-plain {
+               padding: 10px 0 0 10px;
+       }
+
+/* Menu Tabs */
+
+       #menu-management .nav-tabs-arrow-left {
+               right: 0;
+               left:auto;
+       }
+       #menu-management .nav-tabs-arrow-right {
+               left: 0;
+               right:auto;
+               text-align: left;
+       }
+
+#menu-management .nav-tabs {
+       padding-right: 20px;
+       padding-left: 10px;
+}
+.js #menu-management .nav-tabs {
+       float: right;
+       margin-right: 0px;
+       margin-left: -400px;
+}
+
+#select-nav-menu-container {
+       text-align: left;
+}
+
+#wpbody .open-label {
+       float:right;
+}
+
+#wpbody .open-label span {
+       padding-left: 10px;
+       padding-right:0;
+}
+
+       .js .input-with-default-title {
+               font-style: normal;
+               font-weight:bold;
+       }
+
+/* Add Menu Item Boxes */
+.postbox .howto input {
+       float: left;
+}
+#nav-menu-theme-locations .button-controls {
+       text-align: left;
+}
+
+/* Button Primary Actions */
+
+.meta-sep,
+.submitdelete,
+.submitcancel {
+       float:right;
+}
+
+#cancel-save { margin-right: 20px; margin-left: 0; }
+
+/* Button Secondary Actions */
+.list-controls { float: right;  }
+.add-to-menu {
+       float: left;
+}
+
+/* Custom Links */
+#add-custom-link label span { float: right; padding-left: 5px; padding-right:0;}
+.howto span { float: right; }
+
+.list li .menu-item-title input { margin-left: 3px; margin-right: 0 }
+
+/* Nav Menu */
+.menu-item-handle {
+       padding-right: 10px;
+       padding-left: 0;
+}
+.menu-item-edit-active .menu-item-handle {
+       -moz-border-radius: 6px 6px 0 0;
+       -webkit-border-bottom-left-radius: 0;
+       -webkit-border-bottom-right-radius: 0;
+       -khtml-border-bottom-left-radius: 0;
+       -khtml-border-bottom-right-radius: 0;
+       border-bottom-left-radius: 0;
+       border-bottom-right-radius: 0;
+}
+.menu-item-handle .item-title {
+       margin-left:13em;
+       margin-right:0;
+}
+
+
+/* WARNING: The factor of 30px is hardcoded into the nav-menus javascript. */
+.menu-item-depth-0 { margin-right: 0px; margin-left:0;}
+.menu-item-depth-1 { margin-right: 30px; margin-left:0;}
+.menu-item-depth-2 { margin-right: 60px; margin-left:0;}
+.menu-item-depth-3 { margin-right: 90px; margin-left:0;}
+.menu-item-depth-4 { margin-right: 120px; margin-left:0;}
+.menu-item-depth-5 { margin-right: 150px; margin-left:0;}
+.menu-item-depth-6 { margin-right: 180px; margin-left:0;}
+.menu-item-depth-7 { margin-right: 210px; margin-left:0;}
+.menu-item-depth-8 { margin-right: 240px; margin-left:0;}
+.menu-item-depth-9 { margin-right: 270px; margin-left:0;}
+.menu-item-depth-10 { margin-right: 300px; margin-left:0;}
+.menu-item-depth-11 { margin-right: 330px; margin-left:0;}
+
+.menu-item-depth-0 .menu-item-transport { margin-right: 0px; margin-left:0;}
+.menu-item-depth-1 .menu-item-transport { margin-right: -30px; margin-left:0;}
+.menu-item-depth-2 .menu-item-transport { margin-right: -60px; margin-left:0;}
+.menu-item-depth-3 .menu-item-transport { margin-right: -90px; margin-left:0;}
+.menu-item-depth-4 .menu-item-transport { margin-right: -120px; margin-left:0;}
+.menu-item-depth-5 .menu-item-transport { margin-right: -150px; margin-left:0;}
+.menu-item-depth-6 .menu-item-transport { margin-right: -180px; margin-left:0;}
+.menu-item-depth-7 .menu-item-transport { margin-right: -210px; margin-left:0;}
+.menu-item-depth-8 .menu-item-transport { margin-right: -240px; margin-left:0;}
+.menu-item-depth-9 .menu-item-transport { margin-right: -270px; margin-left:0;}
+.menu-item-depth-10 .menu-item-transport { margin-right: -300px; margin-left:0;}
+.menu-item-depth-11 .menu-item-transport { margin-right: -330px; margin-left:0;}
+
+/* Menu item controls */
+.item-type { padding-left: 10px;  padding-right:0;}
+.item-controls { left: 20px; right: auto;}
+.item-controls .item-order { padding-left: 10px; padding-right: 0;}
+
+.item-edit {
+       background-image: url("../images/menu-bits-rtl.gif?ver=20100531");
+       background-position: 100% -105px;
+       left: -20px;
+       right:auto;
+       -moz-border-radius-bottomright: 3px;
+       -moz-border-radius-bottomleft: 0;
+       -webkit-border-bottom-right-radius: 3px;
+       -webkit-border-bottom-left-radius: 0;
+       -khtml-border-bottom-right-radius: 3px;
+       -khtml-border-bottom-left-radius: 0;
+       border-bottom-right-radius: 3px;
+       border-bottom-left-radius: 0;
+}
+
+/* Menu editing */
+.menu-item-settings {
+       padding: 10px 10px 10px 0;
+       border-width: 0 1px 1px 1px;
+}
+
+.link-to-original {
+       font-style: normal;
+       font-weight: bold;
+}
+       .link-to-original a {
+               padding-right: 4px;
+               padding-left:0;
+       }
+
+.menu-item-settings .description-thin,
+.menu-item-settings .description-wide {
+       margin-left: 10px;
+       margin-right:0;
+       float: right;
+}
+
+/* Major/minor publishing actions (classes) */
+.major-publishing-actions .publishing-action {
+       text-align: left;
+       float: left;
+}
+.major-publishing-actions .delete-action {
+       text-align: right;
+       float: right;
+       padding-left: 15px;
+       padding-right:0;
+}
+.menu-name-label {
+       margin-left: 15px;
+       margin-right:0;
+}
+.auto-add-pages {
+       float: right;
+}
\ No newline at end of file
diff --git a/wp-admin/css/nav-menu.css b/wp-admin/css/nav-menu.css
new file mode 100644 (file)
index 0000000..d1714c3
--- /dev/null
@@ -0,0 +1 @@
+html,body{min-width:950px;}#nav-menus-frame{margin-left:300px;}#wpbody-content #menu-settings-column{display:inline;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px;}.no-js #wpbody-content #menu-settings-column{padding-top:31px;}#menu-settings-column .inside{clear:both;padding:0 10px;}.metabox-holder-disabled .postbox{opacity:.5;filter:alpha(opacity=50);}.metabox-holder-disabled .button-controls .select-all{display:none;}#wpbody{position:relative;}#menu-management-liquid{float:left;min-width:100%;}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%;}#menu-management .menu-edit{margin-bottom:20px;}#nav-menu-header,#post-body{border-color:#ccc;border-style:solid;}#nav-menu-header{border-width:1px 1px 0 1px;-moz-border-radius-topleft:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-topright:6px;-webkit-border-top-right-radius:6px;-khtml-border-top-right-radius:6px;border-top-right-radius:6px;}#post-body{background:#fff;padding:10px;border-width:0 1px 1px 1px;-moz-border-radius-bottomleft:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-right-radius:6px;}#post-body div.updated{margin:0;}#post-body-content{position:relative;}#menu-management .menu-add-new abbr{font-weight:bold;}#menu-management .nav-tabs-nav{margin:0 20px;}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff;}#menu-management .nav-tabs-arrow a{color:#C1C1C1;}#menu-management .nav-tabs-arrow a:hover{color:#D54E21;}#menu-management .nav-tabs-arrow a:active{color:#464646;}#menu-management .nav-tabs-arrow-left{left:0;}#menu-management .nav-tabs-arrow-right{right:0;text-align:right;}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden;}#menu-management .nav-tabs{padding-left:20px;padding-right:10px;}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px;}#menu-management .nav-tab{margin-bottom:0;background:#f4f4f4;font-weight:bold;border-color:#dfdfdf;}#menu-management .nav-tab-active{border-color:#ccc;}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px;}#select-nav-menu{width:100px;display:inline;}#menu-name-label{margin-top:-2px;}#wpbody .open-label{display:block;float:left;}#wpbody .open-label span{padding-right:10px;}.js .input-with-default-title{color:#aaa;font-style:italic;}#menu-management .inside{padding:0 10px;}.postbox .howto input{width:180px;float:right;}.customlinkdiv .howto input{width:210px;}#nav-menu-theme-locations .howto select{width:100%;}#nav-menu-theme-locations .button-controls{text-align:right;}.add-menu-item-view-all{height:400px;}#menu-container .submit{margin:0 0 10px;padding:0;}.meta-sep,.submitdelete,.submitcancel{display:block;float:left;font-size:11px;margin:4px 0;line-height:15px;}.meta-sep{padding:0 2px;}#cancel-save{color:#f00;text-decoration:underline;font-size:11px;margin-left:20px;margin-top:5px;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-controls{float:left;margin-top:5px;}.add-to-menu{float:right;}.postbox img.waiting{display:none;vertical-align:middle;}.button-controls{clear:both;margin:10px 0;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}#menu-name{width:270px;}#manage-menu .inside{padding:0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{width:180px;}.howto span{margin-top:4px;display:block;float:left;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;margin-bottom:10px;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}#menu-container .inside{padding-bottom:10px;}.menu{padding-top:1em;}#menu-to-edit{padding:1em 0;}.menu ul{width:100%;}.menu li{margin-bottom:0;position:relative;}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px;}.menu-item-handle{border:1px solid #E6E6E6;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #FFF;font-weight:bold;overflow:hidden;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;word-wrap:break-word;}.menu-item-edit-active .menu-item-handle{-moz-border-radius:6px 6px 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;}.no-js .menu-item-edit-active .item-edit{display:none;}.js .menu-item-handle{cursor:move;}.menu li.deleting .menu-item-handle{background-color:#f66;background-image:none;text-shadow:0 0 0 #ccc;}.menu-item-handle .item-title{padding:7px 0;line-height:20px;display:block;margin-right:13em;}li.menu-item.ui-sortable-helper dl{margin-top:0;}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px;}.menu .sortable-placeholder{height:35px;width:410px;margin-top:13px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:30px;}.menu-item-depth-2{margin-left:60px;}.menu-item-depth-3{margin-left:90px;}.menu-item-depth-4{margin-left:120px;}.menu-item-depth-5{margin-left:150px;}.menu-item-depth-6{margin-left:180px;}.menu-item-depth-7{margin-left:210px;}.menu-item-depth-8{margin-left:240px;}.menu-item-depth-9{margin-left:270px;}.menu-item-depth-10{margin-left:300px;}.menu-item-depth-11{margin-left:330px;}.menu-item-depth-0 .menu-item-transport{margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-left:-30px;}.menu-item-depth-2 .menu-item-transport{margin-left:-60px;}.menu-item-depth-3 .menu-item-transport{margin-left:-90px;}.menu-item-depth-4 .menu-item-transport{margin-left:-120px;}.menu-item-depth-5 .menu-item-transport{margin-left:-150px;}.menu-item-depth-6 .menu-item-transport{margin-left:-180px;}.menu-item-depth-7 .menu-item-transport{margin-left:-210px;}.menu-item-depth-8 .menu-item-transport{margin-left:-240px;}.menu-item-depth-9 .menu-item-transport{margin-left:-270px;}.menu-item-depth-10 .menu-item-transport{margin-left:-300px;}.menu-item-depth-11 .menu-item-transport{margin-left:-330px;}body.menu-max-depth-0{min-width:950px!important;}body.menu-max-depth-1{min-width:980px!important;}body.menu-max-depth-2{min-width:1010px!important;}body.menu-max-depth-3{min-width:1040px!important;}body.menu-max-depth-4{min-width:1070px!important;}body.menu-max-depth-5{min-width:1100px!important;}body.menu-max-depth-6{min-width:1130px!important;}body.menu-max-depth-7{min-width:1160px!important;}body.menu-max-depth-8{min-width:1190px!important;}body.menu-max-depth-9{min-width:1220px!important;}body.menu-max-depth-10{min-width:1250px!important;}body.menu-max-depth-11{min-width:1280px!important;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:20px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-order{padding-right:10px;}.item-controls .item-order a{font-weight:bold;}body.js .item-order{display:none;}.item-controls .menu-item-delete:hover{color:#f00;}.item-edit{background:url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -105px;position:absolute;right:-20px;top:0;display:block;width:23px;height:36px;overflow:hidden;text-indent:-999em;border-bottom:1px solid #eee;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}.menu-instructions-inactive{display:none;}.menu-item-settings{background:#F9F9F9;display:block;width:400px;padding:10px 0 10px 10px;border:solid #E6E6E6;border-width:0 1px 1px 1px;-moz-border-radius:0 0 6px 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;}.menu-item-edit-active .menu-item-settings{display:block;}.menu-item-edit-inactive .menu-item-settings{display:none;}.add-menu-item-pagelinks{margin:.5em auto;text-align:center;}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:11px;color:#777;font-style:italic;border:1px solid #dfdfdf;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;}.link-to-original a{padding-left:4px;font-style:normal;}.hidden-field{display:none;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-right:10px;float:left;}.description-thin{width:190px;height:40px;}.description-wide{width:390px;}.menu-item-actions{padding-top:15px;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.major-publishing-actions{clear:both;padding:5px 10px;}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;margin:5px 0 1px;}.major-publishing-actions .delete-action{vertical-align:middle;text-align:left;float:left;padding-right:15px;margin-top:5px;}.menu-name-label span,.auto-add-pages label{font-size:11px;font-style:normal;}.menu-name-label{margin-right:15px;}.auto-add-pages input{margin-top:0;}.auto-add-pages{margin-top:4px;float:left;}.submitbox .submitcancel{color:#21759B;border-bottom:1px solid #21759B;padding:1px 2px;text-decoration:none;}.submitbox .submitcancel:hover{background:#21759B;color:#fff;}.major-publishing-actions .form-invalid{border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-khtml-border-radius:4px;padding-left:4px;margin-left:-4px;}#menu-item-name-wrap:after,#menu-item-url-wrap:after,#menu-name-label:after,#menu-settings-column .inside:after,#nav-menus-frame:after,#post-body-content:after,.button-controls:after,.major-publishing-actions:after,.menu-item-settings:after{clear:both;content:".";display:block;height:0;visibility:hidden;}#nav-menus-frame,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block;}
\ No newline at end of file
diff --git a/wp-admin/css/nav-menu.dev.css b/wp-admin/css/nav-menu.dev.css
new file mode 100644 (file)
index 0000000..f1490f7
--- /dev/null
@@ -0,0 +1,570 @@
+/**
+ * WordPress Administration Custom Navigation
+ * Interface CSS
+ *
+ * @version 2.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+html,
+body {
+       min-width: 950px;
+}
+
+#nav-menus-frame {
+       margin-left: 300px;
+}
+
+#wpbody-content #menu-settings-column {
+       display:inline;
+       width:281px;
+       margin-left: -300px;
+       clear: both;
+       float: left;
+       padding-top: 24px;
+}
+       .no-js #wpbody-content #menu-settings-column {
+               padding-top: 31px;
+       }
+
+#menu-settings-column .inside {
+       clear: both;
+       padding:0 10px;
+}
+
+.metabox-holder-disabled .postbox {
+       opacity: 0.5;
+       filter: alpha(opacity=50);
+}
+
+.metabox-holder-disabled .button-controls .select-all {
+       display: none;
+}
+#wpbody {
+       position: relative;
+}
+
+/* Menu Container */
+#menu-management-liquid {
+       float: left;
+       min-width: 100%;
+}
+#menu-management {
+       position: relative;
+       margin-right: 20px;
+       margin-top: -3px;
+       width: 100%;
+}
+       #menu-management .menu-edit {
+               margin-bottom: 20px;
+       }
+
+       #nav-menu-header, #post-body {
+               border-color: #ccc;
+               border-style: solid;
+       }
+
+       #nav-menu-header {
+               border-width: 1px 1px 0 1px;
+               -moz-border-radius-topleft: 6px;
+               -webkit-border-top-left-radius: 6px;
+               -khtml-border-top-left-radius: 6px;
+               border-top-left-radius: 6px;
+               -moz-border-radius-topright: 6px;
+               -webkit-border-top-right-radius: 6px;
+               -khtml-border-top-right-radius: 6px;
+               border-top-right-radius: 6px;
+       }
+
+       #post-body {
+               background: #fff;
+               padding: 10px;
+               border-width: 0 1px 1px 1px;
+               -moz-border-radius-bottomleft: 6px;
+               -webkit-border-bottom-left-radius: 6px;
+               -khtml-border-bottom-left-radius: 6px;
+               border-bottom-left-radius: 6px;
+               -moz-border-radius-bottomright: 6px;
+               -webkit-border-bottom-right-radius: 6px;
+               -khtml-border-bottom-right-radius: 6px;
+               border-bottom-right-radius: 6px;
+       }
+
+       #post-body div.updated {
+               margin: 0;
+       }
+
+       #post-body-content {
+               position: relative;
+       }
+
+       #menu-management .menu-add-new abbr {
+               font-weight:bold;
+       }
+
+/* Menu Tabs */
+
+#menu-management .nav-tabs-nav {
+       margin: 0 20px;
+}
+
+#menu-management .nav-tabs-arrow {
+       width: 10px;
+       padding: 0 5px 4px;
+       cursor: pointer;
+       position: absolute;
+       top: 0;
+       line-height: 22px;
+       font-size: 18px;
+       text-shadow: 0 1px 0 #fff;
+}
+       #menu-management .nav-tabs-arrow a { color: #C1C1C1; }
+       #menu-management .nav-tabs-arrow a:hover { color: #D54E21; }
+       #menu-management .nav-tabs-arrow a:active { color: #464646; }
+       #menu-management .nav-tabs-arrow-left {
+               left: 0;
+       }
+       #menu-management .nav-tabs-arrow-right {
+               right: 0;
+               text-align: right;
+       }
+
+
+#menu-management .nav-tabs-wrapper {
+       width: 100%;
+       height: 28px;
+       margin-bottom: -1px;
+       overflow: hidden;
+}
+
+#menu-management .nav-tabs {
+       padding-left: 20px;
+       padding-right: 10px;
+}
+.js #menu-management .nav-tabs {
+       float: left;
+       margin-left: 0px;
+       margin-right: -400px;
+}
+
+#menu-management .nav-tab {
+       margin-bottom: 0;
+       background: #f4f4f4;
+       font-weight: bold;
+       border-color: #dfdfdf;
+}
+
+#menu-management .nav-tab-active {
+       border-color:#ccc;
+}
+
+#select-nav-menu-container {
+       text-align: right;
+       padding: 0 10px 3px 10px;
+       margin-bottom: 5px;
+}
+       #select-nav-menu {
+               width: 100px;
+               display: inline;
+       }
+
+#menu-name-label {
+       margin-top: -2px;
+}
+
+#wpbody .open-label {
+       display: block;
+       float:left;
+}
+#wpbody .open-label span {
+       padding-right: 10px;
+}
+
+       .js .input-with-default-title {
+               color: #aaa;
+               font-style: italic;
+       }
+
+#menu-management .inside { padding: 0 10px; }
+
+/* Add Menu Item Boxes */
+.postbox .howto input {
+       width: 180px;
+       float: right;
+}
+.customlinkdiv .howto input {
+       width: 210px;
+}
+#nav-menu-theme-locations .howto select {
+       width: 100%;
+}
+#nav-menu-theme-locations .button-controls {
+       text-align: right;
+}
+.add-menu-item-view-all {
+       height: 400px;
+}
+
+/* Button Primary Actions */
+#menu-container .submit { margin: 0px 0px 10px; padding: 0px; }
+
+.meta-sep,
+.submitdelete,
+.submitcancel {
+       display:block;
+       float:left;
+       font-size: 11px;
+       margin: 4px 0;
+       line-height: 15px;
+}
+.meta-sep {
+       padding: 0 2px;
+}
+
+#cancel-save { color: #ff0000; text-decoration: underline; font-size: 11px; margin-left: 20px; margin-top: 5px; }
+#cancel-save:hover { background-color: #FF0000; color: #fff; }
+
+/* Button Secondary Actions */
+.list-controls { float: left; margin-top: 5px; }
+.add-to-menu {
+       float: right;
+}
+
+.postbox img.waiting {
+       display: none;
+       vertical-align: middle;
+}
+
+.button-controls {
+       clear:both;
+       margin: 10px 0;
+}
+.show-all, .hide-all { cursor: pointer; }
+.hide-all { display: none; }
+
+/* Create Menu */
+#menu-name { width: 270px; }
+#manage-menu .inside { padding: 0px 0px; }
+
+/* Custom Links */
+#available-links dt { display: block; }
+#add-custom-link .howto { font-size: 11px; }
+#add-custom-link label span { display: block; float: left; margin-top: 5px; padding-right: 5px; }
+.menu-item-textbox { width: 180px; }
+.howto span { margin-top: 4px; display: block; float: left; }
+
+/* Menu item types */
+.quick-search { width: 190px; }
+.list-wrap { display: none; clear: both; margin-bottom: 10px; }
+.list-container { max-height: 200px; overflow-y: auto; padding: 10px 10px 5px; border: 1px solid #DFDFDF; -moz-border-radius: 4px; }
+.postbox p.submit { margin-bottom: 0; }
+
+/* Listings */
+.list li { display: none; margin: 0; margin-bottom: 5px; }
+
+.list li .menu-item-title { cursor: pointer; display: block; }
+.list li .menu-item-title input { margin-right: 3px; margin-top: -3px; }
+
+/* Nav Menu */
+#menu-container .inside { padding-bottom: 10px; }
+
+.menu {
+       padding-top:1em;
+}
+
+#menu-to-edit {
+       padding: 1em 0;
+}
+
+.menu ul {
+       width: 100%;
+}
+.menu ul.sub-menu {
+}
+.menu li {
+       margin-bottom: 0;
+       position:relative;
+}
+.menu-item-bar {
+       clear:both;
+       line-height:1.5em;
+       position:relative;
+       margin-top: 13px;
+}
+.menu-item-handle {
+       border: 1px solid #E6E6E6;
+       position: relative;
+       padding-left: 10px;
+       height: auto;
+       width: 400px;
+       line-height: 35px;
+       text-shadow: 0 1px 0 #FFFFFF;
+       font-weight:bold;
+       overflow: hidden;
+       border-radius: 6px;
+       -webkit-border-radius: 6px;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       word-wrap: break-word;
+}
+.menu-item-edit-active .menu-item-handle {
+       -moz-border-radius: 6px 6px 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;
+}
+.no-js .menu-item-edit-active .item-edit {
+       display: none;
+}
+.js .menu-item-handle {
+       cursor: move;
+}
+.menu li.deleting .menu-item-handle {
+       background-color: #f66;
+       background-image: none;
+       text-shadow: 0 0 0 #ccc;
+}
+
+.menu-item-handle .item-title {
+       padding: 7px 0;
+       line-height: 20px;
+       display:block;
+       margin-right:13em;
+}
+
+/* Sortables */
+li.menu-item.ui-sortable-helper dl {
+       margin-top: 0;
+}
+       li.menu-item.ui-sortable-helper .menu-item-transport dl {
+               margin-top: 13px;
+       }
+.menu .sortable-placeholder {
+       height: 35px;
+       width: 410px;
+       margin-top: 13px;
+}
+
+/* WARNING: The factor of 30px is hardcoded into the nav-menus javascript. */
+.menu-item-depth-0 { margin-left: 0px; }
+.menu-item-depth-1 { margin-left: 30px; }
+.menu-item-depth-2 { margin-left: 60px; }
+.menu-item-depth-3 { margin-left: 90px; }
+.menu-item-depth-4 { margin-left: 120px; }
+.menu-item-depth-5 { margin-left: 150px; }
+.menu-item-depth-6 { margin-left: 180px; }
+.menu-item-depth-7 { margin-left: 210px; }
+.menu-item-depth-8 { margin-left: 240px; }
+.menu-item-depth-9 { margin-left: 270px; }
+.menu-item-depth-10 { margin-left: 300px; }
+.menu-item-depth-11 { margin-left: 330px; }
+
+.menu-item-depth-0 .menu-item-transport { margin-left: 0px; }
+.menu-item-depth-1 .menu-item-transport { margin-left: -30px; }
+.menu-item-depth-2 .menu-item-transport { margin-left: -60px; }
+.menu-item-depth-3 .menu-item-transport { margin-left: -90px; }
+.menu-item-depth-4 .menu-item-transport { margin-left: -120px; }
+.menu-item-depth-5 .menu-item-transport { margin-left: -150px; }
+.menu-item-depth-6 .menu-item-transport { margin-left: -180px; }
+.menu-item-depth-7 .menu-item-transport { margin-left: -210px; }
+.menu-item-depth-8 .menu-item-transport { margin-left: -240px; }
+.menu-item-depth-9 .menu-item-transport { margin-left: -270px; }
+.menu-item-depth-10 .menu-item-transport { margin-left: -300px; }
+.menu-item-depth-11 .menu-item-transport { margin-left: -330px; }
+
+body.menu-max-depth-0 { min-width: 950px !important; }
+body.menu-max-depth-1 { min-width: 980px !important; }
+body.menu-max-depth-2 { min-width: 1010px !important; }
+body.menu-max-depth-3 { min-width: 1040px !important; }
+body.menu-max-depth-4 { min-width: 1070px !important; }
+body.menu-max-depth-5 { min-width: 1100px !important; }
+body.menu-max-depth-6 { min-width: 1130px !important; }
+body.menu-max-depth-7 { min-width: 1160px !important; }
+body.menu-max-depth-8 { min-width: 1190px !important; }
+body.menu-max-depth-9 { min-width: 1220px !important; }
+body.menu-max-depth-10 { min-width: 1250px !important; }
+body.menu-max-depth-11 { min-width: 1280px !important; }
+
+/* Menu item controls */
+.item-type { text-transform: uppercase; font-size: 11px; color: #999999; padding-right: 10px; }
+.item-controls { font-size: 11px; position: absolute; right: 20px; top: -1px; }
+.item-controls a { text-decoration: none; }
+.item-controls a:hover { cursor: pointer; }
+.item-controls .item-order { padding-right: 10px;}
+.item-controls .item-order a {
+       font-weight:bold;
+}
+
+body.js .item-order {
+       display:none;
+}
+
+.item-controls .menu-item-delete:hover { color: #ff0000; }
+
+.item-edit {
+       background: url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -105px;
+       position: absolute;
+       right: -20px;
+       top: 0;
+       display: block;
+       width: 23px;
+       height: 36px;
+       overflow: hidden;
+       text-indent:-999em;
+       border-bottom: 1px solid #eee;
+       -moz-border-radius-bottomleft: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       border-bottom-left-radius: 3px;
+}
+
+/* Menu editing */
+.menu-instructions-inactive {
+       display: none;
+}
+.menu-item-settings {
+       background: #F9F9F9;
+       display:block;
+       width: 400px;
+       padding: 10px 0 10px 10px;
+       border: solid #E6E6E6;
+       border-width: 0 1px 1px 1px;
+       -moz-border-radius: 0 0 6px 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;
+}
+.menu-item-edit-active .menu-item-settings {
+       display:block;
+}
+
+.menu-item-edit-inactive .menu-item-settings {
+       display:none;
+}
+
+.add-menu-item-pagelinks {
+       margin:.5em auto;
+       text-align:center;
+}
+
+.link-to-original {
+       display: block;
+       margin: 0 0 10px;
+       padding: 3px 5px 5px;
+       font-size: 11px;
+       color: #777;
+       font-style: italic;
+       border: 1px solid #dfdfdf;
+       border-radius: 6px;
+       -webkit-border-radius: 6px;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+}
+       .link-to-original a {
+               padding-left: 4px;
+               font-style: normal;
+       }
+
+.hidden-field {
+       display: none;
+}
+
+.menu-item-settings .description-thin,
+.menu-item-settings .description-wide {
+       margin-right: 10px;
+       float: left;
+}
+.description-thin {
+       width: 190px;
+       height: 40px;
+}
+.description-wide {
+       width: 390px;
+}
+
+.menu-item-actions {
+       padding-top: 15px;
+}
+
+#cancel-save { cursor: pointer; }
+#cancel-save:hover { color: #fff !important; }
+#update-menu-item { color: #fff !important; }
+#update-menu-item:hover,
+#update-menu-item:active,
+#update-menu-item:focus { color: #eaf2fa !important; border-color: #13455b !important; }
+
+/* Major/minor publishing actions (classes) */
+.major-publishing-actions {
+       clear:both;
+       padding: 5px 10px;
+}
+.major-publishing-actions .publishing-action {
+       text-align: right;
+       float: right;
+       line-height: 23px;
+       margin: 5px 0 1px;
+}
+.major-publishing-actions .delete-action {
+       vertical-align: middle;
+       text-align: left;
+       float: left;
+       padding-right: 15px;
+       margin-top: 5px;
+}
+.menu-name-label span, .auto-add-pages label {
+       font-size: 11px;
+       font-style: normal;
+}
+.menu-name-label {
+       margin-right: 15px;
+}
+.auto-add-pages input {
+       margin-top: 0;
+}
+.auto-add-pages {
+       margin-top: 4px;
+       float: left;
+}
+.submitbox .submitcancel {
+       color: #21759B;
+       border-bottom: 1px solid #21759B;
+       padding: 1px 2px;
+       text-decoration: none;
+}
+.submitbox .submitcancel:hover {
+       background: #21759B;
+       color: #fff;
+}
+
+.major-publishing-actions .form-invalid {
+       border-radius: 4px;
+       -webkit-border-radius: 4px;
+       -moz-border-radius: 4px;
+       -khtml-border-radius: 4px;
+       padding-left: 4px;
+       margin-left: -4px;
+}
+
+/* Clearfix */
+#menu-item-name-wrap:after,
+#menu-item-url-wrap:after,
+#menu-name-label:after,
+#menu-settings-column .inside:after,
+#nav-menus-frame:after,
+#post-body-content:after,
+.button-controls:after,
+.major-publishing-actions:after,
+.menu-item-settings:after {
+       clear: both;
+       content: ".";
+       display: block;
+       height: 0;
+       visibility: hidden;
+}
+#nav-menus-frame, .button-controls, #menu-item-url-wrap, #menu-item-name-wrap { display: block; }
index 9a6dd11d5c7dbe884dc6f447f9081111bd90c996..f1ade77e6937de82a7175d0880b5dea6a12ffe85 100644 (file)
@@ -1,43 +1 @@
-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;
-}
+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;}
\ No newline at end of file
diff --git a/wp-admin/css/plugin-install-rtl.dev.css b/wp-admin/css/plugin-install-rtl.dev.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;
+}
index defbb4f289f144928f35b229a208c92c0c057af5..a5c278258614c2389e8189c2afe6227131f73d3e 100644 (file)
@@ -1 +1 @@
-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;}#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;}#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-bottom-left-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:0 10px 50px;width:210px;}#plugin-information .fyi h2{font-size:.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-bottom-left-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
+div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.action-links{font-weight:normal;margin:6px 0 0;}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;}table#install-plugins th.num{white-space:nowrap;}#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;}#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-bottom-left-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:0 10px 50px;width:210px;}#plugin-information .fyi h2{font-size:.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-bottom-left-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
index 87fc417c1bd63202d9bca200ba352384e83411ec..368f953cf26e153e1a5e68164b291d5449dd4e04 100644 (file)
@@ -6,6 +6,11 @@ div.star-holder {
        font-size: 19px;
 }
 
+div.action-links {
+       font-weight: normal;
+       margin: 6px 0 0;
+}
+
 div.star {
        height: 100%;
        position: absolute;
@@ -37,7 +42,11 @@ div.star img {
        border-right: 1px solid #fff;
 }
 
-/* Start custom CSS */
+/* Table layout CSS */
+table#install-plugins th.num {
+       white-space: nowrap; /* Prevents long plugin titles from causing the version column to wrap */
+}
+
 /* Header on thickbox */
 #plugin-information-header {
        margin: 0;
index 9f4a37ef92dc951c2c265109a3fceadc5cd1700b..0f378c622251addb1aa660895980671b79ddb385 100644 (file)
@@ -1,128 +1 @@
-body {
-       font-family: Tahoma, Arial;
-}
-
-#poststuff #edButtonPreview,
-#poststuff #edButtonHTML {
-       margin: 0 0 0 5px;
-       float: right;
-}
-
-/* Editor/Main Column */
-div#poststuff {
-       padding-left: 0;
-       padding-right: 10px;
-}
-
-.posting {
-       margin-right: 0;
-       margin-left: 228px;
-       left: auto;
-       right: 0;
-}
-
-#side-info-column {
-       float: left;
-       right: auto;
-       left: 0;
-       margin-right: 0;
-       margin-left: 10px;
-}
-
-#side-info-column .sleeve {
-       padding-left: 0;
-       padding-right: 10px;
-}
-
-h3.tb {
-       margin-left: 0;
-       margin-right: 5px;
-}
-
-#actions {
-       float: left;
-}
-
-#extra_fields #actions {
-       right: auto;
-       left: 4px;
-}
-
-#actions li {
-       float: right;
-       margin-right: 0;
-       margin-left: 10px;
-}
-
-#extra_fields .button {
-       margin-right: 0;
-       margin-left: 5px;
-}
-
-/* Photo Styles */
-#img_container a {
-       float: right;
-}
-
-#category-add input, #category-add select {
-       font-family: Tahoma, Arial;
-}
-
-#categorydiv ul.categorychecklist ul {
-       margin-left: 0;
-       margin-right: 18px;
-}
-
-/* Tags */
-#tagsdiv #newtag {
-       margin-right: 0;
-       margin-left: 5px;
-}
-
-#tagadd {
-       margin-left: 0;
-       margin-right: 3px;
-}
-
-#tagchecklist span {
-       margin-left: .5em;
-       margin-right: 10px;
-       float: right;
-}
-#tagchecklist span a {
-       margin: 6px -9px 0 0;
-       float: right;
-}
-
-#content {
-       margin-left: 0;
-       margin-right: 1%;
-}
-
-.submit input,
-.button,
-.button-primary,
-.button-secondary,
-.button-highlighted,
-#postcustomstuff .submit input {
-       font-family: Tahoma, Arial, sans-serif;
-}
-
-.ac_results li {
-       text-align: right;
-}
-
-#TB_ajaxContent #options {
-       right: auto;
-       left: 25px;
-}
-
-#post_status {
-       margin-left: 0;
-       margin-right: 10px;
-}
-
-/* Footer */
-#footer {
-       padding: 10px 60px 0 0;
-}
+body{font-family:Tahoma,Arial;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{margin:0 0 0 5px;float:right;}div#poststuff{padding-left:0;padding-right:10px;}.posting{margin-right:0;margin-left:228px;left:auto;right:0;}#side-info-column{float:left;right:auto;left:0;margin-right:0;margin-left:10px;}#side-info-column .sleeve{padding-left:0;padding-right:10px;}h3.tb{margin-left:0;margin-right:5px;}#actions{float:left;}#extra_fields #actions{right:auto;left:4px;}#actions li{float:right;margin-right:0;margin-left:10px;}#extra_fields .button{margin-right:0;margin-left:5px;}#img_container a{float:right;}#category-add input,#category-add select{font-family:Tahoma,Arial;}.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:0;margin-right:18px;}#tagsdiv #newtag{margin-right:0;margin-left:5px;}#tagadd{margin-left:0;margin-right:3px;}#tagchecklist span{margin-left:.5em;margin-right:10px;float:right;}#tagchecklist span a{margin:6px -9px 0 0;float:right;}#content{margin-left:0;margin-right:1%;}.submit input,.button,.button-primary,.button-secondary,.button-highlighted,#postcustomstuff .submit input{font-family:Tahoma,Arial,sans-serif;}.ac_results li{text-align:right;}#TB_ajaxContent #options{right:auto;left:25px;}#post_status{margin-left:0;margin-right:10px;}#footer{padding:10px 60px 0 0;}
\ No newline at end of file
diff --git a/wp-admin/css/press-this-rtl.dev.css b/wp-admin/css/press-this-rtl.dev.css
new file mode 100644 (file)
index 0000000..b056591
--- /dev/null
@@ -0,0 +1,130 @@
+body {
+       font-family: Tahoma, Arial;
+}
+
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
+       margin: 0 0 0 5px;
+       float: right;
+}
+
+/* Editor/Main Column */
+div#poststuff {
+       padding-left: 0;
+       padding-right: 10px;
+}
+
+.posting {
+       margin-right: 0;
+       margin-left: 228px;
+       left: auto;
+       right: 0;
+}
+
+#side-info-column {
+       float: left;
+       right: auto;
+       left: 0;
+       margin-right: 0;
+       margin-left: 10px;
+}
+
+#side-info-column .sleeve {
+       padding-left: 0;
+       padding-right: 10px;
+}
+
+h3.tb {
+       margin-left: 0;
+       margin-right: 5px;
+}
+
+#actions {
+       float: left;
+}
+
+#extra_fields #actions {
+       right: auto;
+       left: 4px;
+}
+
+#actions li {
+       float: right;
+       margin-right: 0;
+       margin-left: 10px;
+}
+
+#extra_fields .button {
+       margin-right: 0;
+       margin-left: 5px;
+}
+
+/* Photo Styles */
+#img_container a {
+       float: right;
+}
+
+#category-add input, #category-add select {
+       font-family: Tahoma, Arial;
+}
+
+.inline-editor ul.cat-checklist ul,
+.categorydiv ul.categorychecklist ul,
+#linkcategorydiv ul.categorychecklist ul {
+       margin-left: 0;
+       margin-right: 18px;
+}
+
+/* Tags */
+#tagsdiv #newtag {
+       margin-right: 0;
+       margin-left: 5px;
+}
+
+#tagadd {
+       margin-left: 0;
+       margin-right: 3px;
+}
+
+#tagchecklist span {
+       margin-left: .5em;
+       margin-right: 10px;
+       float: right;
+}
+#tagchecklist span a {
+       margin: 6px -9px 0 0;
+       float: right;
+}
+
+#content {
+       margin-left: 0;
+       margin-right: 1%;
+}
+
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       font-family: Tahoma, Arial, sans-serif;
+}
+
+.ac_results li {
+       text-align: right;
+}
+
+#TB_ajaxContent #options {
+       right: auto;
+       left: 25px;
+}
+
+#post_status {
+       margin-left: 0;
+       margin-right: 10px;
+}
+
+/* Footer */
+#footer {
+       padding: 10px 60px 0 0;
+}
index 46590f3cd37978e56c4591badfa64ba1ff458179..8c72aa775460de3748e7641d9a52510ac4d5c5a5 100644 (file)
@@ -1 +1 @@
-body{font:13px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;color:#333;margin:0;padding:0;min-width:675px;min-height:400px;}img{border:none;}#wphead{border-top:none;padding-top:4px;background:#444!important;}.tagchecklist span a{background:transparent url(../images/xit.gif) no-repeat 0 0;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;border-style:solid;border-width:1px;cursor:pointer;display:block;height:18px;margin:0 5px 0 0;padding:0 5px 0;font-size:10px;line-height:18px;float:left;}.howto{margin-top:2px;margin-bottom:3px;font-size:11px;font-style:italic;display:block;}input.text{outline-color:-moz-use-text-color;outline-style:none;outline-width:medium;width:100%;}#message{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}div#poststuff{margin:10px;}div.zerosize{border:0 none;height:0;margin:0;overflow:hidden;padding:0;width:0;}#poststuff #edButtonPreview.active,#poststuff #edButtonHTML.active{display:none;}.posting{margin-right:212px;position:relative;}#side-info-column{float:right;width:200px;position:relative;right:0;}#side-info-column .sleeve{padding-top:5px;}#poststuff .inside{font-size:11px;margin:8px;}#poststuff h2,#poststuff h3{font-size:12px;font-weight:bold;line-height:1;margin:0;padding:7px 9px;}#tagsdiv-post_tag h3,#categorydiv h3{cursor:pointer;}h3.tb{text-shadow:0 1px 0 #fff;font-weight:bold;font-size:12px;margin-left:5px;}#TB_window{border:1px solid #333;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.postbox,.stuffbox{margin-bottom:10px;border-width:1px;border-style:solid;line-height:1;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.stuffbox:hover .handlediv{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;}.handlediv{float:right;height:26px;width:23px;}#title,.tbtitle{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border-style:solid;border-width:1px;font-size:1.7em;outline:none;padding:3px 4px;border-color:#dfdfdf;}.tbtitle{font-size:12px;padding:3px;}#title{width:97%;}.editor-container{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #dfdfdf;background-color:#fff;}.postdivrich{padding-top:25px;position:relative;}.actions{float:right;margin:-19px 0 0;}#extra-fields .actions{margin:-15px -5px 0 0;}.actions li{float:left;list-style:none;margin-right:10px;}#extra-fields .button{margin-right:5px;padding:3px 6px;border-radius:10px;-webkit-border-radius:10px;-khtml-border-radius:10px;-moz-border-radius:10px;}.photolist{margin-top:-10px;}#photo_saving{margin:0 8px 8px;vertical-align:middle;}#img_container{background-color:#fff;}#img_container_container{overflow:auto;}#extra-fields{margin-top:10px;position:relative;}#waiting{margin-top:10px;}#extra-fields .postbox{margin-bottom:5px;}#extra-fields .titlewrap{padding:0;overflow:auto;height:100px;}#img_container a{display:block;float:left;overflow:hidden;vertical-align:center;}#img_container img,#img_container a{width:68px;height:68px;}#img_container img{border:none;background-color:#f4f4f4;cursor:pointer;}#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;}#embed-code{width:100%;height:98px;}#viewsite{padding:0;margin:0 0 20px 5px;font-size:10px;clear:both;}.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;height:2em;line-height:20px;padding:2px;margin:1px;vertical-align:top;}#category-add input,#category-add-sumbit{width:auto;}#categorydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}#categorydiv ul.categorychecklist ul{margin-left:18px;}#categorydiv div.tabs-panel{height:140px;overflow:auto;}ul.categorychecklist li{margin:0;padding:0;line-height:19px;}.screen-reader-text{display:none;}.tagsdiv .newtag{margin-right:5px;}.jaxtag{clear:both;margin:0;}.tagadd{margin-left:3px;}.tagchecklist{margin-top:3px;margin-bottom:1em;font-size:12px;overflow:auto;}.tagchecklist strong{position:absolute;font-size:.75em;}.tagchecklist span{margin-right:.5em;margin-left:10px;display:block;float:left;font-size:11px;line-height:1.8em;white-space:nowrap;cursor:default;}.tagchecklist span a{margin:6px 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}#content{margin:5px 0;padding:0 5px;border:0 none;height:365px;width:97%!important;}* html .postdivrich{zoom:1;}#saving{display:inline;vertical-align:middle;}.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;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;}.button-primary{background:#21759B url(../images/button-grad.png) repeat-x scroll left top;border-color:#21759B;color:#fff;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#TB_ajaxContent #options{position:absolute;top:20px;right:25px;padding:5px;}#TB_ajaxContent h3{margin-bottom:.25em;}.updated{margin:10px 0;padding:0;border-width:1px;border-style:solid;width:99%;}.updated p,.error p{margin:.6em 0;padding:0 .6em;}.error a{text-decoration:underline;}.updated a{text-decoration:none;padding-bottom:2px;}#post_status{margin-left:10px;margin-bottom:1em;display:block;}#footer{height:65px;display:block;width:640px;padding:10px 0 0 60px;margin:0;position:absolute;bottom:0;font-size:12px;}#footer p{margin:0;padding:7px 0;}#footer p a{text-decoration:none;}#footer p a:hover{text-decoration:underline;}.centered{text-align:center;}.hidden{display:none;}.postbox input[type="text"],.postbox textarea,.stuffbox input[type="text"],.stuffbox textarea{border-width:1px;border-style:solid;}.taghint{color:#aaa;margin:-17px 0 0 7px;visibility:hidden;}input.newtag ~ div.taghint{visibility:visible;}input.newtag:focus ~ div.taghint{visibility:hidden;}
\ No newline at end of file
+body{font:13px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;color:#333;margin:0;padding:0;min-width:675px;min-height:400px;}img{border:none;}#wphead{border-top:none;padding-top:4px;background:#444!important;}.tagchecklist span a{background:transparent url(../images/xit.gif) no-repeat 0 0;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;border-style:solid;border-width:1px;cursor:pointer;display:block;height:18px;margin:0 5px 0 0;padding:0 5px 0;font-size:10px;line-height:18px;float:left;}.howto{margin-top:2px;margin-bottom:3px;font-size:11px;font-style:italic;display:block;}input.text{outline-color:-moz-use-text-color;outline-style:none;outline-width:medium;width:100%;}#message{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}div#poststuff{margin:10px;}div.zerosize{border:0 none;height:0;margin:0;overflow:hidden;padding:0;width:0;}#poststuff #edButtonPreview.active,#poststuff #edButtonHTML.active{display:none;}.posting{margin-right:212px;position:relative;}#side-info-column{float:right;width:200px;position:relative;right:0;}#side-info-column .sleeve{padding-top:5px;}#poststuff .inside{font-size:11px;margin:8px;}#poststuff h2,#poststuff h3{font-size:12px;font-weight:bold;line-height:1;margin:0;padding:7px 9px;}#tagsdiv-post_tag h3,#categorydiv h3{cursor:pointer;}h3.tb{text-shadow:0 1px 0 #fff;font-weight:bold;font-size:12px;margin-left:5px;}#TB_window{border:1px solid #333;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.postbox,.stuffbox{margin-bottom:10px;border-width:1px;border-style:solid;line-height:1;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.postbox:hover .handlediv,.stuffbox:hover .handlediv{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;}.handlediv{float:right;height:26px;width:23px;}#title,.tbtitle{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border-style:solid;border-width:1px;font-size:1.7em;outline:none;padding:3px 4px;border-color:#dfdfdf;}.tbtitle{font-size:12px;padding:3px;}#title{width:97%;}.editor-container{-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #dfdfdf;background-color:#fff;}.postdivrich{padding-top:25px;position:relative;}.actions{float:right;margin:-19px 0 0;}#extra-fields .actions{margin:-15px -5px 0 0;}.actions li{float:left;list-style:none;margin-right:10px;}#extra-fields .button{margin-right:5px;padding:3px 6px;border-radius:10px;-webkit-border-radius:10px;-khtml-border-radius:10px;-moz-border-radius:10px;}.photolist{margin-top:-10px;}#photo_saving{margin:0 8px 8px;vertical-align:middle;}#img_container{background-color:#fff;}#img_container_container{overflow:auto;}#extra-fields{margin-top:10px;position:relative;}#waiting{margin-top:10px;}#extra-fields .postbox{margin-bottom:5px;}#extra-fields .titlewrap{padding:0;overflow:auto;height:100px;}#img_container a{display:block;float:left;overflow:hidden;vertical-align:center;}#img_container img,#img_container a{width:68px;height:68px;}#img_container img{border:none;background-color:#f4f4f4;cursor:pointer;}#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;}#embed-code{width:100%;height:98px;}#viewsite{padding:0;margin:0 0 20px 5px;font-size:10px;clear:both;}.wp-hidden-children .wp-hidden-child{display:none;}.category-add input{width:94%;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;font-size:12px;margin:1px;}.category-add select{width:100%;-x-system-font:none;border-style:solid;border-width:1px;font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-size:11px;height:2em;line-height:20px;padding:2px;margin:1px;vertical-align:top;}.category-add input.category-add-sumbit{width:auto;}.categorydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:100px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}.category-tabs li{display:inline;padding-right:8px;}.category-tabs a{text-decoration:none;}.categorydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:18px;}ul.categorychecklist li{margin:0;padding:0;line-height:19px;}.categorydiv .tabs-panel{border-width:3px;border-style:solid;}ul.category-tabs{margin-top:12px;margin-bottom:6px;}ul.category-tabs li.tabs{border-style:solid solid none;border-width:1px 1px 0;}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;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;}.screen-reader-text{display:none;}.tagsdiv .newtag{margin-right:5px;}.jaxtag{clear:both;margin:0;}.tagadd{margin-left:3px;}.tagchecklist{margin-top:3px;margin-bottom:1em;font-size:12px;overflow:auto;}.tagchecklist strong{position:absolute;font-size:.75em;}.tagchecklist span{margin-right:.5em;margin-left:10px;display:block;float:left;font-size:11px;line-height:1.8em;white-space:nowrap;cursor:default;}.tagchecklist span a{margin:6px 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}#content{margin:5px 0;padding:0 5px;border:0 none;height:365px;width:97%!important;}* html .postdivrich{zoom:1;}#saving{display:inline;vertical-align:middle;}.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;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;}.button-primary{background:#21759B url(../images/button-grad.png) repeat-x scroll left top;border-color:#21759B;color:#fff;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#TB_ajaxContent #options{position:absolute;top:20px;right:25px;padding:5px;}#TB_ajaxContent h3{margin-bottom:.25em;}.updated{margin:10px 0;padding:0;border-width:1px;border-style:solid;width:99%;}.updated p,.error p{margin:.6em 0;padding:0 .6em;}.error a{text-decoration:underline;}.updated a{text-decoration:none;padding-bottom:2px;}#post_status{margin-left:10px;margin-bottom:1em;display:block;}#footer{height:65px;display:block;width:640px;padding:10px 0 0 60px;margin:0;position:absolute;bottom:0;font-size:12px;}#footer p{margin:0;padding:7px 0;}#footer p a{text-decoration:none;}#footer p a:hover{text-decoration:underline;}.centered{text-align:center;}.hidden{display:none;}.postbox input[type="text"],.postbox textarea,.stuffbox input[type="text"],.stuffbox textarea{border-width:1px;border-style:solid;}.taghint{color:#aaa;margin:-17px 0 0 7px;visibility:hidden;}input.newtag ~ div.taghint{visibility:visible;}input.newtag:focus ~ div.taghint{visibility:hidden;}
\ No newline at end of file
index 4bb4d5c13e93372ba46c7e89f620c68bfd359a49..a72ea3e6283d565a42e170f0654b481c02ff3ad9 100644 (file)
@@ -1,4 +1,3 @@
-
 body {
        font: 13px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
        color: #333;
@@ -146,8 +145,9 @@ h3.tb {
        border-radius: 6px;
 }
 
+.postbox:hover .handlediv,
 .stuffbox:hover .handlediv {
-    background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
 }
 
 .handlediv {
@@ -308,29 +308,22 @@ h3.tb {
        display: none;
 }
 
-#category-adder {
-       padding: 4px 0;
-}
-
-#category-adder h4 {
-       margin: 0 0 8px;
-}
+/* Categories */
 
-#category-add input {
+.category-add input {
        width: 94%;
-       font-family: Verdana,Arial,Helvetica,sans-serif;
-       font-size: 13px;
+       font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
+       font-size: 12px;
        margin: 1px;
-       padding: 3px;
 }
 
-#category-add select {
-       width: 70%;
+.category-add select {
+       width: 100%;
        -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: 11px;
        height: 2em;
        line-height: 20px;
        padding: 2px;
@@ -338,34 +331,73 @@ h3.tb {
        vertical-align: top;
 }
 
-#category-add input,
-#category-add-sumbit {
+.category-add input.category-add-sumbit {
        width: auto;
 }
 
-/* Categories */
-#categorydiv ul,
+.categorydiv div.tabs-panel,
+#linkcategorydiv div.tabs-panel {
+       height: 100px;
+       overflow: auto;
+       padding: 0.5em 0.9em;
+       border-style: solid;
+       border-width: 1px;
+}
+
+.category-tabs li {
+       display: inline;
+       padding-right: 8px;
+}
+
+.category-tabs a {
+       text-decoration: none;
+}
+
+.categorydiv ul,
 #linkcategorydiv ul {
        list-style: none;
        padding: 0;
        margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul {
+.inline-editor ul.cat-checklist ul,
+.categorydiv ul.categorychecklist ul,
+#linkcategorydiv ul.categorychecklist ul {
        margin-left: 18px;
 }
 
-#categorydiv div.tabs-panel {
-       height: 140px;
-       overflow: auto;
-}
-
 ul.categorychecklist li {
        margin: 0;
        padding: 0;
        line-height: 19px;
 }
 
+.categorydiv .tabs-panel {
+       border-width: 3px;
+       border-style: solid;
+}
+
+ul.category-tabs {
+       margin-top: 12px;
+       margin-bottom: 6px;
+}
+
+ul.category-tabs li.tabs {
+       border-style: solid solid none;
+       border-width: 1px 1px 0;
+}
+
+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;
+       -khtml-border-top-left-radius: 3px;
+       -khtml-border-top-right-radius: 3px;
+       border-top-left-radius: 3px;
+       border-top-right-radius: 3px;
+}
+
 /* Tags */
 .screen-reader-text {
        display: none;
index a4dcb46ebb9b533870ccff1eba2063b88a48175b..23023dfff5698f102182477c229d1415c5f8eaf6 100644 (file)
@@ -1,3 +1 @@
-#templateside {
-       float: left;
-}
+#templateside{float: left;}
diff --git a/wp-admin/css/theme-editor-rtl.dev.css b/wp-admin/css/theme-editor-rtl.dev.css
new file mode 100644 (file)
index 0000000..a4dcb46
--- /dev/null
@@ -0,0 +1,3 @@
+#templateside {
+       float: left;
+}
index c0bb2dcb60bc9020939eb151a96e596487944aaa..fdfdbbee7ff9f735d3bdeb1eda9778de92e9b7a5 100644 (file)
@@ -1 +1 @@
-#template textarea{font-family:Consolas,Monaco,Courier,monospace;font-size:12px;width:97%;}#template p{width:97%;}#templateside{float:right;width:190px;word-wrap:break-word;}#templateside h3,#postcustomstuff p.submit{margin:0;}#templateside h4{margin:1em 0 0;}#templateside ol,#templateside ul{margin:.5em;padding:0;}#templateside li{margin:4px 0;}.nonessential{font-size:small;}.highlight{padding:1px;}div.tablenav{margin-right:210px;}#documentation{margin-top:10px;}#documentation label{line-height:22px;vertical-align:top;font-weight:bold;}.fileedit-sub{padding:10px 0 8px;line-height:180%;}
\ No newline at end of file
+#template textarea{font-family:Consolas,Monaco,Courier,monospace;font-size:12px;width:97%;}#template p{width:97%;}#templateside{float:right;width:190px;word-wrap:break-word;}#templateside h3,#postcustomstuff p.submit{margin:0;}#templateside h4{margin:1em 0 0;}#templateside ol,#templateside ul{margin:.5em;padding:0;}#templateside li{margin:4px 0;}#templateside ul li a span.highlight{display:block;}.nonessential{font-size:11px;font-style:italic;padding-left:12px;}.highlight{padding:3px 3px 3px 12px;margin-left:-12px;font-weight:bold;-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;}div.tablenav{margin-right:210px;}#documentation{margin-top:10px;}#documentation label{line-height:22px;vertical-align:top;font-weight:bold;}.fileedit-sub{padding:10px 0 8px;line-height:180%;}
\ No newline at end of file
index 0a2a554e0b512817a90815bb0f3d9a9660048f36..17546493c10e80c89044bebd28f9d392f6698c0b 100644 (file)
        margin: 4px 0;
 }
 
+#templateside ul li a span.highlight {
+       display:block;
+}
+
 .nonessential {
-       font-size: small;
+       font-size: 11px;
+       font-style: italic;
+       padding-left: 12px;
 }
 
 .highlight {
-       padding: 1px;
+       padding: 3px 3px 3px 12px;
+       margin-left: -12px;
+       font-weight: bold;
+       -moz-border-radius: 8px;
+       -khtml-border-radius: 8px;
+       -webkit-border-radius: 8px;
+       border-radius: 8px;
 }
 
 div.tablenav {
index 6ce9918b73c8273b712be5595dbb4af8c8750a72..a54afc74a27670262cbe2e2835dd6de27db2d834 100644 (file)
@@ -1 +1 @@
-div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;border-left:1px solid #fff;border-right:1px solid #fff;}.theme-listing .theme-item{display:inline-block;width:200px;border:thin solid #ccc;vertical-align:top;}.theme-listing .theme-item h3{text-align:center;font-size:14px;font-style:italic;margin:0;padding:0;}.theme-listing .theme-item img{max-width:150px;max-height:150px;}.theme-listing .theme-item-info span{display:none;}.theme-listing .theme-item:hover .theme-item-info span{display:inline;}.theme-listing .theme-item:hover .theme-item-info span.dots{display:none;}.theme-listing .theme-item-info span.action-links{font-weight:bold;text-align:center;}.theme-listing br.line{border-bottom-width:1px;border-bottom-style:solid;margin-bottom:3px;}.available-theme{padding:20px 15px;}#theme-information .theme-preview-img{float:left;margin:5px 25px 10px 15px;width:300px;}#theme-information .action-button{border-top-width:1px;border-top-style:solid;margin:10px 5px 20px;}#theme-information .action-button #cancel{float:left;margin:10px 15px;}#theme-information .action-button #install{float:right;margin:10px 15px;}#theme-information .available-theme h3{margin:1em 0;}body#theme-information{height:auto;}.feature-filter{-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border-width:1px;border-style:solid;padding:8px 12px 0;}.feature-filter .feature-group{float:left;margin-bottom:20px;width:695px;}.feature-filter .feature-name{float:left;text-align:right;width:95px;}.feature-filter .feature-group li{display:inline;float:left;list-style-type:none;padding-right:25px;min-width:145px;}
\ No newline at end of file
+div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;border-left:1px solid #fff;border-right:1px solid #fff;}.theme-listing .theme-item{display:inline-block;width:200px;border:thin solid #ccc;vertical-align:top;}.theme-listing .theme-item h3{text-align:center;font-size:14px;font-style:italic;margin:0;padding:0;}.theme-listing .theme-item img{max-width:150px;max-height:150px;}.theme-listing .theme-item-info span{display:none;}.theme-listing .theme-item:hover .theme-item-info span{display:inline;}.theme-listing .theme-item:hover .theme-item-info span.dots{display:none;}.theme-listing .theme-item-info span.action-links{font-weight:bold;text-align:center;}.theme-listing br.line{border-bottom-width:1px;border-bottom-style:solid;margin-bottom:3px;}.available-theme{padding:20px 15px;}#theme-information .theme-preview-img{float:left;margin:5px 25px 10px 15px;width:300px;}#theme-information .action-button{border-top-width:1px;border-top-style:solid;margin:10px 5px 0;}#theme-information .action-button #cancel{float:left;margin:10px 15px;}#theme-information .action-button #install{float:right;margin:10px 15px;}#theme-information .available-theme h3{margin:1em 0;}body#theme-information{height:auto;}.feature-filter{-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border-width:1px;border-style:solid;padding:8px 12px 0;}.feature-filter .feature-group{float:left;margin-bottom:20px;width:695px;}.feature-filter .feature-name{float:left;text-align:right;width:95px;}.feature-filter .feature-group li{display:inline;float:left;list-style-type:none;padding-right:25px;min-width:145px;}
\ No newline at end of file
index 576dec4b41e4c8e10dd8b70062623f31d378bb88..12f0579ef417d567e7f870e289f2f21b9c0b0475 100644 (file)
@@ -60,12 +60,15 @@ div.star img {
 .theme-listing .theme-item-info span {
        display: none;
 }
+
 .theme-listing .theme-item:hover .theme-item-info span {
        display: inline;
 }
+
 .theme-listing .theme-item:hover .theme-item-info span.dots {
        display: none;
 }
+
 .theme-listing .theme-item-info span.action-links {
        font-weight: bold;
        text-align: center;
@@ -90,7 +93,7 @@ div.star img {
 #theme-information .action-button {
        border-top-width: 1px;
        border-top-style: solid;
-       margin: 10px 5px 20px;
+       margin: 10px 5px 0;
 }
 
 #theme-information .action-button #cancel {
index b3499722254641a5968a642b4ace86d542265623..4825066c1b1980dc2f90bc7dc1c6793d2896545e 100644 (file)
@@ -1,11 +1 @@
-
-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;
-       margin-left: 8px;
-       float: right;
-}
+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;margin-left:8px;float:right;}
\ No newline at end of file
diff --git a/wp-admin/css/widgets-rtl.dev.css b/wp-admin/css/widgets-rtl.dev.css
new file mode 100644 (file)
index 0000000..ffb266d
--- /dev/null
@@ -0,0 +1,10 @@
+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;
+       margin-left: 8px;
+       float: right;
+}
index bd15ffa4493184ccb2a6a2905ef2eb93d9c268eb..44eb420ead57ce81c482415d14068273510ea74f 100644 (file)
@@ -1 +1 @@
-html,body{min-width:950px;}div.widget-liquid-left{float:left;clear:left;width:100%;margin-right:-325px;}div#widgets-left{margin-left:5px;margin-right:325px;}div#widgets-right{width:285px;margin:0 auto;}div.widget-liquid-right{float:right;clear:right;width:300px;}.widget-liquid-right .widget,#wp_inactive_widgets .widget,.widget-liquid-right .sidebar-description{width:250px;margin:0 auto 20px;overflow:hidden;}.widget-liquid-right .sidebar-description{margin-bottom:10px;}#wp_inactive_widgets .widget{margin:0 10px 20px;float:left;}div.sidebar-name h3{margin:0;padding:5px 12px;font-size:13px;height:19px;overflow:hidden;white-space:nowrap;}div.sidebar-name{background-repeat:repeat-x;background-position:0 0;cursor:pointer;font-size:13px;border-width:1px;border-style:solid;-moz-border-radius-topleft:8px;-moz-border-radius-topright:8px;-webkit-border-top-right-radius:8px;-webkit-border-top-left-radius:8px;-khtml-border-top-right-radius:8px;-khtml-border-top-left-radius:8px;border-top-right-radius:8px;border-top-left-radius:8px;}.js .closed .sidebar-name{-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;-khtml-border-bottom-right-radius:8px;-khtml-border-bottom-left-radius:8px;border-bottom-right-radius:8px;border-bottom-left-radius:8px;}.widget-liquid-right .widgets-sortables,#widgets-left .widget-holder{border-width:0 1px 1px;border-style:none solid solid;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;-khtml-border-bottom-right-radius:8px;-khtml-border-bottom-left-radius:8px;border-bottom-right-radius:8px;border-bottom-left-radius:8px;}.js .closed .widgets-sortables,.js .closed .widget-holder{display:none;}.widget-liquid-right .widgets-sortables{padding:15px 0 0;}#available-widgets .widget-holder{padding:7px 5px 0;}#wp_inactive_widgets{padding:5px 5px 0;}#widget-list .widget{width:250px;margin:0 10px 15px;border:0 none;float:left;}#widget-list .widget-description{padding:5px 8px;}#widget-list .widget-top{border-width:1px;border-style:solid;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.widget-placeholder{border-width:1px;border-style:dashed;margin:0 auto 20px;height:26px;width:250px;}#wp_inactive_widgets .widget-placeholder{margin:0 10px 20px;float:left;}div.widgets-holder-wrap{padding:0;margin:10px 0 20px;}#widgets-left #available-widgets{background-color:transparent;border:0 none;}ul#widget-list{list-style:none;margin:0;padding:0;min-height:100px;}.widget .widget-top{font-size:12px;font-weight:bold;height:26px;overflow:hidden;}.widget-top .widget-title{padding:5px 9px;}.widget-top .widget-title-action{float:right;}a.widget-action{display:block;width:24px;height:26px;}#available-widgets a.widget-action{display:none;}.widget-top a.widget-action{background:url("../images/menu-bits.gif") no-repeat scroll 0 -110px;}.widget .widget-inside,.widget .widget-description{padding:12px 12px 10px;font-size:11px;line-height:16px;}.widget-inside,.widget-description{display:none;}#available-widgets .widget-description{display:block;}.widget .widget-inside p{margin:0 0 1em;padding:0;}.widget-title h4{margin:0;line-height:1.3;overflow:hidden;white-space:nowrap;}.widgets-sortables{min-height:90px;}.widget-control-actions{margin-top:8px;}.widget-control-actions a{text-decoration:none;}.widget-control-actions a:hover{text-decoration:underline;}.widget-control-actions .ajax-feedback{padding-bottom:3px;}.widget-control-actions div.alignleft{margin-top:6px;}div#sidebar-info{padding:0 1em;margin-bottom:1em;font-size:11px;}.widget-title a,.widget-title a:hover{text-decoration:none;border-bottom:none;}.widget-control-edit{display:block;font-size:11px;font-weight:normal;line-height:26px;padding:0 8px 0 0;}a.widget-control-edit{text-decoration:none;}.widget-control-edit .add,.widget-control-edit .edit{display:none;}#available-widgets .widget-control-edit .add,#widgets-right .widget-control-edit .edit,#wp_inactive_widgets .widget-control-edit .edit{display:inline;}.editwidget{margin:0 auto 15px;}.editwidget .widget-inside{display:block;border-width:1px;border-style:solid;padding:10px;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.inactive p.description{margin:5px 15px 8px;}#available-widgets p.description{margin:0 12px 12px;}.widget-position{margin-top:8px;}.inactive{padding-top:2px;}.sidebar-name-arrow{float:right;height:29px;width:26px;}.widget-title .in-widget-title{font-size:11px;white-space:nowrap;}#removing-widget{display:none;font-weight:normal;padding-left:15px;font-size:12px;}.widget-control-noform,#access-off,.widgets_access .widget-action,.widgets_access .sidebar-name-arrow,.widgets_access #access-on,.widgets_access .widget-holder .description{display:none;}.widgets_access .widget-holder,.widgets_access #widget-list{padding-top:10px;}.widgets_access #access-off{display:inline;}.widgets_access #wpbody-content .widget-title-action,.widgets_access #wpbody-content .widget-control-edit,.widgets_access .closed .widgets-sortables,.widgets_access .closed .widget-holder{display:block;}.widgets_access .closed .sidebar-name{-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0;}.widgets_access .sidebar-name,.widgets_access .widget .widget-top{cursor:default;}
\ No newline at end of file
+html,body{min-width:950px;}div.widget-liquid-left{float:left;clear:left;width:100%;margin-right:-325px;}div#widgets-left{margin-left:5px;margin-right:325px;}div#widgets-right{width:285px;margin:0 auto;}div.widget-liquid-right{float:right;clear:right;width:300px;}.widget-liquid-right .widget,#wp_inactive_widgets .widget,.widget-liquid-right .sidebar-description{width:250px;margin:0 auto 20px;overflow:hidden;}.widget-liquid-right .sidebar-description{margin-bottom:10px;}#wp_inactive_widgets .widget{margin:0 10px 20px;float:left;}div.sidebar-name h3{margin:0;padding:5px 12px;font-size:13px;height:19px;overflow:hidden;white-space:nowrap;}div.sidebar-name{background-repeat:repeat-x;background-position:0 0;cursor:pointer;font-size:13px;border-width:1px;border-style:solid;-moz-border-radius-topleft:8px;-moz-border-radius-topright:8px;-webkit-border-top-right-radius:8px;-webkit-border-top-left-radius:8px;-khtml-border-top-right-radius:8px;-khtml-border-top-left-radius:8px;border-top-right-radius:8px;border-top-left-radius:8px;}.js .closed .sidebar-name{-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;-khtml-border-bottom-right-radius:8px;-khtml-border-bottom-left-radius:8px;border-bottom-right-radius:8px;border-bottom-left-radius:8px;}.widget-liquid-right .widgets-sortables,#widgets-left .widget-holder{border-width:0 1px 1px;border-style:none solid solid;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;-khtml-border-bottom-right-radius:8px;-khtml-border-bottom-left-radius:8px;border-bottom-right-radius:8px;border-bottom-left-radius:8px;}.js .closed .widgets-sortables,.js .closed .widget-holder{display:none;}.widget-liquid-right .widgets-sortables{padding:15px 0 0;}#available-widgets .widget-holder{padding:7px 5px 0;}#wp_inactive_widgets{padding:5px 5px 0;}#widget-list .widget{width:250px;margin:0 10px 15px;border:0 none;float:left;}#widget-list .widget-description{padding:5px 8px;}#widget-list .widget-top{border-width:1px;border-style:solid;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.widget-placeholder{border-width:1px;border-style:dashed;margin:0 auto 20px;height:26px;width:250px;}#wp_inactive_widgets .widget-placeholder{margin:0 10px 20px;float:left;}div.widgets-holder-wrap{padding:0;margin:10px 0 20px;}#widgets-left #available-widgets{background-color:transparent;border:0 none;}ul#widget-list{list-style:none;margin:0;padding:0;min-height:100px;}.widget .widget-top{font-size:12px;font-weight:bold;height:26px;overflow:hidden;}.widget-top .widget-title{padding:5px 9px;}.widget-top .widget-title-action{float:right;}a.widget-action{display:block;width:24px;height:26px;}#available-widgets a.widget-action{display:none;}.widget-top a.widget-action{background:url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;}.widget .widget-inside,.widget .widget-description{padding:12px 12px 10px;font-size:11px;line-height:16px;}.widget-inside,.widget-description{display:none;}#available-widgets .widget-description{display:block;}.widget .widget-inside p{margin:0 0 1em;padding:0;}.widget-title h4{margin:0;line-height:1.3;overflow:hidden;white-space:nowrap;}.widgets-sortables{min-height:90px;}.widget-control-actions{margin-top:8px;}.widget-control-actions a{text-decoration:none;}.widget-control-actions a:hover{text-decoration:underline;}.widget-control-actions .ajax-feedback{padding-bottom:3px;}.widget-control-actions div.alignleft{margin-top:6px;}div#sidebar-info{padding:0 1em;margin-bottom:1em;font-size:11px;}.widget-title a,.widget-title a:hover{text-decoration:none;border-bottom:none;}.widget-control-edit{display:block;font-size:11px;font-weight:normal;line-height:26px;padding:0 8px 0 0;}a.widget-control-edit{text-decoration:none;}.widget-control-edit .add,.widget-control-edit .edit{display:none;}#available-widgets .widget-control-edit .add,#widgets-right .widget-control-edit .edit,#wp_inactive_widgets .widget-control-edit .edit{display:inline;}.editwidget{margin:0 auto 15px;}.editwidget .widget-inside{display:block;border-width:1px;border-style:solid;padding:10px;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.inactive p.description{margin:5px 15px 8px;}#available-widgets p.description{margin:0 12px 12px;}.widget-position{margin-top:8px;}.inactive{padding-top:2px;}.sidebar-name-arrow{float:right;height:29px;width:26px;}.widget-title .in-widget-title{font-size:11px;white-space:nowrap;}#removing-widget{display:none;font-weight:normal;padding-left:15px;font-size:12px;}.widget-control-noform,#access-off,.widgets_access .widget-action,.widgets_access .sidebar-name-arrow,.widgets_access #access-on,.widgets_access .widget-holder .description{display:none;}.widgets_access .widget-holder,.widgets_access #widget-list{padding-top:10px;}.widgets_access #access-off{display:inline;}.widgets_access #wpbody-content .widget-title-action,.widgets_access #wpbody-content .widget-control-edit,.widgets_access .closed .widgets-sortables,.widgets_access .closed .widget-holder{display:block;}.widgets_access .closed .sidebar-name{-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0;}.widgets_access .sidebar-name,.widgets_access .widget .widget-top{cursor:default;}
\ No newline at end of file
index 4fa2f7d9948d9e0f15545a71a380f952441f658a..0ce9fd3ce49a3fc1c7cdbf2ad709be600babeb98 100644 (file)
@@ -151,8 +151,8 @@ div.widgets-holder-wrap {
 }
 
 #widgets-left #available-widgets {
-    background-color: transparent;
-    border: 0 none;
+       background-color: transparent;
+       border: 0 none;
 }
 
 ul#widget-list {
@@ -178,9 +178,9 @@ ul#widget-list {
 }
 
 a.widget-action {
-    display: block;
-    width: 24px;
-    height: 26px;
+       display: block;
+       width: 24px;
+       height: 26px;
 }
 
 #available-widgets a.widget-action {
@@ -188,7 +188,7 @@ a.widget-action {
 }
 
 .widget-top a.widget-action {
-    background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px;
+       background: url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;
 }
 
 .widget .widget-inside,
@@ -220,11 +220,11 @@ a.widget-action {
 }
 
 .widgets-sortables {
-    min-height: 90px;
+       min-height: 90px;
 }
 
 .widget-control-actions {
-    margin-top: 8px;
+       margin-top: 8px;
 }
 
 .widget-control-actions a {
diff --git a/wp-admin/css/wp-admin-rtl.css b/wp-admin/css/wp-admin-rtl.css
new file mode 100644 (file)
index 0000000..8f3c6da
--- /dev/null
@@ -0,0 +1 @@
+td.available-theme{text-align:right;}#current-theme img{float:right;margin-right:0;margin-left:1em;}.quicktags,.search{font-family:Tahoma,Arial,sans-serif;}#save-post{float:right;}.preview{float:left;}#sticky-span{margin-left:0;margin-right:18px;}#post-body .misc-pub-section{border-right-width:0;border-left-width:1px;border-right-style:none;border-left-style:solid;float:right;}#post-body .misc-pub-section-last{border-left:0;}#delete-action{text-align:right;float:right;}#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,Arial,sans-serif;}#wpcontent select{font-family:Tahoma,Arial,sans-serif;}#quicktags{background-position:right top;}#template div{margin-right:0;margin-left:190px;}* html #template div{margin-left:0;}#your-profile legend{font-family:Tahoma,Arial,sans-serif;}#ajax-response.alignleft{margin-left:0;margin-right:2em;}.page-numbers{margin-right:0;margin-left:1px;}.column-author img,.column-username img{float:right;margin-right:0;margin-left:10px;}.tablenav a.button-secondary{margin:8px 0 0 8px;}.tablenav .tablenav-pages{float:left;}.tablenav .displaying-num{margin-right:0;margin-left:10px;font-family:Tahoma,Arial,sans-serif;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{margin:8px 8px 8px 0;}#pass-strength-result{float:right;margin:12px 1px 5px 5px;}#user_info{float:left;}#header-logo{float:right;margin:7px 15px 0 0;}#wphead h1{font-family:Tahoma,Arial,sans-serif;float:right;}#wphead h1.long-title{font-family:Tahoma,Arial,sans-serif;}#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,Arial,sans-serif;}#adminmenu a.menu-top,#adminmenu .wp-submenu-head{font-family:Tahoma,Arial,sans-serif;}#adminmenu img.wp-menu-image{float:right;}.folded #adminmenu img.wp-menu-image{padding:7px 6px 0 0;}#adminmenu a.separator{cursor:e-resize;}.folded #adminmenu a.separator{cursor:w-resize;}#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;}.folded #adminmenu a.wp-has-submenu{margin-left:0;margin-right:40px;}#adminmenu .wp-menu-toggle{float:left;padding:1px 0 0 2px;clear:left;}#adminmenu div.wp-menu-image{float:right;}#wphead-info{margin:0 15px 0 0;padding-right:0;padding-left:15px;}#adminmenu #awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{font-family:Tahoma,Arial,sans-serif;margin-left:0;margin-right:7px;}.post-com-count-wrapper{font-family:Tahoma,Arial,sans-serif;}.column-response .post-com-count{float:right;margin-right:0;margin-left:5px;}.form-table th{text-align:right;}.form-table input.tog{margin-right:0;margin-left:2px;float:right;}.form-table table.color-palette{float:right;}#profile-page .form-table #rich_editing{margin-right:0;margin-left:5px;}#normal-sortables .postbox .submit{float:left;}#post-body .tagsdiv #newtag{margin-right:0;margin-left:5px;}#post-status-info{padding:0 7px 0 15px;}#comment-status-radio input{margin:2px 0 5px 3px;}.tagchecklist{margin-left:0;margin-right:10px;}.tagchecklist strong{margin-left:0;margin-right:-8px;}.tagchecklist span{float:right;}.tagchecklist span a{margin:6px -9px 0 0;float:right;}.ac_results li{text-align:right;}#poststuff h2{clear:right;}.description,.form-wrap p{font-family:Tahoma,Arial,sans-serif;}.autosave-info{padding:2px 2px 2px 15px;text-align:left;}.meta-box-sortables .postbox .handlediv{float:left;}.howto{font-family:Tahoma,Arial,sans-serif;}.postarea h3 label{float:right;}.postarea #add-media-button{float:left;right:auto;left:10px;}.wp_themeSkin tr.mceFirst td.mceToolbar{background-position:right top;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{margin:5px 0 0 5px;float:left;}#poststuff #edButtonHTML{margin-right:0;margin-left:15px;}#media-buttons a{padding:0 10px 5px 0;}.submitbox .submit{text-align:right;}.inside-submitbox #post_status{margin:2px -2px 2px 0;}.submitbox .submit input{margin-right:0;margin-left:4px;}.category-adder{margin-left:0;margin-right:120px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-moz-border-radius:0 3px 3px 0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;-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;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:right;text-align:left;margin:0 0 0 -120px;}#post-body .categorydiv div.tabs-panel,#post-body .taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 120px 0 5px;}#front-page-warning,#front-static-pages ul,.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:0;margin-right:18px;}p.search-box{float:left;}#posts-filter fieldset{float:right;margin:0 0 1em 1.5ex;}#posts-filter fieldset legend{padding:0 1px .2em 0;}.view-switch{float:left;}.filter{float:right;margin:-5px 10px 0 0;}#the-comment-list td.comment p.comment-author{margin-right:0;}#the-comment-list p.comment-author img{float:right;margin-right:0;margin-left:8px;}.tablenav .delete{margin-right:0;margin-left:20px;}td.action-links,th.action-links{text-align:left;}.filter .subsubsub{margin-left:0;margin-right:-10px;}#wp-word-count{margin-right:10px;}.tool-box .title{font-family:Tahoma,Arial,sans-serif;}.settings-toggle{text-align:left;margin:5px 0 15px 7px;}.curtime #timestamp{background-position:right top;padding-left:0;padding-right:18px;}#sidemenu{margin:-30px 315px 0 15px;float:left;padding-left:0;padding-right:10px;}#sidemenu a{float:right;}#replysubmit .button{margin-right:0;margin-left:5px;}#edithead .inside{float:right;margin:3px 5px 2px 0;}#replyrow #ed_reply_toolbar input{margin:1px 1px 1px 2px;}#screen-meta-links{margin:0 0 0 18px;}#screen-options-link-wrap,#contextual-help-link-wrap{float:left;font-family:Tahoma,Arial,sans-serif;margin:0 0 0 6px;}#screen-meta a.show-settings{padding:0 6px 0 16px;background-position:left bottom;}.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;}#replysubmit img.waiting,.inline-edit-save img.waiting{float:left;}#bulk-titles div a{float:right;margin:3px -2px 0 3px;}#wpbody-content .filename{margin-left:0;margin-right:10px;}#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;}.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:.5em;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:0;margin-left:.5em;}.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title{font-family:Tahoma,Arial,sans-serif;}.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,Arial,sans-serif;}.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{float:left;}#favorite-first{padding:3px 12px 4px 30px;}#favorite-inside a{padding:3px 10px 3px 5px;}#favorite-toggle{right:auto;left:0;background:transparent url(../images/fav-arrow-rtl.gif?ver=20100531) 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;}ol{list-style-type:decimal;margin-left:0;margin-right:2em;}.postbox-container{float:right;padding-left:.5%;padding-right:0;}#wpbody-content .describe th{text-align:right;}.describe .media-item-info .A1B1{padding:0 10px 0 0;}.media-upload-form td label{margin-left:6px;margin-right:2px;}.media-upload-form .align .field label{padding:0 22px 0 0;margin:0 0 0 1em;}.media-upload-form tr.image-size label{margin:0 3px 0 0;}#wpbody-content .describe p.help{padding:0 5px 0 0;}.describe-toggle-on,.describe-toggle-off{float:left;margin-left:20px;margin-right:0;}.media-item .pinkynail{float:right;}.crunching{text-align:left;margin-left:5px;margin-right:0;}button.dismiss{right:auto;left:5px;}.file-error{float:right;}.bar{border-left-width:3px;border-left-style:solid;border-right:none;}.clearlooks2 .mceTop .mceLeft{width:100%!important;}.taghint{margin:15px 12px -24px 0;}#poststuff .tagsdiv .howto{margin:0 8px 6px 0;}#broken-themes{text-align:right;}.describe .del-link{padding-right:5px;padding-left:0;}.comment-ays th{border-left-style:solid;border-left-width:1px;}table#available-headers td{padding:0 0 10px 20px;}table#available-headers label input{margin-right:0;margin-left:8px;}#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;}#quicktags #ed_em,#ed_reply_toolbar #ed_reply_em,.tablenav .displaying-num,#footer,#footer a,p.help,p.description,span.description,.form-wrap p,#side-sortables .comments-box thead th,#normal-sortables .comments-box thead th,.howto,.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title,#utc-time,#local-time,form.upgrade .hint,p.install-help,.imgedit-help{font-style:normal;}
\ No newline at end of file
similarity index 76%
rename from wp-admin/rtl.dev.css
rename to wp-admin/css/wp-admin-rtl.dev.css
index 9e988b53b7a2f7b6fceff6172e5df7e34e41a1ee..156c14f9375682b1d14f64937db6ea0f299e5d3c 100644 (file)
@@ -9,7 +9,7 @@ td.available-theme {
        margin-left: 1em;
 }
 .quicktags, .search {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 /* 200 - 500
 =================================== */
@@ -25,7 +25,7 @@ td.available-theme {
 }
 #post-body .misc-pub-section {
        border-right-width: 0;
-       border-left-width: 1;
+       border-left-width: 1px;
        border-right-style: none;
        border-left-style: solid;
        float: right;
@@ -51,10 +51,10 @@ td.available-theme {
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #wpcontent select {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #quicktags {
        background-position: right top;
@@ -69,7 +69,7 @@ td.available-theme {
        margin-left: 0;
 }
 #your-profile legend {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #ajax-response.alignleft {
        margin-left: 0;
@@ -93,7 +93,7 @@ td.available-theme {
 .tablenav .displaying-num {
        margin-right: 0;
        margin-left: 10px;
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #postcustomstuff table input,
 #postcustomstuff table select,
@@ -115,22 +115,22 @@ td.available-theme {
        margin: 7px 15px 0 0;
 }
 #wphead h1 {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
        float: right;
 }
 #wphead h1.long-title {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #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, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #adminmenu a.menu-top,
 #adminmenu .wp-submenu-head {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 #adminmenu img.wp-menu-image {
        float: right;
@@ -177,17 +177,12 @@ td.available-theme {
 #adminmenu #awaiting-mod,
 #adminmenu span.update-plugins,
 #sidemenu li a span.update-plugins {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
        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;
+       margin-right: 7px;
 }
 .post-com-count-wrapper {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 .column-response .post-com-count {
        float: right;
@@ -195,8 +190,7 @@ td.available-theme {
        margin-left: 5px;
 }
 /* Tables used on comment.php and option/setting pages */
-.form-table th,
-#wpbody-content .describe th {
+.form-table th {
        text-align: right;
 }
 .form-table input.tog {
@@ -249,15 +243,19 @@ td.available-theme {
        clear: right;
 }
 .description, .form-wrap p {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 /* 1500 - 1800
 =================================== */
+.autosave-info {
+       padding: 2px 2px 2px 15px;
+       text-align: left;
+}
 .meta-box-sortables .postbox .handlediv {
        float: left;
 }
 .howto {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 .postarea h3 label {
        float: right;
@@ -294,11 +292,12 @@ td.available-theme {
        margin-left: 4px;
 }
 /* Categories */
-#category-adder {
+.category-adder {
        margin-left: 0;
        margin-right: 120px;
 }
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs,
+#post-body ul.add-menu-item-tabs li.tabs {
        -moz-border-radius: 0 3px 3px 0;
        -webkit-border-top-left-radius: 0;
        -webkit-border-top-right-radius: 3px;
@@ -309,23 +308,27 @@ td.available-theme {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 3px;
 }
-#post-body ul#category-tabs {
+#post-body ul.category-tabs,
+#post-body ul.add-menu-item-tabs {
        float: right;
        text-align: left;
        margin: 0 0 0 -120px;
 }
-#post-body #categorydiv div.tabs-panel,
+#post-body .categorydiv div.tabs-panel,
+#post-body .taxonomy div.tabs-panel,
 #post-body #linkcategorydiv div.tabs-panel {
        margin: 0 120px 0 5px;
 }
 /* 1800 - 2000
 =================================== */
-#side-sortables #category-tabs li {
-       padding-right: 0;
-       padding-left: 8px;
-}
-#categorydiv ul.categorychecklist ul,
-#linkcategorydiv ul.categorychecklist ul {
+#front-page-warning,
+#front-static-pages ul,
+.inline-editor ul.cat-checklist ul,
+.categorydiv ul.categorychecklist ul,
+.customlinkdiv ul.categorychecklist ul,
+.posttypediv ul.categorychecklist ul,
+.taxonomydiv ul.categorychecklist ul,
+#linkcategorydiv ul.categorychecklist ul{
        margin-left: 0;
        margin-right: 18px;
 }
@@ -372,7 +375,7 @@ td.action-links, th.action-links {
        margin-right: 10px;
 }
 .tool-box .title {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 .settings-toggle {
        text-align: left;
@@ -408,14 +411,18 @@ td.action-links, th.action-links {
 }
 /* show/hide settings */
 #screen-meta-links {
-       margin: 0 0 0 9px;
+       margin: 0 0 0 18px;
 }
 #screen-options-link-wrap,
 #contextual-help-link-wrap {
        float: left;
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
        margin: 0 0 0 6px;
 }
+#screen-meta a.show-settings {
+       padding: 0 6px 0 16px;
+       background-position: left bottom;
+}
 .metabox-prefs label {
        padding-right: 0;
        padding-left: 15px;
@@ -428,6 +435,10 @@ td.action-links, th.action-links {
        margin-right: 0;
        margin-left: 5px;
 }
+#replysubmit img.waiting,
+.inline-edit-save img.waiting {
+       float: left;
+}
 /* 2500 - 2700
 =================================== */
 #bulk-titles div a {
@@ -476,7 +487,7 @@ td.action-links, th.action-links {
 .inline-edit-row .catshow,
 .inline-edit-row .cathide,
 .inline-edit-row #bulk-titles div {
-       font-family: Tahoma, Arial, sans-serif; 
+       font-family: Tahoma, Arial, sans-serif;
 }
 .quick-edit-row-post fieldset label.inline-edit-status {
        float: right;
@@ -520,7 +531,7 @@ td.action-links, th.action-links {
 #favorite-toggle {
        right: auto;
        left: 0;
-       background:transparent url(images/fav-arrow-rtl.gif) no-repeat 10px -4px;
+       background:transparent url(../images/fav-arrow-rtl.gif?ver=20100531) no-repeat 10px -4px;
 }
 #utc-time, #local-time {
        padding-left: 0;
@@ -548,13 +559,114 @@ ol {
        padding-right: 0;
 }
 
+/* Media library */
+#wpbody-content .describe th {
+       text-align: right;
+}
+
+.describe .media-item-info .A1B1 {
+       padding: 0 10px 0 0;
+}
+
+.media-upload-form td label {
+       margin-left: 6px;
+       margin-right: 2px;
+}
+
+.media-upload-form .align .field label {
+       padding: 0 22px 0 0;
+       margin: 0 0 0 1em;
+}
+
+.media-upload-form tr.image-size label {
+       margin: 0 3px 0 0 ;
+}
+
+#wpbody-content .describe p.help {
+       padding: 0 5px 0 0 ;
+}
+
+.describe-toggle-on,
+.describe-toggle-off {
+       float: left;
+       margin-left: 20px;
+       margin-right: 0;
+}
+
+.media-item .pinkynail {
+       float: right;
+}
+
+.crunching {
+       text-align: left;
+       margin-left: 5px;
+       margin-right: 0;
+}
+
+button.dismiss {
+       right: auto;
+       left: 5px;
+}
+
+.file-error {
+       float: right;
+}
+
+.bar {
+       border-left-width: 3px;
+       border-left-style: solid;
+       border-right: none;
+}
+
+
 /* TinyMCE
 =================================== */
 .clearlooks2 .mceTop .mceLeft {
        width:100% !important;
 }
+
+/* tag hints */
+.taghint {
+       margin: 15px 12px -24px 0;
+}
+
+#poststuff .tagsdiv .howto {
+       margin: 0 8px 6px 0;
+}
+
+#broken-themes {
+       text-align: right;
+}
+
+.describe .del-link {
+       padding-right: 5px;
+       padding-left: 0;
+}
+
+.comment-ays th {
+       border-left-style: solid;
+       border-left-width: 1px;
+}
+
+/* Custom Header */
+table#available-headers td {
+       padding: 0 0 10px 20px;
+}
+table#available-headers label input {
+       margin-right: 0;
+       margin-left: 8px;
+}
+
 /* 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;
 }
+
+/* no italic
+=================================== */
+
+#quicktags #ed_em, #ed_reply_toolbar #ed_reply_em, .tablenav .displaying-num, #footer, #footer a, p.help, p.description, span.description, .form-wrap p, #side-sortables .comments-box thead th,
+#normal-sortables .comments-box thead th, .howto, .inline-edit-row fieldset span.title, .inline-edit-row fieldset span.checkbox-title, #utc-time, #local-time, form.upgrade .hint, p.install-help, .imgedit-help  {
+       font-style: normal;
+}
diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css
new file mode 100644 (file)
index 0000000..a7a2dbf
--- /dev/null
@@ -0,0 +1 @@
+textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-width:1px;border-style:solid;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}p,ul,ol,blockquote,input,select{font-size:12px;}select option{padding:2px;}.plugins .name,#pass-strength-result.strong,#pass-strength-result.short,.button-highlighted,input.button-highlighted,#quicktags #ed_strong,#ed_reply_toolbar #ed_reply_strong{font-weight:bold;}.plugins p{margin:0 4px;padding:0;}.plugins .desc p{margin:0 0 8px;}.plugins td.desc{line-height:1.5em;}.plugins .desc ul,.plugins .desc ol{margin:0 0 0 2em;}.plugins .desc ul{list-style-type:disc;}.plugins .action-links{white-space:nowrap;}.plugins .row-actions-visible{padding:0;}.widefat tbody.plugins th.check-column{padding:7px 0;}.widefat .plugins td,.widefat .plugins th{border-bottom:0 none;}#install-plugins .plugins td,#install-plugins .plugins th{border-bottom-style:solid;border-bottom-width:1px;}.plugins .inactive td,.plugins .inactive th,.plugins .active td,.plugins .active th{border-top-style:solid;border-top-width:1px;padding:5px 7px 0;}#wpbody-content .plugins .plugin-title{padding-right:12px;}.plugins .second td,.plugins .second th{border-top:0 none;padding:0 7px 5px;}.plugins-php .widefat tfoot th,.plugins-php .widefat tfoot td{border-top-style:solid;border-top-width:1px;}.import-system{font-size:16px;}.anchors{margin:10px 20px 10px 20px;}table#availablethemes{border-spacing:0;border-width:1px 0;border-style:solid none;margin:10px auto;width:100%;}td.available-theme{vertical-align:top;width:240px;margin:0;padding:20px;text-align:left;}table#availablethemes td{border-width:0 1px 1px;border-style:none solid solid;}table#availablethemes td.right,table#availablethemes td.left{border-right:0 none;border-left:0 none;}table#availablethemes td.bottom{border-bottom:0 none;}.available-theme a.screenshot{width:240px;height:180px;display:block;border-width:1px;border-style:solid;margin-bottom:10px;overflow:hidden;}.available-theme img{width:240px;}.available-theme h3{margin:15px 0 5px;}#current-theme{margin:1em 0 1.5em;}#current-theme a{border-bottom:none;}#current-theme h3{font-size:17px;font-weight:normal;margin:0;}#current-theme .theme-description{margin-top:5px;}#current-theme img{float:left;border-width:1px;border-style:solid;margin-right:1em;margin-bottom:1.5em;width:150px;}#TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited{font-weight:bold;text-decoration:none;}#TB_window #TB_title{background-color:#222;color:#cfcfcf;}.checkbox{border:none;margin:0;padding:0;}.code,code{font-family:Consolas,Monaco,Courier,monospace;}kbd,code{padding:1px 3px;margin:0 1px;font-size:11px;}.commentlist li{padding:1em 1em .2em;margin:0;border-bottom-width:1px;border-bottom-style:solid;}.commentlist li li{border-bottom:0;padding:0;}.commentlist p{padding:0;margin:0 0 .8em;}.post-categories{display:inline;margin:0;padding:0;}.post-categories li{display:inline;}.quicktags,.search{font:12px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}.submit{padding:1.5em 0;margin:5px 0;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-left-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;}form p.submit a.cancel:hover{text-decoration:none;}#submitdiv 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;line-height:23px;}#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;}#post-status-display,#post-visibility-display{font-weight:bold;}.side-info{margin:0;padding:4px;font-size:11px;}.side-info h5{padding-bottom:7px;font-size:14px;margin:12px 2px 5px;border-bottom-width:1px;border-bottom-style:solid;}.side-info ul{margin:0;padding-left:18px;list-style:square;}.submit input,.button,input.button,.button-primary,input.button-primary,.button-secondary,input.button-secondary,.button-highlighted,input.button-highlighted,#postcustomstuff .submit input{text-decoration:none;font-size:11px!important;line-height:13px;padding:3px 8px;cursor:pointer;border-width:1px;border-style:solid;-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:15px;padding:3px 10px;white-space:nowrap;-webkit-border-radius:10px;}#doaction,#doaction2,#post-query-submit{margin-right:8px;}.tablenav select[name="action"],.tablenav select[name="action2"]{width:130px;}.tablenav select[name="m"]{width:155px;}.tablenav select#cat{width:170px;}#wpcontent select{padding:2px;height:2em;font-size:11px;}#wpcontent option{padding:2px;}#timezone_string option{margin-left:1em;}.approve{display:none;}.unapproved .approve,.spam .approve,.trash .approve{display:inline;}.unapproved .unapprove{display:none;}.narrow{width:70%;margin-bottom:40px;}.narrow p{line-height:150%;}textarea.all-options,input.all-options{width:250px;}#namediv table{width:100%;}#namediv td.first{width:10px;white-space:nowrap;}#namediv input{width:98%;}#namediv p{margin:10px 0;}#wpbody-content .metabox-holder{padding-top:10px;}#content{margin:0;width:100%;}#editorcontainer #content{padding:6px;line-height:150%;border:0 none;outline:none;resize:vertical;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-khtml-box-sizing:border-box;box-sizing:border-box;}#editorcontainer,#quicktags{border-style:solid;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;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{padding:2px 4px 0;}#ed_toolbar input,#ed_reply_toolbar input{margin:3px 1px 4px;line-height:18px;display:inline-block;min-width:26px;padding:2px 4px;font-size:12px;}#ed_reply_toolbar input{margin:1px 2px 1px 1px;}#quicktags #ed_link,#ed_reply_toolbar #ed_reply_link{text-decoration:underline;}#quicktags #ed_del,#ed_reply_toolbar #ed_reply_del{text-decoration:line-through;}#quicktags #ed_em,#ed_reply_toolbar #ed_reply_em{font-style:italic;}#excerpt,.attachmentlinks{margin:0;height:4em;width:98%;}#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;}#postcustomstuff .updatemeta,#postcustomstuff .deletemeta{margin:auto;}#postcustomstuff thead th{padding:5px 8px 8px;}#postcustom #postcustomstuff .submit{border:0 none;float:none;padding:5px 8px;}#side-sortables #postcustom #postcustomstuff .submit{padding:0 5px;}#side-sortables #postcustom #postcustomstuff td.left input{margin:3px 3px 0;}#side-sortables #postcustom #postcustomstuff #the-list textarea{height:85px;margin:3px;}#postcustomstuff table{margin:0;width:100%;border-width:1px;border-style:solid;border-spacing:0;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{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 #newmetaleft{vertical-align:top;}#postcustomstuff #newmetaleft a{padding:0 10px;text-decoration:none;}#save{width:15em;}#template div{margin-right:190px;}* html #template div{margin-right:0;}.zerosize{height:0;width:0;margin:0;border:0;padding:0;overflow:hidden;position:absolute;}* html #themeselect{padding:0 3px;height:22px;}#your-profile legend{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:22px;}#your-profile #rich_editing{border:none;}#howto{font-size:11px;margin:0 5px;display:block;}#ajax-response.alignleft{margin-left:2em;}div.nav{height:2em;padding:7px 10px;vertical-align:text-top;margin:5px 0;}.nav .button-secondary{padding:2px 4px;}a.page-numbers{border-bottom-style:solid;border-bottom-width:2px;font-weight:bold;margin-right:1px;padding:0 2px;}p.pagenav{margin:0;display:inline;}.pagenav span{font-weight:bold;margin:0 6px;}.row-title{font-size:12px!important;font-weight:bold;}.widefat .column-comment p{margin:.6em 0;}.column-author img,.column-username img{float:left;margin-right:10px;margin-top:3px;}.tablenav a.button-secondary{display:block;margin:3px 8px 0 0;}.tablenav{clear:both;height:30px;margin:6px 0 4px;vertical-align:middle;}.tablenav .tablenav-pages{float:right;display:block;cursor:default;height:30px;line-height:30px;font-size:11px;}.tablenav .tablenav-pages a,.tablenav-pages span.current{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{text-align:center;width:80px;padding-top:8px;padding-bottom:8px;}td.media-icon img{max-width:80px;max-height:60px;}#update-nag,.update-nag{line-height:19px;padding:5px 0;font-size:12px;text-align:center;margin:0 15px;border-width:1px;border-style:solid;border-top-width:0;border-top-style:none;-moz-border-radius:0 0 6px 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;}.plugins .plugin-update{padding:0;}.plugin-update .update-message{margin:0 10px 8px 31px;font-weight:bold;}#pass-strength-result{border-style:solid;border-width:1px;float:left;margin:12px 5px 5px 1px;padding:3px 5px;text-align:center;width:200px;}.row-actions{visibility:hidden;padding:2px 0 0;}tr:hover .row-actions,div.comment-item:hover .row-actions{visibility:visible;}.row-actions-visible{padding:2px 0 0;}#wphead-info{margin:0 0 0 15px;padding-right:15px;}#user_info{float:right;font-size:12px;line-height:46px;height:46px;}#user_info p{margin:0;padding:0;line-height:46px;}#wphead{height:46px;}#wphead a,#adminmenu a,#sidemenu a,#taglist a,#catlist a,#show-settings a{text-decoration:none;}#header-logo{float:left;margin:7px 0 0 15px;}#wphead h1{font:normal 22px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:10px 8px 5px;margin:0;float:left;}#wphead h1.long-title{font:normal 18px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:12px 10px 5px;}#wphead #privacy-on-link{font-size:50%;font-style:normal;line-height:17px;padding:0 6px;vertical-align:middle;}#wphead h1 a:hover{text-decoration:none;}#wphead h1 a:hover #site-title,#wphead h1 a#privacy-on-link:hover{text-decoration:underline;}#adminmenu *{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}#adminmenu .wp-submenu{display:none;list-style:none;padding:0;margin:0;position:relative;z-index:2;border-width:1px 0 0;border-style:solid none none;}#adminmenu .wp-submenu a{font:normal 11px/18px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}#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,.no-js #adminmenu .open-if-no-js .wp-submenu{display:block;}#adminmenu div.wp-menu-image{float:left;width:28px;height:28px;}#adminmenu li{margin:0;padding:0;cursor:pointer;}#adminmenu a{display:block;line-height:18px;padding:1px 5px 3px;}#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;-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 .wp-menu-image img{float:left;padding:8px 6px 0;opacity:.6;filter:alpha(opacity=60);}#adminmenu li.menu-top:hover .wp-menu-image img,#adminmenu li.wp-has-current-submenu .wp-menu-image img{opacity:1;filter:alpha(opacity=100);}#adminmenu li.wp-menu-separator{height:21px;padding:0;margin:0;}#adminmenu a.separator{cursor:w-resize;height:20px;padding:0;}.folded #adminmenu a.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;}.folded #adminmenu a.wp-has-submenu{margin-left:40px;}#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;}#adminmenu li.wp-has-current-submenu ul{border-bottom-width:1px;border-bottom-style:solid;}#adminmenu .wp-menu-image a{height:24px;}#adminmenu .wp-menu-image img{padding:6px 0 0 1px;}#adminmenu #awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{position:absolute;font-family:Helvetica,Arial,sans-serif;font-size:9px;line-height:17px;font-weight:bold;margin-top:1px;margin-left:7px;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;}#adminmenu li #awaiting-mod span,#adminmenu li span.update-plugins span,#sidemenu li a span.update-plugins span{display:block;padding:0 6px;}#adminmenu li span.count-0,#sidemenu li a .count-0{display:none;}.post-com-count-wrapper{min-width:22px;font-family:Helvetica,Arial,sans-serif;}.post-com-count{height:1.3em;line-height:1.1em;display:block;text-decoration:none;padding:0 0 6px;cursor:pointer;background-position:center -80px;background-repeat:no-repeat;}.post-com-count span{font-size:9px;font-weight:bold;height:1.7em;line-height:1.70em;min-width:.7em;padding:0 6px;display:inline-block;cursor:pointer;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}strong .post-com-count{background-position:center -55px;}.post-com-count:hover{background-position:center -3px;}.column-response .post-com-count{float:left;margin-right:5px;text-align:center;}.response-links{float:left;}#the-comment-list .attachment-80x60{padding:4px 8px;}#footer{margin-top:-46px;border-top:1px;border-style:solid;}#footer,#footer a{font-size:12px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-style:italic;}#footer p{margin:0;padding:15px;line-height:15px;}#footer a{text-decoration:none;}#footer a:hover{text-decoration:underline;}.form-table{border-collapse:collapse;margin-top:.5em;width:100%;margin-bottom:-8px;clear:both;}.form-table td{margin-bottom:9px;padding:8px 10px;line-height:20px;font-size:11px;}.form-table th,.form-wrap label{font-weight:normal;text-shadow:rgba(255,255,255,1) 0 1px 0;}.form-table th{vertical-align:top;text-align:left;padding:10px;width:200px;}.form-table th.th-full{width:auto;}.form-table div.color-option{display:block;clear:both;margin-top:12px;}.form-table input.tog{margin-top:2px;margin-right:2px;float:left;}.form-table table.color-palette{vertical-align:bottom;float:left;margin:-12px 3px 11px;}.form-table .color-palette td{border-width:1px 1px 0;border-style:solid solid none;height:10px;line-height:20px;width:10px;}input.large-text,textarea.large-text{width:99%;}.form-table input.regular-text,#adduser .form-field input{width:25em;}.form-table input.small-text{width:50px;}#profile-page .form-table textarea{width:500px;margin-bottom:6px;}#profile-page .form-table #rich_editing{margin-right:5px;}.form-table .pre{padding:8px;margin:0;}.pre{white-space:pre-wrap;white-space:-moz-pre-wrap!important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;}table.form-table td .updated{font-size:13px;}.form-wrap{margin:10px 0;width:97%;}.form-wrap p,.form-wrap label{font-size:11px;}.form-wrap label{display:block;padding:2px;font-size:12px;}.form-field input,.form-field textarea{border-style:solid;border-width:1px;width:95%;}p.description,.form-wrap p{margin:2px 0 5px;}p.help,p.description,span.description,.form-wrap p{font-size:12px;font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}.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;text-align:justify;}.tagcloud h3{margin:2px 0 12px;}#post-body #normal-sortables{min-height:50px;}#post-body #advanced-sortables{min-height:20px;}.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 .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,#normal-sortables .comments-box{border:0 none;}#side-sortables .comments-box thead th,#normal-sortables .comments-box thead th{background:transparent;padding:0 7px 4px;font-style:italic;}#commentsdiv img.waiting{padding-left:5px;vertical-align:middle;}#post-body .tagsdiv #newtag{margin-right:5px;width:16em;}#side-sortables input#post_password{width:94%;}#side-sortables .tagsdiv #newtag{width:68%;}#post-status-info{border-width:0 1px 1px;border-style:none solid solid;width:100%;-moz-border-radius:0 0 6px 6px;-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-left-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;}#post-status-info td{font-size:11px;}.autosave-info{padding:2px 15px 2px 2px;text-align:right;}#editorcontent #post-status-info{border:none;}#post-body .wp_themeSkin .mceStatusbar a.mceResize{display:block;background:transparent url(../images/resize.gif) no-repeat scroll right bottom;width:12px;cursor:se-resize;margin:0 2px;position:relative;top:22px;}#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:14px;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 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}.howto{font-style:italic;display:block;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#poststuff h2{margin-top:20px;font-size:1.5em;margin-bottom:15px;padding:0 0 3px;clear:left;}.widget .widget-top,.postbox h3{cursor:move;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}.postbox .hndle span{padding:6px 0;}.postbox .hndle{cursor:move;}.hndle a{font-size:11px;font-weight:normal;}#dashboard-widgets .meta-box-sortables{margin:0 5px;}.postbox .handlediv{float:right;width:23px;height:26px;}.sortable-placeholder{border-width:1px;border-style:dashed;margin-bottom:20px;}#poststuff h3,.metabox-holder h3{font-size:12px;font-weight:bold;padding:7px 9px;margin:0;line-height:1;}.widget,.postbox,.stuffbox{margin-bottom:20px;border-width:1px;border-style:solid;line-height:1;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.widget .widget-top,.postbox h3,.postbox h3,.stuffbox h3{-moz-border-radius:6px 6px 0 0;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-right-radius:6px;-khtml-border-top-left-radius:6px;border-top-right-radius:6px;border-top-left-radius:6px;}.postbox.closed h3{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;-khtml-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;-khtml-border-bottom-right-radius:4px;border-bottom-right-radius:4px;}.postbox table.form-table{margin-bottom:0;}.postbox 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 6px 8px;}#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{margin-bottom:20px;}#titlediv{position:relative;margin-bottom:20px;}#titlediv label{cursor:text;}#titlediv div.inside{margin:0;}#poststuff #titlewrap{border:0;padding:0;}#titlediv #title{padding:3px 4px;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;line-height:100%;width:100%;outline:none;}#titlediv #title-prompt-text{color:#bbb;position:absolute;font-size:1.7em;padding:8px;}#poststuff .inside-submitbox,#side-sortables .inside-submitbox{margin:0 3px;font-size:11px;}input#link_description,input#link_url{width:98%;}#pending{background:0 none;border:0 none;padding:0;font-size:11px;margin-top:-1px;}#edit-slug-box{height:1em;margin-top:8px;padding:0 7px;}#editable-post-name-full{display:none;}#editable-post-name input{width:16em;}.postarea h3 label{float:left;}.postarea #add-media-button{float:right;margin:7px 0 0;position:relative;right:10px;}#poststuff #editor-toolbar{height:30px;}.wp_themeSkin tr.mceFirst td.mceToolbar{border-width:0 0 1px;border-style:none none solid;}#edButtonPreview,#edButtonHTML{height:18px;margin:5px 5px 0 0;padding:4px 5px 2px;float:right;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}.js .theEditor{color:white;}#poststuff #edButtonHTML{margin-right:15px;}#media-buttons{cursor:default;padding:8px 8px 0;}#media-buttons a{cursor:pointer;padding:0 0 5px 10px;}#media-buttons img,#submitpost #ajax-loading{vertical-align:middle;}.submitbox .submit{text-align:left;padding:12px 10px 10px;font-size:11px;}.submitbox .submitdelete{border-bottom-width:1px;border-bottom-style:solid;text-decoration:none;padding:1px 2px;}.inside-submitbox #post_status{margin:2px 0 2px -2px;}.submitbox .submit a:hover{border-bottom-width:1px;border-bottom-style:solid;}.submitbox .submit input{margin-bottom:8px;margin-right:4px;padding:6px;}#post-status-select{line-height:2.5em;margin-top:3px;}.category-adder{margin-left:120px;padding:4px 0;}.category-adder h4{margin:0 0 8px;}#side-sortables .category-adder{margin:0;}#post-body .category-add input,.category-add select{width:30%;}#side-sortables .category-add input{width:94%;}#side-sortables .category-add select{width:100%;}#side-sortables .category-add input.category-add-sumbit,#post-body .category-add input.category-add input.category-add-sumbit{width:auto;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:left;width:120px;text-align:right;margin:0 -120px 0 5px;padding:0;}#post-body ul.category-tabs li,#post-body ul.add-menu-item-tabs li{padding:8px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-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.tabs a,#post-body ul.add-menu-item-tabs li.tabs a{font-weight:bold;text-decoration:none;}.categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:200px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}.nav-menus-php .customlinkdiv div.tabs-panel,.nav-menus-php .posttypediv div.tabs-panel,.nav-menus-php .taxonomydiv div.tabs-panel{height:auto;max-height:205px;}div.tabs-panel-active{display:block;}div.tabs-panel-inactive{display:none;}#post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 5px 0 125px;}#side-sortables .category-tabs li,#side-sortables .add-menu-item-tabs li{display:inline;}#side-sortables .category-tabs a,#side-sortables .add-menu-item-tabs a{text-decoration:none;}#side-sortables .category-tabs,#side-sortables .add-menu-item-tabs{margin-bottom:3px;}.categorydiv ul,.customlinkdiv ul,.posttypediv ul,.taxonomydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}#front-page-warning,#front-static-pages ul,.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:18px;}ul.categorychecklist li{margin:0;padding:0;line-height:19px;word-wrap:break-word;}.category-adder h4{margin-top:4px;margin-bottom:0;}.categorydiv .tabs-panel,.customlinkdiv .tabs-panel,.posttypediv .tabs-panel,.taxonomydiv .tabs-panel{border-width:3px;border-style:solid;}ul.category-tabs,ul.add-menu-item-tabs{margin-top:12px;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{border-style:solid solid none;border-width:1px 1px 0;}#post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs{border-style:solid none solid solid;border-width:1px 0 1px 1px;margin-right:-1px;}ul.category-tabs li,ul.add-menu-item-tabs li{padding:5px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-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;}form#tags-filter{position:relative;}p.search-box{float:right;margin:-5px 0 0;}.screen-per-page{width:3em;}#posts-filter fieldset{float:left;margin:0 1.5ex 1em 0;padding:0;}#posts-filter fieldset legend{padding:0 0 .2em 1px;}td.post-title strong,td.plugin-title strong{display:block;margin-bottom:.2em;}td.post-title p,td.plugin-title p{margin:6px 0;}td.plugin-title{white-space:nowrap;}.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;}.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;}.indicator-hint{padding-top:8px;}#display_name{width:15em;}.tablenav .delete{margin-right:20px;}td.action-links,th.action-links{text-align:right;}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;padding:2px 7px;}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;}.settings-toggle{text-align:right;margin:5px 7px 15px 0;font-size:12px;}.settings-toggle h3{margin:0;}#timestampdiv select{height:20px;line-height:14px;padding:0;vertical-align:top;}#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;}#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;}#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{padding:4px 10px 0;vertical-align:top;float:right;}#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;}#screen-meta{position:relative;clear:both;}#screen-meta-links{margin:0 18px 0 0;}#screen-meta .screen-reader-text{visibility:hidden;}#screen-options-link-wrap,#contextual-help-link-wrap{float:right;height:22px;padding:0;margin:0 6px 0 0;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;background:#e3e3e3;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;}#contextual-help-wrap li{list-style-type:disc;margin-left:18px;}#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?ver=20100531);}#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;}tr.inline-edit-row td{padding: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 .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:.5em;margin:.5em 0 0;}.inline-edit-row span.error{line-height:22px;margin:0 15px;padding:3px 5px;}.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:.5em;}.inline-edit-row .input-text-wrap input[type=text]{width:100%;}.inline-edit-row fieldset label input[type=checkbox]{vertical-align:text-bottom;}.inline-edit-row fieldset label textarea{width:100%;height:4em;}#wpbody-content .bulk-edit-row fieldset .inline-edit-group label{max-width:50%;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:.5em;}.inline-edit-row h4{text-transform:uppercase;}.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;}.inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea{border-style:solid;border-width:1px;}.inline-edit-row fieldset .inline-edit-date{float:left;}.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;}.inline-edit-row fieldset input[name=aa]{font-size:12px;width:3.5em;}.inline-edit-row fieldset label input.inline-edit-password-input{width:8em;}.inline-edit-row .catshow,.inline-edit-row .cathide{cursor:pointer;}ul.cat-checklist{height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0;}#bulk-titles{display:block;height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0 0 5px;}.inline-edit-row fieldset ul.cat-checklist li,.inline-edit-row fieldset ul.cat-checklist input{margin:0;}.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;}table .inline-edit-row fieldset ul.cat-hover{height:auto;max-height:30em;overflow-y:auto;position:absolute;}.inline-edit-row fieldset label input.inline-edit-menu-order-input{width:3em;}.inline-edit-row fieldset label input.inline-edit-slug-input{width:75%;}.quick-edit-row-post fieldset label.inline-edit-status{float:left;}#bulk-titles{line-height:140%;}#bulk-titles div{margin:.2em .3em;}#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;}#wpbody-content #media-items .describe{border-collapse:collapse;width:100%;border-top-style:solid;border-top-width:1px;clear:both;cursor:default;padding:5px;}#wpbody-content .describe th{vertical-align:top;text-align:left;padding:10px;width:140px;}#wpbody-content .describe .media-item-info tr{background-color:transparent;}#wpbody-content .describe .media-item-info td{padding:4px 10px 0;}.describe .media-item-info .A1B1{padding:0 0 0 10px;}#wpbody-content .filename{padding:0 10px;}#wpbody-content .media-item .thumbnail{max-height:128px;max-width:128px;}#wpbody-content #async-upload-wrap a{display:none;}.media-upload-form td label{margin-right:6px;margin-left:2px;}.media-upload-form .align .field label{display:inline;padding:0 0 0 22px;margin:0 1em 0 0;font-weight:bold;}.media-upload-form tr.image-size label{margin:0 0 0 3px;font-weight:bold;}.media-upload-form th.label label{font-weight:bold;margin:.5em;font-size:13px;}.media-upload-form th.label label span{padding:0 5px;}abbr.required{border:medium none;text-decoration:none;}#wpbody-content .describe input[type="text"],#wpbody-content .describe textarea{width:460px;}#wpbody-content .describe p.help{margin:0;padding:0 0 0 5px;}.media-item .error-div a.dismiss,.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}#wpbody-content .media-item{border-bottom-style:solid;border-bottom-width:1px;min-height:36px;position:relative;width:100%;}#wpbody-content .media-single .media-item{border-bottom-style:none;border-bottom-width:0;}#wpbody-content #media-items{border-style:solid solid none;border-width:1px;width:670px;}#wpbody-content #media-items .filename{line-height:36px;overflow:hidden;}.media-item .error-div{padding-left:10px;}.media-item .pinkynail{float:left;margin:2px;max-width:40px;max-height:32px;}.media-item .startopen,.media-item .startclosed{display:none;}.media-item .original{position:relative;height:34px;width:503px;}.media-item .percent{font-weight:bold;}.crunching{display:block;line-height:32px;text-align:right;margin-right:5px;}.progress{position:relative;margin-bottom:-36px;height:36px;}.bar{width:0;height:100%;border-right-width:3px;border-right-style:solid;}.upload-php .fixed .column-parent{width:25%;}.find-box{width:500px;height:300px;overflow:hidden;padding:33px 5px 40px;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%;}.find-box-inside{overflow:auto;width:100%;height:100%;}.find-box-search{padding:12px;border-width:1px;border-style:none none solid;}#find-posts-response{margin:8px 0;padding:0 1px;}#find-posts-response table{width:100%;}#find-posts-response .found-radio{padding:5px 0 0 8px;width:15px;}.find-box-buttons{width:480px;margin:8px;}.find-box-search label{padding-right:6px;}.find-box #resize-se{position:absolute;right:1px;bottom:1px;}#favorite-actions{float:right;margin:11px 12px 0;min-width:130px;position:relative;}#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;}#favorite-inside{margin:0;padding:2px 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;}#favorite-actions a{display:block;text-decoration:none;font-size:11px;}#favorite-inside a{padding:3px 5px 3px 10px;}#favorite-toggle{height:22px;position:absolute;right:0;top:1px;width:28px;}#favorite-actions .slide-down{-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:none;}#utc-time,#local-time{padding-left:25px;font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}ul#dismissed-updates{display:none;}form.upgrade{margin-top:8px;}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0;}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}br.clear{height:2px;line-height:2px;}.swfupload{margin:5px 10px;vertical-align:middle;}table.fixed{table-layout:fixed;}.fixed .column-rating,.fixed .column-visible{width:8%;}.fixed .column-date,.fixed .column-parent,.fixed .column-links{width:10%;}.fixed .column-response,.fixed .column-author,.fixed .column-categories,.fixed .column-tags,.fixed .column-rel,.fixed .column-role{width:15%;}.fixed .column-comments{width:4em;padding-top:8px;}.fixed .column-slug{width:25%;}.fixed .column-posts{width:10%;}.fixed .column-icon{width:80px;}#commentsdiv .fixed .column-author,#comments-form .fixed .column-author{width:20%;}.widefat th,.widefat td{overflow:hidden;}.widefat td p{margin:2px 0 .8em;}table .vers,table .column-visible,table .column-rating{text-align:center;}.icon32{float:left;height:36px;margin:14px 6px 0 0;width:36px;}.key-labels label{line-height:24px;}.subtitle{font-size:.75em;line-height:1;padding-left:25px;}ol{list-style-type:decimal;margin-left:2em;}.postbox-container{float:left;padding-right:.5%;}.postbox-container .meta-box-sortables{min-height:300px;}.temp-border{border:1px dotted #ccc;}.columns-prefs label{padding:0 5px;}.theme-install-php h4,.plugin-install-php h4{margin:2.5em 0 8px;}p.install-help{margin:8px 0;font-style:italic;}p.popular-tags{-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border-width:1px;border-style:solid;line-height:2em;padding:8px 12px 12px;text-align:justify;}p.popular-tags a{padding:0 3px;}.stuffbox .editcomment{clear:none;}.ajax-feedback{visibility:hidden;vertical-align:bottom;}.tagsdiv .newtag{width:180px;}.tagsdiv .the-tags{display:block;height:60px;margin:0 auto;overflow:auto;width:260px;}#post-body-content .tagsdiv .the-tags{margin:0 5px;}label,#your-profile label+a{vertical-align:middle;}#misc-publishing-actions label{vertical-align:baseline;}.plugin-update-tr .update-message{margin:5px;padding:3px 5px;border-width:1px;border-style:solid;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}.add-new-h2{font-style:normal;margin:0 6px;position:relative;top:-3px;}.describe .image-editor{vertical-align:top;}.imgedit-wrap{position:relative;}.imgedit-settings p{margin:8px 0;}.describe .imgedit-wrap table td{vertical-align:top;padding-top:0;}.imgedit-wrap p,.describe .imgedit-wrap table td{font-size:11px;line-height:18px;}.describe .imgedit-wrap table td.imgedit-settings{padding:0 5px;}td.imgedit-settings input{vertical-align:middle;}.imgedit-wait{position:absolute;top:0;background:#FFF url(../images/wpspin_light.gif) no-repeat scroll 22px 10px;opacity:.7;filter:alpha(opacity=70);width:100%;height:500px;display:none;}.media-disabled,.imgedit-settings .disabled{color:grey;}.imgedit-wait-spin{padding:0 4px 4px;vertical-align:bottom;visibility:hidden;}.imgedit-menu{margin:0 0 12px;min-width:300px;}.imgedit-menu div{float:left;width:32px;height:32px;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;border-width:1px;border-style:solid;}.imgedit-crop-wrap{position:relative;}.imgedit-crop{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -9px -31px;margin:0 8px 0 0;}.imgedit-crop.disabled:hover{background-position:-9px -31px;}.imgedit-crop:hover{background-position:-9px -1px;}.imgedit-rleft{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -46px -31px;margin:0 3px;}.imgedit-rleft.disabled:hover{background-position:-46px -31px;}.imgedit-rleft:hover{background-position:-46px -1px;}.imgedit-rright{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -77px -31px;margin:0 8px 0 3px;}.imgedit-rright.disabled:hover{background-position:-77px -31px;}.imgedit-rright:hover{background-position:-77px -1px;}.imgedit-flipv{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -115px -31px;margin:0 3px;}.imgedit-flipv.disabled:hover{background-position:-115px -31px;}.imgedit-flipv:hover{background-position:-115px -1px;}.imgedit-fliph{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -147px -31px;margin:0 8px 0 3px;}.imgedit-fliph.disabled:hover{background-position:-147px -31px;}.imgedit-fliph:hover{background-position:-147px -1px;}.imgedit-undo{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -184px -31px;margin:0 3px;}.imgedit-undo.disabled:hover{background-position:-184px -31px;}.imgedit-undo:hover{background-position:-184px -1px;}.imgedit-redo{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -215px -31px;margin:0 8px 0 3px;}.imgedit-redo.disabled:hover{background-position:-215px -31px;}.imgedit-redo:hover{background-position:-215px -1px;}.imgedit-applyto img{margin:0 8px 0 0;}.imgedit-group-top{margin:5px 0;}.imgedit-applyto .imgedit-label{padding:2px 0 0;display:block;}.imgedit-help{display:none;font-style:italic;margin-bottom:8px;}.imgedit-help ul li{font-size:11px;}a.imgedit-help-toggle{text-decoration:none;}#wpbody-content .imgedit-response div{width:600px;margin:8px;}.form-table td.imgedit-response{padding:0;}.imgedit-submit{margin:8px 0;}.imgedit-submit-btn{margin-left:20px;}.imgedit-wrap .nowrap{white-space:nowrap;}span.imgedit-scale-warn{color:red;font-size:20px;font-style:normal;visibility:hidden;vertical-align:middle;}.imgedit-group{border-width:1px;border-style:solid;-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;margin-bottom:8px;padding:2px 10px;}#dashboard_recent_comments div.undo{border-top-style:solid;border-top-width:1px;margin:0 -10px;padding:3px 8px;font-size:11px;}.trash-undo-inside,.spam-undo-inside{margin:1px 8px 1px 0;line-height:16px;}.spam-undo-inside .avatar,.trash-undo-inside .avatar{height:20px;width:20px;margin-right:8px;vertical-align:middle;}.taghint{color:#aaa;margin:15px 0 -24px 12px;}#poststuff .tagsdiv .howto{margin:0 0 6px 8px;}.ajaxtag .newtag{background:transparent;position:relative;}#broken-themes{text-align:left;width:50%;border-spacing:3px;padding:3px;}.describe .del-link{padding-left:5px;}.comment-ays{margin-bottom:0;border-style:solid;border-width:1px;}.comment-ays th{border-right-style:solid;border-right-width:1px;}div#custom-background-image{min-height:100px;border:1px solid #dfdfdf;}div#custom-background-image img{max-width:400px;max-height:300px;}#custom-background label{padding-right:15px;}.appearance_page_custom-header #headimg{border:1px solid #DFDFDF;min-height:100px;width:100%;}.appearance_page_custom-header #upload-form p label{font-size:11px;}.appearance_page_custom-header #available-headers .default-header{float:left;margin:0 20px 20px 0;}.appearance_page_custom-header #available-headers label input{margin-right:10px;}.appearance_page_custom-header #available-headers label img{vertical-align:middle;}.nav-tab{border-style:solid;border-color:#ccc #ccc #f9f9f9;border-width:1px 1px 0;color:#c1c1c1;text-shadow:rgba(255,255,255,1) 0 1px 0;font-size:12px;line-height:16px;display:inline-block;padding:4px 14px 6px;text-decoration:none;margin:0 6px -1px 0;-moz-border-radius:5px 5px 0 0;-webkit-border-top-left-radius:5px;-webkit-border-top-right-radius:5px;-khtml-border-top-left-radius:5px;-khtml-border-top-right-radius:5px;border-top-left-radius:5px;border-top-right-radius:5px;}.nav-tab-active{border-width:1px;color:#464646;}.themes-php .wrap h2,.theme-install-php .wrap h2{border-bottom:1px solid #ccc;padding-bottom:0;}h2 .nav-tab{padding:4px 20px 6px;font:italic normal normal 24px/35px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}body.update-php{height:98%;}
\ No newline at end of file
similarity index 89%
rename from wp-admin/wp-admin.dev.css
rename to wp-admin/css/wp-admin.dev.css
index 4813e8f4c51f0d07098b94c1d3d5b81daffd0329..cb84cc3383f5b6caedd7257971e6c65fa1bd1e38 100644 (file)
@@ -389,8 +389,8 @@ input.button-highlighted,
 #postcustomstuff .submit input {
        text-decoration: none;
        font-size: 11px !important;
-       line-height: 14px;
-       padding: 2px 8px;
+       line-height: 13px;
+       padding: 3px 8px;
        cursor: pointer;
        border-width: 1px;
        border-style: solid;
@@ -504,6 +504,7 @@ textarea.all-options, input.all-options {
        line-height: 150%;
        border: 0 none;
        outline: none;
+       resize: vertical;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -khtml-box-sizing: border-box;
@@ -528,7 +529,7 @@ textarea.all-options, input.all-options {
        padding: 0;
        margin-bottom: -3px;
        border-bottom-width: 3px;
-       background-image: url("images/ed-bg.gif");
+       background-image: url("../images/ed-bg.gif");
        background-position: left top;
        background-repeat: repeat-x;
 }
@@ -795,6 +796,7 @@ td.media-icon {
        text-align: center;
        width: 80px;
        padding-top: 8px;
+       padding-bottom: 8px;
 }
 
 td.media-icon img {
@@ -802,15 +804,23 @@ td.media-icon img {
        max-height: 60px;
 }
 
-#update-nag {
-       line-height: 29px;
+#update-nag, .update-nag {
+       line-height: 19px;
+       padding: 5px 0;
        font-size: 12px;
        text-align: center;
-}
-
-#update-nag {
-       border-width: 1px 0;
-       border-style: solid none;
+       margin: 0 15px;
+       border-width: 1px;
+       border-style: solid;
+       border-top-width: 0;
+       border-top-style: none;
+       -moz-border-radius: 0 0 6px 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;
 }
 
 .plugins .plugin-update {
@@ -844,7 +854,6 @@ div.comment-item:hover .row-actions {
 
 .row-actions-visible {
        padding: 2px 0 0;
-       cursor: pointer;
 }
 
 /* Admin Header */
@@ -896,28 +905,19 @@ div.comment-item:hover .row-actions {
        padding: 12px 10px 5px;
 }
 
-#wphead #site-visit-button {
-       background-repeat:repeat-x;
-       background-position:0 0;
-       -moz-border-radius:3px;
-       -webkit-border-radius:3px;
-       -khtml-border-radius:3px;
-       border-radius:3px;
-       cursor:pointer; /* to keep IE happy */
-       display:-moz-inline-stack; /* to keep FF2 happy */
-       display:inline-block;
+#wphead #privacy-on-link {
        font-size: 50%;
-       font-style:normal;
-       line-height:17px;
-       margin-left:5px;
-       padding:0 6px;
-       vertical-align:middle;
+       font-style: normal;
+       line-height: 17px;
+       padding: 0 6px;
+       vertical-align: middle;
 }
 
 #wphead h1 a:hover {
        text-decoration:none;
 }
-#wphead h1 a:hover #site-title {
+#wphead h1 a:hover #site-title,
+#wphead h1 a#privacy-on-link:hover {
        text-decoration:underline;
 }
 
@@ -1175,23 +1175,21 @@ div.comment-item:hover .row-actions {
 #sidemenu li a span.update-plugins {
        position: absolute;
        font-family: Helvetica, Arial, sans-serif;
-       font-size: 7pt;
+       font-size: 9px;
+       line-height: 17px;
        font-weight: bold;
-       margin-top: 2px;
-       margin-left: 2px;
-       -moz-border-radius: 7px;
-       -khtml-border-radius: 7px;
-       -webkit-border-radius: 7px;
-       border-radius: 7px;
+       margin-top: 1px;
+       margin-left: 7px;
+       -moz-border-radius: 10px;
+       -khtml-border-radius: 10px;
+       -webkit-border-radius: 10px;
+       border-radius: 10px;
 }
 
 #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;
 }
 
@@ -1257,7 +1255,9 @@ strong .post-com-count {
 
 /* Admin Footer */
 #footer {
-       margin-top: -45px;
+       margin-top: -46px;
+       border-top: 1px;
+       border-style: solid;
 }
 
 #footer,
@@ -1341,6 +1341,7 @@ strong .post-com-count {
        width: 10px;
 }
 
+input.large-text,
 textarea.large-text {
        width: 99%;
 }
@@ -1546,7 +1547,7 @@ span.description,
 
 #post-body .wp_themeSkin .mceStatusbar a.mceResize {
        display: block;
-       background: transparent url(images/resize.gif) no-repeat scroll right bottom;
+       background: transparent url(../images/resize.gif) no-repeat scroll right bottom;
        width: 12px;
        cursor: se-resize;
        margin: 0 2px;
@@ -1719,11 +1720,11 @@ div.inside {
 }
 
 .postbox.closed h3 {
-       -moz-border-radius-bottomleft:4px;
+       -moz-border-radius-bottomleft: 4px;
        -webkit-border-bottom-left-radius: 4px;
        -khtml-border-bottom-left-radius: 4px;
        border-bottom-left-radius: 4px;
-       -moz-border-radius-bottomright:4px;
+       -moz-border-radius-bottomright: 4px;
        -webkit-border-bottom-right-radius: 4px;
        -khtml-border-bottom-right-radius: 4px;
        border-bottom-right-radius: 4px;
@@ -1765,6 +1766,7 @@ div.inside {
 }
 
 #titlediv {
+       position: relative;
        margin-bottom: 20px;
 }
 #titlediv label { cursor: text; }
@@ -1788,10 +1790,18 @@ div.inside {
        -webkit-border-radius: 6px;
        border-radius: 6px;
        font-size: 1.7em;
+       line-height: 100%;
        width: 100%;
        outline: none;
 }
 
+#titlediv #title-prompt-text {
+       color: #bbb;
+       position: absolute;
+       font-size: 1.7em;
+       padding: 8px;
+}
+
 #poststuff .inside-submitbox,
 #side-sortables .inside-submitbox {
        margin: 0 3px;
@@ -1921,36 +1931,37 @@ input#link_url {
 
 /* Categories */
 
-#category-adder {
+.category-adder {
        margin-left: 120px;
        padding: 4px 0;
 }
 
-#category-adder h4 {
+.category-adder h4 {
        margin: 0 0 8px;
 }
 
-#side-sortables #category-adder {
+#side-sortables .category-adder {
        margin: 0;
 }
 
-#post-body #category-add input, #category-add select {
+#post-body .category-add input, .category-add select {
        width: 30%;
 }
 
-#side-sortables #category-add input {
+#side-sortables .category-add input {
        width: 94%;
 }
 
-#side-sortables #category-add select {
+#side-sortables .category-add select {
        width: 100%;
 }
 
-#category-add input#category-add-sumbit {
+#side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add input.category-add-sumbit {
        width: auto;
 }
 
-#post-body ul#category-tabs {
+#post-body ul.category-tabs,
+#post-body ul.add-menu-item-tabs {
        float: left;
        width: 120px;
        text-align: right;
@@ -1959,11 +1970,13 @@ input#link_url {
        padding: 0;
 }
 
-#post-body ul#category-tabs li {
+#post-body ul.category-tabs li,
+#post-body ul.add-menu-item-tabs li {
        padding: 8px;
 }
 
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs,
+#post-body ul.add-menu-item-tabs li.tabs {
        -moz-border-radius: 3px 0 0 3px;
        -webkit-border-top-left-radius: 3px;
        -webkit-border-bottom-left-radius: 3px;
@@ -1973,12 +1986,16 @@ input#link_url {
        border-bottom-left-radius: 3px;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a,
+#post-body ul.add-menu-item-tabs li.tabs a {
        font-weight: bold;
        text-decoration: none;
 }
 
-#categorydiv div.tabs-panel,
+.categorydiv div.tabs-panel,
+.customlinkdiv div.tabs-panel,
+.posttypediv div.tabs-panel,
+.taxonomydiv div.tabs-panel,
 #linkcategorydiv div.tabs-panel {
        height: 200px;
        overflow: auto;
@@ -1987,32 +2004,59 @@ input#link_url {
        border-width: 1px;
 }
 
-#post-body #categorydiv div.tabs-panel,
+.nav-menus-php .customlinkdiv div.tabs-panel,
+.nav-menus-php .posttypediv div.tabs-panel,
+.nav-menus-php .taxonomydiv div.tabs-panel {
+       height: auto;
+       max-height: 205px;
+}
+
+div.tabs-panel-active {
+       display:block;
+}
+
+div.tabs-panel-inactive {
+       display:none;
+}
+
+#post-body .categorydiv div.tabs-panel,
+.taxonomy div.tabs-panel,
 #post-body #linkcategorydiv div.tabs-panel {
        margin: 0 5px 0 125px;
 }
 
-#side-sortables #category-tabs li {
+#side-sortables .category-tabs li,
+#side-sortables .add-menu-item-tabs li {
        display: inline;
-       padding-right: 8px;
 }
 
-#side-sortables #category-tabs a {
+#side-sortables .category-tabs a,
+#side-sortables .add-menu-item-tabs a {
        text-decoration: none;
 }
 
-#side-sortables #category-tabs {
+#side-sortables .category-tabs,
+#side-sortables .add-menu-item-tabs {
        margin-bottom: 3px;
 }
 
-#categorydiv ul,
+.categorydiv ul,
+.customlinkdiv ul,
+.posttypediv ul,
+.taxonomydiv ul,
 #linkcategorydiv ul {
        list-style: none;
        padding: 0;
        margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul,
+#front-page-warning,
+#front-static-pages ul,
+.inline-editor ul.cat-checklist ul,
+.categorydiv ul.categorychecklist ul,
+.customlinkdiv ul.categorychecklist ul,
+.posttypediv ul.categorychecklist ul,
+.taxonomydiv ul.categorychecklist ul,
 #linkcategorydiv ul.categorychecklist ul {
        margin-left: 18px;
 }
@@ -2021,35 +2065,43 @@ ul.categorychecklist li {
        margin: 0;
        padding: 0;
        line-height: 19px;
+       word-wrap: break-word;
 }
 
-#category-adder h4 {
+.category-adder h4 {
        margin-top: 4px;
        margin-bottom: 0px;
 }
 
-#categorydiv .tabs-panel {
+.categorydiv .tabs-panel,
+.customlinkdiv .tabs-panel,
+.posttypediv .tabs-panel,
+.taxonomydiv .tabs-panel {
        border-width: 3px;
        border-style: solid;
 }
 
-ul#category-tabs {
+ul.category-tabs,
+ul.add-menu-item-tabs {
        margin-top: 12px;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs {
        border-style: solid solid none;
        border-width: 1px 1px 0;
 }
 
-#post-body #category-tabs li.tabs {
+#post-body .category-tabs li.tabs,
+#post-body .add-menu-item-tabs li.tabs {
        border-style: solid none solid solid;
        border-width: 1px 0 1px 1px;
        margin-right: -1px;
 }
 
-ul#category-tabs li {
-       padding: 5px 8px;
+ul.category-tabs li,
+ul.add-menu-item-tabs li {
+       padding: 5px;
        -moz-border-radius: 3px 3px 0 0;
        -webkit-border-top-left-radius: 3px;
        -webkit-border-top-right-radius: 3px;
@@ -2102,8 +2154,7 @@ td.plugin-title {
 /* Global classes */
 
 .wp-hidden-children .wp-hidden-child,
-.ui-tabs-hide,
-#codepress-off {
+.ui-tabs-hide {
        display: none;
 }
 
@@ -2404,8 +2455,9 @@ fieldset {
 
 #replysubmit img.waiting,
 .inline-edit-save img.waiting {
-       padding: 2px 10px 0;
+       padding: 4px 10px 0;
        vertical-align: top;
+       float: right;
 }
 
 #replysubmit .button {
@@ -2471,7 +2523,7 @@ fieldset {
 }
 
 #screen-meta-links {
-       margin: 0 9px 0 0;
+       margin: 0 18px 0 0;
 }
 
 #screen-meta .screen-reader-text {
@@ -2481,11 +2533,20 @@ fieldset {
 #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;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       background: #e3e3e3;
+       -moz-border-radius-bottomleft: 3px;
+       -moz-border-radius-bottomright: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       -webkit-border-bottom-right-radius: 3px;
+}
+
+#contextual-help-wrap li {
+       list-style-type: disc;
+       margin-left: 18px;
 }
 
 #screen-meta a.show-settings {
@@ -2501,7 +2562,7 @@ fieldset {
 }
 
 #screen-meta a.show-settings {
-       background-image: url( images/screen-options-right.gif );
+       background-image: url( ../images/screen-options-right.gif?ver=20100531 );
 }
 
 #screen-meta a.show-settings:hover {
@@ -2837,7 +2898,7 @@ table .inline-edit-row fieldset ul.cat-hover {
 }
 
 .describe .media-item-info .A1B1 {
-       padding: 0 15px 8px 0;
+       padding: 0 0 0 10px;
 }
 
 #wpbody-content .filename {
@@ -2895,6 +2956,7 @@ abbr.required {
        padding: 0 0 0 5px;
 }
 
+.media-item .error-div a.dismiss,
 .describe-toggle-on,
 .describe-toggle-off {
        display: block;
@@ -2931,6 +2993,10 @@ abbr.required {
        overflow: hidden;
 }
 
+.media-item .error-div {
+       padding-left: 10px;
+}
+
 .media-item .pinkynail {
        float: left;
        margin: 2px;
@@ -2946,7 +3012,7 @@ abbr.required {
 .media-item .original {
        position: relative;
        height: 34px;
-       text-align: center;
+       width: 503px;
 }
 
 .media-item .percent {
@@ -2960,20 +3026,6 @@ abbr.required {
        margin-right: 5px;
 }
 
-button.dismiss {
-       position: absolute;
-       top: 7px;
-       right: 5px;
-       z-index: 4;
-       width: 8em;
-}
-
-.file-error {
-       float: left;
-       font-weight: bold;
-       padding: 10px;
-}
-
 .progress {
        position: relative;
        margin-bottom: -36px;
@@ -3074,7 +3126,7 @@ button.dismiss {
 
 #favorite-inside {
        margin: 0 0 0 0px;
-       padding: 0 1px 6px 1px;
+       padding: 2px 1px;
        border-width: 1px;
        border-style: solid;
        position: absolute;
@@ -3115,8 +3167,7 @@ button.dismiss {
        -khtml-border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+       border-bottom: none;
 }
 
 #utc-time, #local-time {
@@ -3374,7 +3425,7 @@ td.imgedit-settings input {
 .imgedit-wait {
        position: absolute;
        top: 0;
-       background: #FFFFFF url(images/wpspin_light.gif) no-repeat scroll 22px 10px;
+       background: #FFFFFF url(../images/wpspin_light.gif) no-repeat scroll 22px 10px;
        opacity: 0.7;
        filter: alpha(opacity=70);
        width: 100%;
@@ -3415,7 +3466,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-crop {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -9px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -9px -31px;
        margin: 0 8px 0 0;
 }
 
@@ -3428,7 +3479,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-rleft {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -46px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -46px -31px;
        margin: 0 3px;
 }
 
@@ -3441,7 +3492,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-rright {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -77px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -77px -31px;
        margin: 0 8px 0 3px;
 }
 
@@ -3454,7 +3505,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-flipv {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -115px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -115px -31px;
        margin: 0 3px;
 }
 
@@ -3467,7 +3518,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-fliph {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -147px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -147px -31px;
        margin: 0 8px 0 3px;
 }
 
@@ -3480,7 +3531,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-undo {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -184px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -184px -31px;
        margin: 0 3px;
 }
 
@@ -3493,7 +3544,7 @@ td.imgedit-settings input {
 }
 
 .imgedit-redo {
-       background: transparent url(images/imgedit-icons.png) no-repeat scroll -215px -31px;
+       background: transparent url(../images/imgedit-icons.png) no-repeat scroll -215px -31px;
        margin: 0 8px 0 3px;
 }
 
@@ -3597,7 +3648,7 @@ span.imgedit-scale-warn {
 /* tag hints */
 .taghint {
        color: #aaa;
-       margin: 14px 0 -17px 8px;
+       margin: 15px 0 -24px 12px;
 }
 
 #poststuff .tagsdiv .howto {
@@ -3630,3 +3681,86 @@ span.imgedit-scale-warn {
        border-right-style: solid;
        border-right-width: 1px;
 }
+
+/* Custom Background  */
+
+div#custom-background-image {
+       min-height: 100px;
+       border: 1px solid #dfdfdf;
+}
+
+div#custom-background-image img {
+       max-width: 400px;
+       max-height: 300px;
+}
+
+#custom-background label {
+       padding-right: 15px;
+}
+
+/* Custom Header */
+.appearance_page_custom-header #headimg {
+       border: 1px solid #DFDFDF;
+       min-height: 100px;
+       width: 100%;
+}
+
+.appearance_page_custom-header #upload-form p label {
+       font-size: 11px;
+}
+
+.appearance_page_custom-header  #available-headers .default-header {
+       float: left;
+       margin: 0 20px 20px 0;
+}
+
+.appearance_page_custom-header #available-headers label input {
+       margin-right: 10px;
+}
+
+.appearance_page_custom-header #available-headers label img {
+       vertical-align: middle;
+}
+
+/* Tab Interface */
+
+.nav-tab {
+       border-style: solid;
+       border-color: #ccc #ccc #f9f9f9;
+       border-width: 1px 1px 0;
+       color: #c1c1c1;
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
+       font-size: 12px;
+       line-height: 16px;
+       display: inline-block;
+       padding: 4px 14px 6px;
+       text-decoration: none;
+       margin: 0 6px -1px 0;
+       -moz-border-radius: 5px 5px 0 0;
+       -webkit-border-top-left-radius: 5px;
+       -webkit-border-top-right-radius: 5px;
+       -khtml-border-top-left-radius: 5px;
+       -khtml-border-top-right-radius: 5px;
+       border-top-left-radius: 5px;
+       border-top-right-radius: 5px;
+}
+
+.nav-tab-active {
+       border-width: 1px;
+       color: #464646;
+}
+
+.themes-php .wrap h2, .theme-install-php .wrap h2 {
+       border-bottom: 1px solid #ccc;
+       padding-bottom: 0;
+}
+
+h2 .nav-tab {
+       padding: 4px 20px 6px;
+       font: italic normal normal 24px/35px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+/* Scrollbar fix for bulk upgrade iframe */
+body.update-php {
+       height: 98%;
+}
diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php
new file mode 100644 (file)
index 0000000..413c564
--- /dev/null
@@ -0,0 +1,359 @@
+<?php
+/**
+ * The custom background script.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The custom background class.
+ *
+ * @since 3.0.0
+ * @package WordPress
+ * @subpackage Administration
+ */
+class Custom_Background {
+
+       /**
+        * Callback for administration header.
+        *
+        * @var callback
+        * @since unknown
+        * @access private
+        */
+       var $admin_header_callback;
+
+       /**
+        * Callback for header div.
+        *
+        * @var callback
+        * @since 3.0.0
+        * @access private
+        */
+       var $admin_image_div_callback;
+
+       /**
+        * Holds the page menu hook.
+        *
+        * @var string
+        * @since 3.0.0
+        * @access private
+        */
+       var $page = '';
+
+       /**
+        * PHP4 Constructor - Register administration header callback.
+        *
+        * @since 3.0.0
+        * @param callback $admin_header_callback
+        * @param callback $admin_image_div_callback Optional custom image div output callback.
+        * @return Custom_Background
+        */
+       function Custom_Background($admin_header_callback = '', $admin_image_div_callback = '') {
+               $this->admin_header_callback = $admin_header_callback;
+               $this->admin_image_div_callback = $admin_image_div_callback;
+       }
+
+       /**
+        * Set up the hooks for the Custom Background admin page.
+        *
+        * @since 3.0.0
+        */
+       function init() {
+               if ( ! current_user_can('edit_theme_options') )
+                       return;
+
+               $this->page = $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array(&$this, 'admin_page'));
+
+               add_action("load-$page", array(&$this, 'admin_load'));
+               add_action("load-$page", array(&$this, 'take_action'), 49);
+               add_action("load-$page", array(&$this, 'handle_upload'), 49);
+
+               if ( $this->admin_header_callback )
+                       add_action("admin_head-$page", $this->admin_header_callback, 51);
+       }
+
+       /**
+        * Set up the enqueue for the CSS & JavaScript files.
+        *
+        * @since 3.0.0
+        */
+       function admin_load() {
+               add_contextual_help( $this->page, '<p>' . __( 'You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.' ) . '</p>' .
+               '<p>' . __( 'To use a background image, simply upload it, then choose your display options below. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' .
+               '<p>' . __( 'You can also choose a background color. If you know the hexadecimal code for the color you want, enter it in the Color field. If not, click on the Select a Color link, and a color picker will allow you to choose the exact shade you want.' ) . '</p>' .
+               '<p>' . __( 'Don&#8217;t forget to click on the Save Changes button when you are finished.' ) . '</p>' .
+               '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+               '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Background_SubPanel" target="_blank">Documentation on Custom Background</a>' ) . '</p>' .
+               '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' );
+               wp_enqueue_script('custom-background');
+               wp_enqueue_style('farbtastic');
+       }
+
+       /**
+        * Execute custom background modification.
+        *
+        * @since 3.0.0
+        */
+       function take_action() {
+
+               if ( empty($_POST) )
+                       return;
+
+               if ( isset($_POST['reset-background']) ) {
+                       check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset');
+                       remove_theme_mod('background_image');
+                       remove_theme_mod('background_image_thumb');
+                       $this->updated = true;
+                       return;
+               }
+
+               if ( isset($_POST['remove-background']) ) {
+                       // @TODO: Uploaded files are not removed here.
+                       check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove');
+                       set_theme_mod('background_image', '');
+                       set_theme_mod('background_image_thumb', '');
+                       $this->updated = true;
+                       return;
+               }
+
+               if ( isset($_POST['background-repeat']) ) {
+                       check_admin_referer('custom-background');
+                       if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) )
+                               $repeat = $_POST['background-repeat'];
+                       else
+                               $repeat = 'repeat';
+                       set_theme_mod('background_repeat', $repeat);
+               }
+
+               if ( isset($_POST['background-position-x']) ) {
+                       check_admin_referer('custom-background');
+                       if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) )
+                               $position = $_POST['background-position-x'];
+                       else
+                               $position = 'left';
+                       set_theme_mod('background_position_x', $position);
+               }
+
+               if ( isset($_POST['background-attachment']) ) {
+                       check_admin_referer('custom-background');
+                       if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
+                               $attachment = $_POST['background-attachment'];
+                       else
+                               $attachment = 'fixed';
+                       set_theme_mod('background_attachment', $attachment);
+               }
+
+               if ( isset($_POST['background-color']) ) {
+                       check_admin_referer('custom-background');
+                       $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']);
+                       if ( strlen($color) == 6 || strlen($color) == 3 )
+                               set_theme_mod('background_color', $color);
+                       else
+                               set_theme_mod('background_color', '');
+               }
+
+               $this->updated = true;
+       }
+
+       /**
+        * Display the custom background page.
+        *
+        * @since 3.0.0
+        */
+       function admin_page() {
+?>
+<div class="wrap" id="custom-background">
+<?php screen_icon(); ?>
+<h2><?php _e('Custom Background'); ?></h2>
+<?php if ( !empty($this->updated) ) { ?>
+<div id="message" class="updated">
+<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
+</div>
+<?php }
+
+       if ( $this->admin_image_div_callback ) {
+               call_user_func($this->admin_image_div_callback);
+       } else {
+?>
+<h3><?php _e('Background Image'); ?></h3>
+<table class="form-table">
+<tbody>
+<tr valign="top">
+<th scope="row"><?php _e('Preview'); ?></th>
+<td>
+<?php
+$background_styles = '';
+if ( $bgcolor = get_background_color() )
+       $background_styles .= 'background-color: #' . $bgcolor . ';';
+
+if ( get_background_image() ) {
+       // background-image URL must be single quote, see below
+       $background_styles .= ' background-image: url(\'' . get_theme_mod('background_image_thumb', '') . '\');'
+               . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
+               . ' background-position: top ' . get_theme_mod('background_position_x', 'left');
+}
+?>
+<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
+<?php if ( get_background_image() ) { ?>
+<img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" alt="" /><br />
+<img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" alt="" />
+<?php } ?>
+</div>
+<?php } ?>
+</td>
+</tr>
+<?php if ( get_background_image() ) : ?>
+<tr valign="top">
+<th scope="row"><?php _e('Remove Image'); ?></th>
+<td>
+<form method="post" action="">
+<?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?>
+<input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background Image'); ?>" /><br/>
+<?php _e('This will remove the background image. You will not be able to restore any customizations.') ?>
+</form>
+</td>
+</tr>
+<?php endif; ?>
+
+<?php if ( defined( 'BACKGROUND_IMAGE' ) ) : // Show only if a default background image exists ?>
+<tr valign="top">
+<th scope="row"><?php _e('Restore Original Image'); ?></th>
+<td>
+<form method="post" action="">
+<?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?>
+<input type="submit" class="button" name="reset-background" value="<?php esc_attr_e('Restore Original Image'); ?>" /><br/>
+<?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?>
+</form>
+</td>
+</tr>
+
+<?php endif; ?>
+<tr valign="top">
+<th scope="row"><?php _e('Upload Image'); ?></th>
+<td><form enctype="multipart/form-data" id="upload-form" method="post" action="">
+<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
+<input type="hidden" name="action" value="save" />
+<?php wp_nonce_field('custom-background-upload', '_wpnonce-custom-background-upload') ?>
+<input type="submit" class="button" value="<?php esc_attr_e('Upload'); ?>" />
+</p>
+</form>
+</td>
+</tr>
+</tbody>
+</table>
+
+<h3><?php _e('Display Options') ?></h3>
+<form method="post" action="">
+<table class="form-table">
+<tbody>
+<?php if ( get_background_image() ) : ?>
+<tr valign="top">
+<th scope="row"><?php _e( 'Position' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
+<label>
+<input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', 'left')); ?> />
+<?php _e('Left') ?>
+</label>
+<label>
+<input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', 'left')); ?> />
+<?php _e('Center') ?>
+</label>
+<label>
+<input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', 'left')); ?> />
+<?php _e('Right') ?>
+</label>
+</fieldset></td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><?php _e( 'Repeat' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
+<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?>> <?php _e('No Repeat'); ?></option></label>
+       <label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?>> <?php _e('Tile'); ?></option></label>
+       <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>> <?php _e('Tile Horizontally'); ?></option></label>
+       <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>> <?php _e('Tile Vertically'); ?></option></label>
+</fieldset></td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><?php _e( 'Attachment' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
+<label>
+<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> />
+<?php _e('Scroll') ?>
+</label>
+<label>
+<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> />
+<?php _e('Fixed') ?>
+</label>
+</fieldset></td>
+</tr>
+<?php endif; // get_background_image() ?>
+<tr valign="top">
+<th scope="row"><?php _e( 'Color' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend>
+<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" />
+<a class="hide-if-no-js" href="#" id="pickcolor"><?php _e('Select a Color'); ?></a>
+<div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
+</fieldset></td>
+</tr>
+</tbody>
+</table>
+
+<?php wp_nonce_field('custom-background'); ?>
+<p class="submit"><input type="submit" class="button-primary" name="save-background-options" value="<?php esc_attr_e('Save Changes'); ?>" /></p>
+</form>
+
+</div>
+<?php
+       }
+
+       /**
+        * Handle a Image upload for the background image.
+        *
+        * @since 3.0.0
+        */
+       function handle_upload() {
+
+               if ( empty($_FILES) )
+                       return;
+
+               check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload');
+               $overrides = array('test_form' => false);
+               $file = wp_handle_upload($_FILES['import'], $overrides);
+
+               if ( isset($file['error']) )
+                       wp_die( $file['error'] );
+
+               $url = $file['url'];
+               $type = $file['type'];
+               $file = $file['file'];
+               $filename = basename($file);
+
+               // Construct the object array
+               $object = array(
+                       'post_title' => $filename,
+                       'post_content' => $url,
+                       'post_mime_type' => $type,
+                       'guid' => $url
+               );
+
+               // Save the data
+               $id = wp_insert_attachment($object, $file);
+
+               // Add the meta-data
+               wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+
+               set_theme_mod('background_image', esc_url($url));
+
+               $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
+               set_theme_mod('background_image_thumb', esc_url( $thumbnail[0] ) );
+
+               do_action('wp_create_file_in_uploads', $file, $id); // For replication
+               $this->updated = true;
+       }
+
+}
+?>
index fb07fe8013af3e5d6a7e2cb14b55ffe8b53a590b..7e889f5b55e433cd63e576ba5e5c323b6dba2c26 100644 (file)
@@ -9,7 +9,7 @@
 /**
  * The custom header image class.
  *
- * @since unknown
+ * @since 2.1.0
  * @package WordPress
  * @subpackage Administration
  */
@@ -19,41 +19,88 @@ class Custom_Image_Header {
         * Callback for administration header.
         *
         * @var callback
-        * @since unknown
+        * @since 2.1.0
         * @access private
         */
        var $admin_header_callback;
 
+       /**
+        * Callback for header div.
+        *
+        * @var callback
+        * @since 3.0.0
+        * @access private
+        */
+       var $admin_image_div_callback;
+
+       /**
+        * Holds default headers.
+        *
+        * @var array
+        * @since 3.0.0
+        * @access private
+        */
+       var $default_headers = array();
+
+       /**
+        * Holds the page menu hook.
+        *
+        * @var string
+        * @since 3.0.0
+        * @access private
+        */
+       var $page = '';
+
        /**
         * PHP4 Constructor - Register administration header callback.
         *
-        * @since unknown
+        * @since 2.1.0
         * @param callback $admin_header_callback
+        * @param callback $admin_image_div_callback Optional custom image div output callback.
         * @return Custom_Image_Header
         */
-       function Custom_Image_Header($admin_header_callback) {
+       function Custom_Image_Header($admin_header_callback, $admin_image_div_callback = '') {
                $this->admin_header_callback = $admin_header_callback;
+               $this->admin_image_div_callback = $admin_image_div_callback;
        }
 
        /**
-        * Setup the hooks for the Custom Header admin page.
+        * Set up the hooks for the Custom Header admin page.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function init() {
-               $page = add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
+               if ( ! current_user_can('edit_theme_options') )
+                       return;
+
+               $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', '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, 'help') );
                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);
        }
 
+       /**
+        * Adds contextual help.
+        *
+        * @since 3.0.0
+        */
+       function help() {
+               add_contextual_help( $this->page, '<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately.' ) . '</p>' .
+               '<p>' . __( 'If you want to discard your custom header and go back to the default included in your theme, click on the buttons to remove the custom image and restore the original header image.' ) . '</p>' .
+               '<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the Save Changes button.' ) . '</p>' .
+               '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+               '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Header_SubPanel" target="_blank">Documentation on Custom Header</a>' ) . '</p>' .
+               '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' );
+       }
+
        /**
         * Get the current step.
         *
-        * @since unknown
+        * @since 2.6.0
         *
         * @return int Current step
         */
@@ -69,142 +116,238 @@ class Custom_Image_Header {
        }
 
        /**
-        * Setup the enqueue for the JavaScript files.
+        * Set up the enqueue for the JavaScript files.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function js_includes() {
                $step = $this->step();
 
-               if ( 1 == $step )
+               if ( ( 1 == $step || 3 == $step ) && $this->header_text() )
                        wp_enqueue_script('farbtastic');
                elseif ( 2 == $step )
-                       wp_enqueue_script('jcrop');
+                       wp_enqueue_script('imgareaselect');
        }
 
        /**
-        * Setup the enqueue for the CSS files
+        * Set up the enqueue for the CSS files
         *
         * @since 2.7
         */
        function css_includes() {
                $step = $this->step();
 
-               if ( 1 == $step )
+               if ( ( 1 == $step || 3 == $step ) && $this->header_text() )
                        wp_enqueue_style('farbtastic');
                elseif ( 2 == $step )
-                       wp_enqueue_style('jcrop');
+                       wp_enqueue_style('imgareaselect');
+       }
+
+       /**
+        * Check if header text is allowed
+        *
+        * @since 3.0.0
+        */
+       function header_text() {
+               if ( defined( 'NO_HEADER_TEXT' ) && NO_HEADER_TEXT )
+                       return false;
+
+               return true;
        }
 
        /**
         * Execute custom header modification.
         *
-        * @since unknown
+        * @since 2.6.0
         */
        function take_action() {
-               if ( isset( $_POST['textcolor'] ) ) {
-                       check_admin_referer('custom-header');
-                       if ( 'blank' == $_POST['textcolor'] ) {
-                               set_theme_mod('header_textcolor', 'blank');
+               if ( ! current_user_can('edit_theme_options') )
+                       return;
+
+               if ( empty( $_POST ) )
+                       return;
+
+               $this->updated = true;
+
+               if ( isset( $_POST['resetheader'] ) ) {
+                       check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+                       remove_theme_mod( 'header_image' );
+                       return;
+               }
+
+               if ( isset( $_POST['resettext'] ) ) {
+                       check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+                       remove_theme_mod('header_textcolor');
+                       return;
+               }
+
+               if ( isset( $_POST['removeheader'] ) ) {
+                       check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+                       set_theme_mod( 'header_image', '' );
+                       return;
+               }
+
+               if ( isset( $_POST['text-color'] ) ) {
+                       check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+                       $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );
+                       if ( 'blank' == $_POST['text-color'] ) {
+                               set_theme_mod( 'header_textcolor', 'blank' );
                        } else {
-                               $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
+                               $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
                                if ( strlen($color) == 6 || strlen($color) == 3 )
                                        set_theme_mod('header_textcolor', $color);
                        }
                }
-               if ( isset($_POST['resetheader']) ) {
-                       check_admin_referer('custom-header');
-                       remove_theme_mods();
+
+               if ( isset($_POST['default-header']) ) {
+                       check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+                       $this->process_default_headers();
+                       if ( isset($this->default_headers[$_POST['default-header']]) )
+                               set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url']));
+               }
+       }
+
+       /**
+        * Process the default headers
+        *
+        * @since 3.0.0
+        */
+       function process_default_headers() {
+               global $_wp_default_headers;
+
+               if ( !empty($this->headers) )
+                       return;
+
+               if ( !isset($_wp_default_headers) )
+                       return;
+
+               $this->default_headers = $_wp_default_headers;
+               foreach ( array_keys($this->default_headers) as $header ) {
+                       $this->default_headers[$header]['url'] =  sprintf( $this->default_headers[$header]['url'], get_template_directory_uri(), get_stylesheet_directory_uri() );
+                       $this->default_headers[$header]['thumbnail_url'] =  sprintf( $this->default_headers[$header]['thumbnail_url'], get_template_directory_uri(), get_stylesheet_directory_uri() );
+               }
+       }
+
+       /**
+        * Display UI for selecting one of several default headers.
+        *
+        * @since 3.0.0
+        */
+       function show_default_header_selector() {
+               echo '<div id="available-headers">';
+               foreach ( $this->default_headers as $header_key => $header ) {
+                       $header_thumbnail = $header['thumbnail_url'];
+                       $header_url = $header['url'];
+                       $header_desc = $header['description'];
+                       echo '<div class="default-header">';
+                       echo '<label><input name="default-header" type="radio" value="' . esc_attr($header_key) . '" ' . checked($header_url, get_theme_mod( 'header_image' ), false) . ' />';
+                       echo '<img src="' . $header_thumbnail . '" alt="' . esc_attr($header_desc) .'" title="' . esc_attr($header_desc) .'" /></label>';
+                       echo '</div>';
                }
+               echo '<div class="clear"></div></div>';
        }
 
        /**
         * Execute Javascript depending on step.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function js() {
                $step = $this->step();
-               if ( 1 == $step )
+               if ( ( 1 == $step || 3 == $step ) && $this->header_text() )
                        $this->js_1();
                elseif ( 2 == $step )
                        $this->js_2();
        }
 
        /**
-        * Display Javascript based on Step 1.
+        * Display Javascript based on Step 1 and 3.
         *
-        * @since unknown
+        * @since 2.6.0
         */
        function js_1() { ?>
 <script type="text/javascript">
-       var buttons = ['#name', '#desc', '#pickcolor', '#defaultcolor'];
+/* <![CDATA[ */
+       var text_objects = ['#name', '#desc', '#text-color-row'];
        var farbtastic;
+       var default_color = '#<?php echo HEADER_TEXTCOLOR; ?>';
+       var old_color = null;
 
        function pickColor(color) {
                jQuery('#name').css('color', color);
                jQuery('#desc').css('color', color);
-               jQuery('#textcolor').val(color);
+               jQuery('#text-color').val(color);
                farbtastic.setColor(color);
        }
 
+       function toggle_text(s) {
+               if (jQuery(s).attr('id') == 'showtext' && jQuery('#text-color').val() != 'blank')
+                       return;
+
+               if (jQuery(s).attr('id') == 'hidetext' && jQuery('#text-color').val() == 'blank')
+                       return;
+
+               if (jQuery('#text-color').val() == 'blank') {
+                       //Show text
+                       if (old_color == '#blank')
+                               old_color = default_color;
+
+                       jQuery( text_objects.toString() ).show();
+                       jQuery('#text-color').val(old_color);
+                       jQuery('#name').css('color', old_color);
+                       jQuery('#desc').css('color', old_color);
+                       pickColor(old_color);
+               } else {
+                       //Hide text
+                       jQuery( text_objects.toString() ).hide();
+                       old_color = jQuery('#text-color').val();
+                       jQuery('#text-color').val('blank');
+               }
+       }
+
        jQuery(document).ready(function() {
                jQuery('#pickcolor').click(function() {
-                       jQuery('#colorPickerDiv').show();
+                       jQuery('#color-picker').show();
                });
 
-               jQuery('#hidetext').click(function() {
-                       toggle_text();
+               jQuery('input[name="hidetext"]').click(function() {
+                       toggle_text(this);
                });
 
-               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 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);
-                       }
+               jQuery('#defaultcolor').click(function() {
+                       pickColor(default_color);
+                       jQuery('#text-color').val(default_color)
                });
-       }
 
-       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'); ?>');
-               }
-       }
+               jQuery('#text-color').keyup(function() {
+                       var _hex = jQuery('#text-color').val();
+                       var hex = _hex;
+                       if ( hex[0] != '#' )
+                               hex = '#' + hex;
+                       hex = hex.replace(/[^#a-fA-F0-9]+/, '');
+                       if ( hex != _hex )
+                               jQuery('#text-color').val(hex);
+                       if ( hex.length == 4 || hex.length == 7 )
+                               pickColor( hex );
+               });
 
+               jQuery(document).mousedown(function(){
+                       jQuery('#color-picker').each( function() {
+                               var display = jQuery(this).css('display');
+                               if (display == 'block')
+                                       jQuery(this).fadeOut(2);
+                       });
+               });
 
+               farbtastic = jQuery.farbtastic('#color-picker', function(color) { pickColor(color); });
+               <?php if ( $color = get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
+               pickColor('#<?php echo $color; ?>');
+               <?php } ?>
 
+               <?php if ( 'blank' == get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) || '' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || ! $this->header_text() ) { ?>
+               toggle_text();
+               <?php } ?>
+               });
 </script>
 <?php
        }
@@ -212,34 +355,24 @@ class Custom_Image_Header {
        /**
         * Display Javascript based on Step 2.
         *
-        * @since unknown
+        * @since 2.6.0
         */
        function js_2() { ?>
 <script type="text/javascript">
+/* <![CDATA[ */
        function onEndCrop( coords ) {
                jQuery( '#x1' ).val(coords.x);
                jQuery( '#y1' ).val(coords.y);
-               jQuery( '#x2' ).val(coords.x2);
-               jQuery( '#y2' ).val(coords.y2);
                jQuery( '#width' ).val(coords.w);
                jQuery( '#height' ).val(coords.h);
        }
 
-       // with a supplied 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();
-
-               //set up default values
-               jQuery( '#x1' ).val(0);
-               jQuery( '#y1' ).val(0);
-               jQuery( '#x2' ).val(xinit);
-               jQuery( '#y2' ).val(yinit);
-               jQuery( '#width' ).val(xinit);
-               jQuery( '#height' ).val(yinit);
+               var ximg = jQuery('img#upload').width();
+               var yimg = jQuery('img#upload').height();
 
                if ( yimg < yinit || ximg < xinit ) {
                        if ( ximg / yimg > ratio ) {
@@ -251,12 +384,30 @@ class Custom_Image_Header {
                        }
                }
 
-               jQuery('#upload').Jcrop({
-                       aspectRatio: ratio,
-                       setSelect: [ 0, 0, xinit, yinit ],
-                       onSelect: onEndCrop
+               jQuery('img#upload').imgAreaSelect({
+                       handles: true,
+                       keys: true,
+                       aspectRatio: xinit + ':' + yinit,
+                       show: true,
+                       x1: 0,
+                       y1: 0,
+                       x2: xinit,
+                       y2: yinit,
+                       maxHeight: <?php echo HEADER_IMAGE_HEIGHT; ?>,
+                       maxWidth: <?php echo HEADER_IMAGE_WIDTH; ?>,
+                       onInit: function () {
+                               jQuery('#width').val(xinit);
+                               jQuery('#height').val(yinit);
+                       },
+                       onSelectChange: function(img, c) {
+                               jQuery('#x1').val(c.x1);
+                               jQuery('#y1').val(c.y1);
+                               jQuery('#width').val(c.width);
+                               jQuery('#height').val(c.height);
+                       }
                });
        });
+/* ]]> */
 </script>
 <?php
        }
@@ -264,74 +415,164 @@ class Custom_Image_Header {
        /**
         * Display first step of custom header image page.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function step_1() {
-               if ( $_GET['updated'] ) { ?>
-<div id="message" class="updated fade">
-<p><?php _e('Header updated.') ?></p>
-</div>
-               <?php } ?>
+               $this->process_default_headers();
+?>
 
 <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('Custom Header'); ?></h2>
 
-<div id="headimg" style="background-image: url(<?php esc_url(header_image()) ?>);">
-<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
-<div id="desc"><?php bloginfo('description');?></div>
+<?php if ( ! empty( $this->updated ) ) { ?>
+<div id="message" class="updated">
+<p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
 </div>
-<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
-<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
-<input type="button" class="button" value="<?php esc_attr_e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
-<input type="button" class="button" value="<?php esc_attr_e('Select a Text Color'); ?>" id="pickcolor" /><input type="button" class="button" value="<?php esc_attr_e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
-<?php wp_nonce_field('custom-header') ?>
-<input type="hidden" name="textcolor" id="textcolor" value="#<?php esc_attr(header_textcolor()) ?>" /><input name="submit" type="submit" class="button" value="<?php esc_attr_e('Save Changes'); ?>" /></form>
 <?php } ?>
 
-<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"> </div>
-</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>
-<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
-
-<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo esc_attr(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
-<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
-<input type="hidden" name="action" value="save" />
-<?php wp_nonce_field('custom-header') ?>
-<p class="submit">
-<input type="submit" value="<?php esc_attr_e('Upload'); ?>" />
-</p>
-</form>
+<h3><?php _e( 'Header Image' ) ?></h3>
+<table class="form-table">
+<tbody>
 
-</div>
 
-               <?php if ( get_theme_mod('header_image') || get_theme_mod('header_textcolor') ) : ?>
-<div class="wrap">
-<h2><?php _e('Reset Header Image and Color'); ?></h2>
-<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
-<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)) ?>">
-<?php wp_nonce_field('custom-header'); ?>
-<input type="submit" class="button" name="resetheader" value="<?php esc_attr_e('Restore Original Header'); ?>" />
+<tr valign="top">
+<th scope="row"><?php _e( 'Preview' ); ?></th>
+<td >
+       <?php if ( $this->admin_image_div_callback ) {
+         call_user_func( $this->admin_image_div_callback );
+       } else {
+       ?>
+       <div id="headimg" style="max-width:<?php echo HEADER_IMAGE_WIDTH; ?>px;height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;background-image:url(<?php esc_url ( header_image() ) ?>);">
+               <?php
+               if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || '' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || ! $this->header_text() )
+                       $style = ' style="display:none;"';
+               else
+                       $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"';
+               ?>
+               <h1><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a></h1>
+               <div id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
+       </div>
+       <?php } ?>
+</td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><?php _e( 'Upload Image' ); ?></th>
+<td>
+       <p><?php _e( 'You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image.' ); ?><br />
+       <?php printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); ?></p>
+       <form enctype="multipart/form-data" id="upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
+       <p>
+               <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
+               <input type="file" id="upload" name="import" />
+               <input type="hidden" name="action" value="save" />
+               <?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ) ?>
+               <input type="submit" class="button" value="<?php esc_attr_e( 'Upload' ); ?>" />
+       </p>
+       </form>
+</td>
+</tr>
+</tbody>
+</table>
+
+<form method="post" action="<?php echo esc_attr( add_query_arg( 'step', 1 ) ) ?>">
+<table class="form-table">
+<tbody>
+       <?php if ( ! empty( $this->default_headers ) ) : ?>
+<tr valign="top">
+<th scope="row"><?php _e( 'Default Images' ); ?></th>
+<td>
+       <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers.' ) ?></p>
+       <?php
+               $this->show_default_header_selector();
+       ?>
+</td>
+</tr>
+       <?php endif;
+
+       if ( get_header_image() ) : ?>
+<tr valign="top">
+<th scope="row"><?php _e( 'Remove Image' ); ?></th>
+<td>
+       <p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p>
+       <input type="submit" class="button" name="removeheader" value="<?php esc_attr_e( 'Remove Header Image' ); ?>" />
+</td>
+</tr>
+       <?php endif;
+
+       if ( defined( 'HEADER_IMAGE' ) ) : ?>
+<tr valign="top">
+<th scope="row"><?php _e( 'Reset Image' ); ?></th>
+<td>
+       <p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p>
+       <input type="submit" class="button" name="resetheader" value="<?php esc_attr_e( 'Restore Original Header Image' ); ?>" />
+</td>
+</tr>
+       <?php endif; ?>
+</tbody>
+</table>
+
+       <?php if ( $this->header_text() ) : ?>
+<h3><?php _e( 'Header Text' ) ?></h3>
+<table class="form-table">
+<tbody>
+<tr valign="top" class="hide-if-no-js">
+<th scope="row"><?php _e( 'Display Text' ); ?></th>
+<td>
+       <p>
+       <?php $hidetext = get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ); ?>
+       <label><input type="radio" value="1" name="hidetext" id="hidetext"<?php checked( ( 'blank' == $hidetext || empty( $hidetext ) )  ? true : false ); ?> /> <?php _e( 'No' ); ?></label>
+       <label><input type="radio" value="0" name="hidetext" id="showtext"<?php checked( ( 'blank' == $hidetext || empty( $hidetext ) ) ? false : true ); ?> /> <?php _e( 'Yes' ); ?></label>
+       </p>
+</td>
+</tr>
+
+<tr valign="top" id="text-color-row">
+<th scope="row"><?php _e( 'Text Color' ); ?></th>
+<td>
+       <p>
+               <input type="text" name="text-color" id="text-color" value="#<?php echo esc_attr( get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) ); ?>" />
+               <span class="description hide-if-js"><?php _e( 'If you want to hide header text, add <strong>#blank</strong> as text color.' );?></span>
+               <input type="button" class="button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color' ); ?>" id="pickcolor" />
+       </p>
+       <div id="color-picker" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
+</td>
+</tr>
+
+       <?php if ( defined('HEADER_TEXTCOLOR') && get_theme_mod('header_textcolor') ) { ?>
+<tr valign="top">
+<th scope="row"><?php _e('Reset Text Color'); ?></th>
+<td>
+       <p><?php _e( 'This will restore the original header text. You will not be able to restore any customizations.' ) ?></p>
+       <input type="submit" class="button" name="resettext" value="<?php esc_attr_e( 'Restore Original Header Text' ); ?>" />
+</td>
+</tr>
+       <?php } ?>
+
+</tbody>
+</table>
+       <?php endif;
+
+wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
+<p class="submit"><input type="submit" class="button-primary" name="save-header-options" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
 </form>
 </div>
-               <?php endif;
 
-       }
+<?php }
 
        /**
         * Display second step of custom header image page.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function step_2() {
-               check_admin_referer('custom-header');
+               check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');
                $overrides = array('test_form' => false);
                $file = wp_handle_upload($_FILES['import'], $overrides);
 
                if ( isset($file['error']) )
-               die( $file['error'] );
+                       wp_die( $file['error'],  __( 'Image Upload Error' ) );
 
                $url = $file['url'];
                $type = $file['type'];
@@ -360,6 +601,9 @@ class Custom_Image_Header {
                } elseif ( $width > HEADER_IMAGE_WIDTH ) {
                        $oitar = $width / HEADER_IMAGE_WIDTH;
                        $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
+                       if ( is_wp_error( $image ) )
+                               wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );
+
                        $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
 
                        $url = str_replace(basename($url), basename($image), $url);
@@ -371,27 +615,27 @@ class Custom_Image_Header {
                ?>
 
 <div class="wrap">
-
-<form method="POST" action="<?php echo esc_attr(add_query_arg('step', 3)) ?>">
-
-<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
-<div id="testWrap" style="position: relative">
-<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
-</div>
-
-<p class="submit">
-<input type="hidden" name="x1" id="x1" />
-<input type="hidden" name="y1" id="y1" />
-<input type="hidden" name="x2" id="x2" />
-<input type="hidden" name="y2" id="y2" />
-<input type="hidden" name="width" id="width" />
-<input type="hidden" name="height" id="height" />
-<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($id); ?>" />
-<input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr($oitar); ?>" />
-<?php wp_nonce_field('custom-header') ?>
-<input type="submit" value="<?php esc_attr_e('Crop Header'); ?>" />
-</p>
-
+<?php screen_icon(); ?>
+<h2><?php _e( 'Crop Header Image' ); ?></h2>
+
+<form method="post" action="<?php echo esc_attr(add_query_arg('step', 3)); ?>">
+       <p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
+       <p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p>
+
+       <div id="crop_image" style="position: relative">
+               <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
+       </div>
+
+       <p class="submit">
+       <input type="hidden" name="x1" id="x1" value="0"/>
+       <input type="hidden" name="y1" id="y1" value="0"/>
+       <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>
+       <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>
+       <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $id ); ?>" />
+       <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />
+       <?php wp_nonce_field( 'custom-header-crop-image' ) ?>
+       <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Crop and Publish' ); ?>" />
+       </p>
 </form>
 </div>
                <?php
@@ -400,10 +644,10 @@ class Custom_Image_Header {
        /**
         * Display third step of custom header image page.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function step_3() {
-               check_admin_referer('custom-header');
+               check_admin_referer('custom-header-crop-image');
                if ( $_POST['oitar'] > 1 ) {
                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
                        $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
@@ -414,6 +658,9 @@ class Custom_Image_Header {
                $original = get_attached_file( $_POST['attachment_id'] );
 
                $cropped = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);
+               if ( is_wp_error( $cropped ) )
+                       wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );
+
                $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $_POST['attachment_id']); // For replication
 
                $parent = get_post($_POST['attachment_id']);
@@ -446,25 +693,21 @@ class Custom_Image_Header {
        /**
         * Display last step of custom header image page.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function finished() {
-               ?>
-<div class="wrap">
-<h2><?php _e('Header complete!'); ?></h2>
-
-<p><?php _e('Visit your site and you should see the new header now.'); ?></p>
-
-</div>
-               <?php
+               $this->updated = true;
+               $this->step_1();
        }
 
        /**
         * Display the page based on the current step.
         *
-        * @since unknown
+        * @since 2.1.0
         */
        function admin_page() {
+               if ( ! current_user_can('edit_theme_options') )
+                       wp_die(__('You do not have permission to customize headers.'));
                $step = $this->step();
                if ( 1 == $step )
                        $this->step_1();
index 1b972a9f947941f807e04f5dd7bae5dea6613f4b..0014d7205e6abe18e74c6a5eb07c5fefc9e4476d 100644 (file)
@@ -71,7 +71,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                                if ( $is_trash ) echo $thumb;
                                else {
 ?>
-                               <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>">
+                               <a href="<?php echo get_edit_post_link( $post->ID, true ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>">
                                        <?php echo $thumb; ?>
                                </a>
 
@@ -84,25 +84,33 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
 
        case 'media':
                ?>
-               <td <?php echo $attributes ?>><strong><?php if ( $is_trash ) echo $att_title; else { ?><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a><?php } ?></strong><br />
-               <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
+               <td <?php echo $attributes ?>><strong><?php if ( $is_trash ) echo $att_title; else { ?><a href="<?php echo get_edit_post_link( $post->ID, true ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a><?php } ?></strong>
                <p>
                <?php
+               if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) )
+                       echo esc_html( strtoupper( $matches[1] ) );
+               else
+                       echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
+               ?>
+               </p>
+               <?php
                $actions = array();
                if ( current_user_can('edit_post', $post->ID) && !$is_trash )
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) ) {
                        if ( $is_trash )
-                               $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
+                               $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-attachment_' . $post->ID) . "'>" . __('Restore') . "</a>";
                        elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
-                               $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
+                               $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-attachment_' . $post->ID) . "'>" . __('Trash') . "</a>";
                        if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
                                $delete_ays = (!$is_trash && !MEDIA_TRASH) ? " onclick='return showNotice.warn();'" : '';
-                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
+                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-attachment_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                        }
                }
-               if ( !$is_trash )
+               if ( !$is_trash ) {
+                       $title =_draft_or_post_title($post->post_parent);
                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+               }
                $actions = apply_filters( 'media_row_actions', $actions, $post );
                $action_count = count($actions);
                $i = 0;
@@ -113,7 +121,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                        echo "<span class='$action'>$link$sep</span>";
                }
                echo '</div>';
-               ?></p></td>
+               ?></td>
                <?php
                break;
 
diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php
deleted file mode 100644 (file)
index a37f82e..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * Edit category form for inclusion in administration panels.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-// don't load directly
-if ( !defined('ABSPATH') )
-       die('-1');
-
-if ( !current_user_can('manage_categories') )
-       wp_die(__('You do not have sufficient permissions to edit categories for this blog.'));
-
-/**
- * @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">
-<?php screen_icon(); ?>
-<h2><?php _e('Edit Category'); ?></h2>
-<div id="ajax-response"></div>
-<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
-<input type="hidden" name="action" value="editedcat" />
-<input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
-<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
-       <table class="form-table">
-               <tr class="form-field form-required">
-                       <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
-                       <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
-               </tr>
-               <tr class="form-field">
-                       <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
-                       <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
-            <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
-               </tr>
-               <tr class="form-field">
-                       <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
-                       <td>
-                               <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'exclude' => $category->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
-                <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
-                       </td>
-               </tr>
-               <tr class="form-field">
-                       <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
-                       <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
-            <span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
-               </tr>
-               <?php do_action('edit_category_form_fields', $category); ?>
-       </table>
-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
-<?php do_action('edit_category_form', $category); ?>
-</form>
-</div>
index ee23b3e36b65b9aa40d14c2ae916f2db46356a86..7f11bef4827b57689863defd6e8c3430674f3a6d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( !current_user_can('edit_posts') )
        wp_die(__('Cheatin&#8217; uh?'));
@@ -32,10 +32,11 @@ if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_R
                $comment_ids = array_map( 'absint', explode(',', $_REQUEST['ids']) );
                $doaction = $_REQUEST['action'];
        } else {
-               wp_redirect($_SERVER['HTTP_REFERER']);
+               wp_redirect( wp_get_referer() );
        }
 
        $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
+       $redirect_to = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer() );
 
        foreach ($comment_ids as $comment_id) { // Check the permissions on each
                $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
@@ -75,8 +76,6 @@ if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_R
                }
        }
 
-       $redirect_to = 'edit-comments.php';
-
        if ( $approved )
                $redirect_to = add_query_arg( 'approved', $approved, $redirect_to );
        if ( $unapproved )
@@ -94,30 +93,33 @@ if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_R
        if ( $trashed || $spammed )
                $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to );
 
-       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']) )
-               $redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
-       if ( !empty($_REQUEST['comment_status']) )
-               $redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to);
-       if ( !empty($_REQUEST['s']) )
-               $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
        wp_redirect( $redirect_to );
-} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+       exit;
+} elseif ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
 if ( $post_id )
-       $title = sprintf(__('Edit Comments on &#8220;%s&#8221;'), wp_html_excerpt(_draft_or_post_title($post_id), 50));
+       $title = sprintf(__('Comments on &#8220;%s&#8221;'), wp_html_excerpt(_draft_or_post_title($post_id), 50));
 else
-       $title = __('Edit Comments');
-
-require_once('admin-header.php');
-
-$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
+       $title = __('Comments');
+
+add_contextual_help( $current_screen, '<p>' . __('You can manage comments made on your site similar to the way you manage Posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.') . '</p>' .
+       '<p>' . __('A yellow row means the comment is waiting for you to moderate it.') . '</p>' .
+       '<p>' . __('In the Author column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.') . '</p>' .
+       '<p>' . __('In the Comment column, above each comment it says &#8220;Submitted on,&#8221; followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site.') . '</p>' .
+       '<p>' . __('In the In Response To column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The &#8220;#&#8221; permalink symbol below leads to that post on your live site. The small bubble with the number in it shows how many comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post.') . '</p>' .
+       '<p>' . __('Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more.') . '</p>' .
+       '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+       '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Panels#Comments" target="_blank">Comments Documentation</a>' ) . '</p>' .
+       '<p>' . __( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Comment Spam Documentation</a>') . '</p>' .
+       '<p>' . __( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Keyboard Shortcuts Documentation</a>') . '</p>' .
+       '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+require_once('./admin-header.php');
+
+$mode = ( empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
 
 $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
 if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )
@@ -136,45 +138,68 @@ if ( isset($_GET['s']) && $_GET['s'] )
 </h2>
 
 <?php
-if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) {
-       $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0;
-       $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0;
-       $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0;
-       $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0;
-       $spammed = isset($_GET['spammed']) ? (int) $_GET['spammed'] : 0;
-       $unspammed = isset($_GET['unspammed']) ? (int) $_GET['unspammed'] : 0;
-
-       if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) {
-               echo '<div id="moderated" class="updated fade"><p>';
-
-               if ( $approved > 0 ) {
-                       printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
-                       echo '<br />';
-               }
+if ( isset( $_GET['error'] ) ) {
+       $error = (int) $_GET['error'];
+       $error_msg = '';
+       switch ( $error ) {
+               case 1 :
+                       $error_msg = __( 'Oops, no comment with this ID.' );
+                       break;
+               case 2 :
+                       $error_msg = __( 'You are not allowed to edit comments on this post.' );
+                       break;
+       }
+       if ( $error_msg )
+               echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
+}
+
+if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) || isset($_GET['same']) ) {
+       $approved  = isset( $_GET['approved']  ) ? (int) $_GET['approved']  : 0;
+       $deleted   = isset( $_GET['deleted']   ) ? (int) $_GET['deleted']   : 0;
+       $trashed   = isset( $_GET['trashed']   ) ? (int) $_GET['trashed']   : 0;
+       $untrashed = isset( $_GET['untrashed'] ) ? (int) $_GET['untrashed'] : 0;
+       $spammed   = isset( $_GET['spammed']   ) ? (int) $_GET['spammed']   : 0;
+       $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0;
+       $same      = isset( $_GET['same'] )      ? (int) $_GET['same']      : 0;
+
+       if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
+               if ( $approved > 0 )
+                       $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
+
                if ( $spammed > 0 ) {
-                       printf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed );
                        $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
-                       echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
-               }
-               if ( $unspammed > 0 ) {
-                       printf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
-                       echo '<br />';
+                       $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
                }
+
+               if ( $unspammed > 0 )
+                       $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
+
                if ( $trashed > 0 ) {
-                       printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed );
                        $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
-                       echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
-               }
-               if ( $untrashed > 0 ) {
-                       printf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed );
-                       echo '<br />';
+                       $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
                }
-               if ( $deleted > 0 ) {
-                       printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
-                       echo '<br />';
+
+               if ( $untrashed > 0 )
+                       $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed );
+
+               if ( $deleted > 0 )
+                       $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
+
+               if ( $same > 0 && $comment = get_comment( $same ) ) {
+                       switch ( $comment->comment_approved ) {
+                               case '1' :
+                                       $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+                                       break;
+                               case 'trash' :
+                                       $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
+                                       break;
+                               case 'spam' :
+                                       $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+                                       break;
+                       }
                }
 
-               echo '</p></div>';
+               echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
        }
 }
 ?>
@@ -187,7 +212,7 @@ $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' => _n_noop('All', 'All'), // singular not used
+               'all' => _nx_noop('All', 'All', 'comments'), // singular not used
                'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
                'approved' => _n_noop('Approved', 'Approved'), // singular not used
                'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
@@ -202,10 +227,8 @@ if ( !empty($comment_type) && 'all' != $comment_type )
        $link = add_query_arg( 'comment_type', $comment_type, $link );
 
 foreach ( $stati as $status => $label ) {
-       $class = '';
+       $class = ( $status == $comment_status ) ? ' class="current"' : '';
 
-       if ( $status == $comment_status )
-               $class = ' class="current"';
        if ( !isset( $num_comments->$status ) )
                $num_comments->$status = 10;
        $link = add_query_arg( 'comment_status', $status, $link );
@@ -236,7 +259,7 @@ unset($status_links);
 </p>
 
 <?php
-$comments_per_page = (int) get_user_option( 'edit_comments_per_page', 0, false );
+$comments_per_page = (int) get_user_option( 'edit_comments_per_page' );
 if ( empty( $comments_per_page ) || $comments_per_page < 1 )
        $comments_per_page = 20;
 $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
@@ -254,11 +277,8 @@ $_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();
+
+$_comment_pending_count = get_pending_comments_num($_comment_post_ids);
 
 $comments = array_slice($_comments, 0, $comments_per_page);
 $extra_comments = array_slice($_comments, $comments_per_page);
@@ -295,6 +315,7 @@ $page_links = paginate_links( array(
 <input type="hidden" name="_page" value="<?php echo esc_attr($page); ?>" />
 <?php endif; ?>
 
+<?php if ( $comments ) : ?>
 <div class="alignleft actions">
 <select name="action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
@@ -305,12 +326,12 @@ $page_links = paginate_links( array(
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
-<option value="spam"><?php _e('Mark as Spam'); ?></option>
+<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
 <?php endif; ?>
 <?php if ( 'trash' == $comment_status ): ?>
 <option value="untrash"><?php _e('Restore'); ?></option>
 <?php elseif ( 'spam' == $comment_status ): ?>
-<option value="unspam"><?php _e('Not Spam'); ?></option>
+<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
 <?php endif; ?>
 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
 <option value="delete"><?php _e('Delete Permanently'); ?></option>
@@ -321,6 +342,8 @@ $page_links = paginate_links( array(
 <input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
 <?php wp_nonce_field('bulk-comments'); ?>
 
+<?php endif; ?>
+
 <select name="comment_type">
        <option value="all"><?php _e('Show all comment types'); ?></option>
 <?php
@@ -358,8 +381,8 @@ if ( ( 'spam' == $comment_status || 'trash' == $comment_status) && current_user_
 </div>
 
 <div class="clear"></div>
-
 <?php if ( $comments ) { ?>
+
 <table class="widefat comments fixed" cellspacing="0">
 <thead>
        <tr>
@@ -403,7 +426,7 @@ if ( $page_links )
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
-<option value="spam"><?php _e('Mark as Spam'); ?></option>
+<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
 <?php endif; ?>
 <?php if ( 'trash' == $comment_status ): ?>
 <option value="untrash"><?php _e('Restore'); ?></option>
@@ -411,7 +434,7 @@ if ( $page_links )
 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
 <option value="delete"><?php _e('Delete Permanently'); ?></option>
 <?php elseif ( 'spam' == $comment_status ): ?>
-<option value="unspam"><?php _e('Not Spam'); ?></option>
+<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
 <?php else: ?>
 <option value="trash"><?php _e('Move to Trash'); ?></option>
 <?php endif; ?>
@@ -446,10 +469,12 @@ if ( $page_links )
 
 <?php } elseif ( 'moderated' == $comment_status ) { ?>
 <p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
+</div>
 </form>
 
 <?php } else { ?>
-<p><?php _e('No results found.') ?></p>
+<p><?php _e('No comments found.') ?></p>
+</div>
 </form>
 
 <?php } ?>
@@ -458,4 +483,4 @@ if ( $page_links )
 <?php
 wp_comment_reply('-1', true, 'detail');
 wp_comment_trashnotice();
-include('admin-footer.php'); ?>
+include('./admin-footer.php'); ?>
index bc435ebf3f207dc68f21b74f23ee9ba7264e3361..a31fd448373f1e0bfa4f352da04643f2d45b8196 100644 (file)
 if ( !defined('ABSPATH') )
        die('-1');
 
+wp_enqueue_script('post');
+
+if ( post_type_supports($post_type, 'editor') ) {
+       if ( user_can_richedit() )
+               wp_enqueue_script('editor');
+       wp_enqueue_script('word-count');
+}
+
+if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
+       add_thickbox();
+       wp_enqueue_script('media-upload');
+}
+
 /**
  * Post ID global
  * @name $post_ID
  * @var int
  */
 $post_ID = isset($post_ID) ? (int) $post_ID : 0;
-
+$temp_ID = isset($temp_ID) ? (int) $temp_ID : 0;
+$user_ID = isset($user_ID) ? (int) $user_ID : 0;
 $action = isset($action) ? $action : '';
 
+$messages = array();
+$messages['post'] = array(
+        0 => '', // Unused. Messages start at index 1.
+        1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
+        2 => __('Custom field updated.'),
+        3 => __('Custom field deleted.'),
+        4 => __('Post updated.'),
+       /* translators: %s: date and time of the revision */
+        5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
+        6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
+        7 => __('Post saved.'),
+        8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+        9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
+               // translators: Publish box date format, see http://php.net/date
+               date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
+       10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+);
+$messages['page'] = array(
+        0 => '', // Unused. Messages start at index 1.
+        1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
+        2 => __('Custom field updated.'),
+        3 => __('Custom field deleted.'),
+        4 => __('Page updated.'),
+        5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
+        6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
+        7 => __('Page saved.'),
+        8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+        9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
+       10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+);
+
+$messages = apply_filters( 'post_updated_messages', $messages );
+
 $message = false;
 if ( isset($_GET['message']) ) {
        $_GET['message'] = absint( $_GET['message'] );
-
-       switch ( $_GET['message'] ) {
-               case 1:
-                       $message = sprintf( __('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID) );
-                       break;
-               case 2:
-                       $message = __('Custom field updated.');
-                       break;
-               case 3:
-                       $message = __('Custom field deleted.');
-                       break;
-               case 4:
-                       $message = __('Post updated.');
-                       break;
-               case 5:
-                       if ( isset($_GET['revision']) )
-                               $message = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
-                       break;
-               case 6:
-                       $message = sprintf( __('Post published. <a href="%s">View post</a>'), get_permalink($post_ID) );
-                       break;
-               case 7:
-                       $message = __('Post saved.');
-                       break;
-               case 8:
-                       $message = sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
-                       break;
-               case 9:
-                       // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php
-                       $message = sprintf( __('Post scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) );
-                       break;
-               case 10:
-                       $message = sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
-                       break;
-       }
+       if ( isset($messages[$post_type][$_GET['message']]) )
+               $message = $messages[$post_type][$_GET['message']];
+       elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
+               $message = $messages['post'][$_GET['message']];
 }
 
 $notice = false;
-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='" . esc_attr($temp_ID) . "' />";
+$form_extra = '';
+if ( 'auto-draft' == $post->post_status ) {
+       if ( 'edit' == $action )
+               $post->post_title = '';
        $autosave = false;
+       $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
 } else {
-       $form_action = 'editpost';
-       $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
        $autosave = wp_get_post_autosave( $post_ID );
+}
+
+$form_action = 'editpost';
+$nonce_action = 'update-' . $post_type . '_' . $post_ID;
+$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($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, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
-               foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
-                       if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
-                               $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' ), get_edit_post_link( $autosave->ID ) );
-                               break;
-                       }
+// 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, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
+       foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
+               if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
+                       $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
+                       break;
                }
-               unset($autosave_field, $_autosave_field);
        }
+       unset($autosave_field, $_autosave_field);
 }
 
+$post_type_object = get_post_type_object($post_type);
+
 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
-require_once('includes/meta-boxes.php');
+require_once('./includes/meta-boxes.php');
 
-add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
+add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
 
-// all tag-style post taxonomies
-foreach ( get_object_taxonomies('post') as $tax_name ) {
-       if ( !is_taxonomy_hierarchical($tax_name) ) {
-               $taxonomy = get_taxonomy($tax_name);
-               $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
+// all taxonomies
+foreach ( get_object_taxonomies($post_type) as $tax_name ) {
+       $taxonomy = get_taxonomy($tax_name);
+       if ( ! $taxonomy->show_ui )
+               continue;
 
-               add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
-       }
+       $label = $taxonomy->labels->name;
+
+       if ( !is_taxonomy_hierarchical($tax_name) )
+               add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
+       else
+               add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
 }
 
-add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
-if ( current_theme_supports( 'post-thumbnails', 'post' ) )
-       add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
-add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
-add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
-add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
-do_action('dbx_post_advanced');
-add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
+if ( post_type_supports($post_type, 'page-attributes') )
+       add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core');
+
+if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' )
+       && ( ! is_multisite() || ( ( $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ) ) && ! empty( $mu_media_buttons['image'] ) ) ) )
+               add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low');
+
+if ( post_type_supports($post_type, 'excerpt') )
+       add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core');
 
-if ( 'publish' == $post->post_status || 'private' == $post->post_status )
-       add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core');
+if ( post_type_supports($post_type, 'trackbacks') )
+       add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core');
 
-if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
-       add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
+if ( post_type_supports($post_type, 'custom-fields') )
+       add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, '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 )
-       add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
+do_action('dbx_post_advanced');
+if ( post_type_supports($post_type, 'comments') )
+       add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core');
+
+if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
+       add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');
 
-if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
-       add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
+if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
+       add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
 
-do_action('do_meta_boxes', 'post', 'normal', $post);
-do_action('do_meta_boxes', 'post', 'advanced', $post);
-do_action('do_meta_boxes', 'post', 'side', $post);
+if ( post_type_supports($post_type, 'author') ) {
+       $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 ) || is_super_admin() )
+               add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
+}
 
-require_once('admin-header.php');
+if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
+       add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');
+
+do_action('add_meta_boxes', $post_type, $post);
+do_action('add_meta_boxes_' . $post_type, $post);
+
+do_action('do_meta_boxes', $post_type, 'normal', $post);
+do_action('do_meta_boxes', $post_type, 'advanced', $post);
+do_action('do_meta_boxes', $post_type, 'side', $post);
+
+if ( 'post' == $post_type ) {
+       add_contextual_help($current_screen,
+       '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes that allow you to add metadata to your post using drag and drop, and can minimize or expand them by clicking the title bar of the box. You can also hide any of the boxes by using the Screen Options tab, where you can also choose a 1- or 2-column layout for this screen.') . '</p>' .
+       '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>' .
+       '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions.') . '</p>' .
+       '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' .
+       '<p>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</p>' .
+       '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>' .
+       '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>' .
+       '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Documentation on Writing Posts</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+} elseif ( 'page' == $post_type ) {
+       add_contextual_help($current_screen, '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' .
+       '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. The Page editor mostly works the same Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' .
+       '<p>' . __('<strong>Parent</strong> - 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 many levels you can nest pages.') . '</p>' .
+       '<p>' . __('<strong>Template</strong> - 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 in this dropdown menu.') . '</p>' .
+       '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_SubPanel" target="_blank">Page Creation Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+}
 
+require_once('./admin-header.php');
 ?>
 
 <div class="wrap">
@@ -136,61 +202,70 @@ require_once('admin-header.php');
 <div id="notice" class="error"><p><?php echo $notice ?></p></div>
 <?php endif; ?>
 <?php if ( $message ) : ?>
-<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
+<div id="message" class="updated"><p><?php echo $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);
-
-?>
-
+<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>>
+<?php wp_nonce_field($nonce_action); ?>
 <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 esc_attr($form_action) ?>" />
 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
-<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" />
 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
+<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
 <?php
 if ( 'draft' != $post->post_status )
        wp_original_referer_field(true, 'previous');
 
-echo $form_extra ?>
+echo $form_extra;
+
+wp_nonce_field( 'autosave', 'autosavenonce', false );
+wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+?>
 
 <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
 <div id="side-info-column" class="inner-sidebar">
 
-<?php do_action('submitpost_box'); ?>
-
-<?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
+<?php
+('page' == $post_type) ? do_action('submitpage_box') : do_action('submitpost_box');
+$side_meta_boxes = do_meta_boxes($post_type, 'side', $post);
+?>
 </div>
 
 <div id="post-body">
 <div id="post-body-content">
+<?php if ( post_type_supports($post_type, 'title') ) { ?>
 <div id="titlediv">
 <div id="titlewrap">
-       <label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
+       <label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php _e('Enter title here') ?></label>
        <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
 </div>
 <div class="inside">
 <?php
 $sample_permalink_html = get_sample_permalink_html($post->ID);
-if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) { ?>
+$shortlink = wp_get_shortlink($post->ID, 'post');
+if ( !empty($shortlink) )
+    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
+
+if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
        <div id="edit-slug-box">
-<?php
-       if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
-               echo $sample_permalink_html;
-endif; ?>
+       <?php
+               if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
+                       echo $sample_permalink_html;
+       ?>
        </div>
 <?php
-} ?>
+}
+?>
 </div>
+<?php
+wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
+?>
 </div>
+<?php } ?>
 
+<?php if ( post_type_supports($post_type, 'editor') ) { ?>
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
 
 <?php the_editor($post->post_content); ?>
@@ -200,7 +275,7 @@ endif; ?>
        <td class="autosave-info">
        <span id="autosave">&nbsp;</span>
 <?php
-       if ( $post_ID ) {
+       if ( 'auto-draft' != $post->post_status ) {
                echo '<span id="last-edit">';
                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
                        $last_user = get_userdata($last_id);
@@ -213,21 +288,16 @@ endif; ?>
        </td>
 </tr></tbody></table>
 
-<?php
-wp_nonce_field( 'autosave', 'autosavenonce', false );
-wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
-wp_nonce_field( 'getpermalink', 'getpermalinknonce', false );
-wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
-wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
 </div>
 
 <?php
+}
 
-do_meta_boxes('post', 'normal', $post);
+do_meta_boxes($post_type, 'normal', $post);
 
-do_action('edit_form_advanced');
+( 'page' == $post_type ) ? do_action('edit_page_form') : do_action('edit_form_advanced');
 
-do_meta_boxes('post', 'advanced', $post);
+do_meta_boxes($post_type, 'advanced', $post);
 
 do_action('dbx_post_sidebar'); ?>
 
index 552d3c740f7813fd83b3dbc271b406c9fe54ce68..42f3e9d84627eede3595212a2ff0a512dc8e3c32 100644 (file)
@@ -47,9 +47,9 @@ $comment->comment_author_email = esc_attr($comment->comment_author_email);
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section" id="comment-status-radio">
-<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ echo _x('Approved', 'adjective') ?></label><br />
-<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ echo _x('Pending', 'adjective') ?></label><br />
-<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ echo _x('Spam', 'adjective'); ?></label>
+<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
+<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
+<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ _ex('Spam', 'adjective'); ?></label>
 </div>
 
 <div class="misc-pub-section curtime misc-pub-section-last">
@@ -124,8 +124,12 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
 </div>
 
-<?php do_meta_boxes('comment', 'normal', $comment); ?>
+<?php
+do_action('add_meta_boxes', 'comment', $comment);
+do_action('add_meta_boxes_comment', $comment);
 
+do_meta_boxes('comment', 'normal', $comment);
+?>
 <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
 <input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
index 90dcce6646c23b90b035796a1a208adb9d3e266d..711121be1743d2c8f808016c74964c3195da674b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 // Handle bulk actions
 if ( isset($_GET['action']) && isset($_GET['delete']) ) {
@@ -40,7 +40,7 @@ if ( isset($_GET['action']) && isset($_GET['delete']) ) {
                wp_redirect($location);
                exit();
        }
-} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+} elseif ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
@@ -51,6 +51,13 @@ wp_enqueue_script('admin-categories');
 if ( current_user_can('manage_categories') )
        wp_enqueue_script('inline-edit-tax');
 
+add_contextual_help($current_screen, '<p>' . __('You can create groups of links by using link categories. Link category names must be unique and link categories are separate from the categories you use for posts.') . '</p>' .
+       '<p>' . __('You can delete link categories, but that action does not delete the links within the category. Instead, it moves them to the default link category.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Links_Link_Categories_SubPanel" target="_blank">Link Categories Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 require_once ('admin-header.php');
 
 $messages[1] = __('Category added.');
@@ -68,7 +75,7 @@ if ( isset($_GET['s']) && $_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>
+<div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div>
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
@@ -92,7 +99,7 @@ endif; ?>
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( ! isset( $catsperpage ) || $catsperpage < 0 )
+if ( ! isset( $catsperpage ) || $catsperpage < 0 )
        $catsperpage = 20;
 
 $page_links = paginate_links( array(
@@ -198,18 +205,18 @@ if ( $page_links )
 
 <div class="form-field form-required">
        <label for="name"><?php _e('Link Category name') ?></label>
-       <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
+       <input name="name" id="link-name" type="text" value="" size="40" aria-required="true" />
 </div>
-
+<?php if ( !global_terms_enabled() ) { ?>
 <div class="form-field">
        <label for="slug"><?php _e('Link Category slug') ?></label>
-       <input name="slug" id="slug" type="text" value="" size="40" />
+       <input name="slug" id="link-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 } ?>
 <div class="form-field">
        <label for="description"><?php _e('Description (optional)') ?></label>
-       <textarea name="description" id="description" rows="5" cols="40"></textarea>
+       <textarea name="description" id="link-description" rows="5" cols="40"></textarea>
        <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
 </div>
 
@@ -226,5 +233,5 @@ if ( $page_links )
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
-<?php inline_edit_term_row('edit-link-categories'); ?>
-<?php include('admin-footer.php'); ?>
+<?php inline_edit_term_row('edit-link-categories', 'link_category'); ?>
+<?php include('./admin-footer.php'); ?>
index 17db6ef6bf861e541cdf7df253d2eecaa9371f50..7e7c004c4d0d1b09825e2de11d5bda85a9a2deaf 100644 (file)
@@ -11,7 +11,7 @@ if ( !defined('ABSPATH') )
        die('-1');
 
 if ( !current_user_can('manage_categories') )
-       wp_die(__('You do not have sufficient permissions to edit link categories for this blog.'));
+       wp_die(__('You do not have sufficient permissions to edit link categories for this site.'));
 
 /**
  * @var object
@@ -72,11 +72,13 @@ _fill_empty_link_category($category);
                        <th scope="row" valign="top"><label for="name"><?php _e('Link Category name') ?></label></th>
                        <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
                </tr>
+<?php if ( !is_multisite() ) { ?>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
                        <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
             <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
                </tr>
+<?php } ?>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea><br />
index 7d0c3edc46ae4a6e0a8b22775eb75f42b441c5ee..29e28623f47ec359c1dfb0678f7f672bd7318841 100644 (file)
@@ -22,7 +22,7 @@ if ( ! empty($link_id) ) {
        $nonce_action = 'add-bookmark';
 }
 
-require_once('includes/meta-boxes.php');
+require_once('./includes/meta-boxes.php');
 
 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');
 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
@@ -30,10 +30,22 @@ add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'nor
 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core');
 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core');
 
+do_action('add_meta_boxes', 'link', $link);
+do_action('add_meta_boxes_link', $link);
+
 do_action('do_meta_boxes', 'link', 'normal', $link);
 do_action('do_meta_boxes', 'link', 'advanced', $link);
 do_action('do_meta_boxes', 'link', 'side', $link);
 
+add_contextual_help($current_screen,
+       '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
+       '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
+       '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>' .
+       '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+       '<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_SubPanel" target="_blank">Documentation on Creating Links</a>' ) . '</p>' .
+       '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
 require_once ('admin-header.php');
 
 ?>
@@ -42,7 +54,7 @@ require_once ('admin-header.php');
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <?php if ( isset( $_GET['added'] ) ) : ?>
-<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
+<div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div>
 <?php endif; ?>
 
 <?php
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
deleted file mode 100644 (file)
index d031db4..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-<?php
-/**
- * Edit page form for inclusion in the administration panels.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-// don't load directly
-if ( !defined('ABSPATH') )
-       die('-1');
-
-/**
- * Post ID global.
- * @name $post_ID
- * @var int
- */
-if ( ! isset( $post_ID ) )
-       $post_ID = 0;
-if ( ! isset( $temp_ID ) )
-       $temp_ID = 0;
-
-$message = false;
-if ( isset($_GET['message']) ) {
-       $_GET['message'] = absint( $_GET['message'] );
-
-       switch ( $_GET['message'] ) {
-               case 1:
-                       $message = sprintf( __('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID) );
-                       break;
-               case 2:
-                       $message = __('Custom field updated.');
-                       break;
-               case 3:
-                       $message = __('Custom field deleted.');
-                       break;
-               case 4:
-                       $message = sprintf( __('Page published. <a href="%s">View page</a>'), get_permalink($post_ID) );
-                       break;
-               case 5:
-                       if ( isset($_GET['revision']) )
-                               $message = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
-                       break;
-               case 6:
-                       $message = sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
-                       break;
-               case 7:
-                       // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php
-                       $message = sprintf( __('Page scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) );
-                       break;
-               case 8:
-                       $message = sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
-                       break;
-       }
-}
-
-$notice = false;
-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_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
-} else {
-       $post_ID = (int) $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 );
-       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) )
-               $notice = sprintf( __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' ), get_edit_post_link( $autosave->ID ) );
-}
-
-$temp_ID = (int) $temp_ID;
-$user_ID = (int) $user_ID;
-
-require_once('includes/meta-boxes.php');
-
-add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'page', 'side', 'core');
-add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core');
-add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core');
-add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core');
-add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core');
-if ( current_theme_supports( 'post-thumbnails', 'page' ) )
-       add_meta_box('postimagediv', __('Page Image'), 'post_thumbnail_meta_box', 'page', 'side', 'low');
-
-$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 )
-       add_meta_box('pageauthordiv', __('Page Author'), 'post_author_meta_box', 'page', 'normal', 'core');
-
-if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
-       add_meta_box('revisionsdiv', __('Page Revisions'), 'post_revisions_meta_box', 'page', 'normal', 'core');
-
-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 esc_html( $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 ( $message ) : ?>
-<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
-<?php endif; ?>
-
-<?php wp_nonce_field($nonce_action); ?>
-
-<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
-<input type="hidden" id="hiddenaction" name="action" value='<?php echo esc_attr($form_action) ?>' />
-<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
-<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
-<?php echo $form_extra ?>
-<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
-<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
-<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
-
-<div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
-
-<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">
-<div id="post-body-content">
-<div id="titlediv">
-<div id="titlewrap">
-       <label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
-       <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
-</div>
-<div class="inside">
-<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
-       <div 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); ?>
-<table id="post-status-info" cellspacing="0"><tbody><tr>
-       <td id="wp-word-count"></td>
-       <td class="autosave-info">
-       <span id="autosave">&nbsp;</span>
-
-<?php
-       if ($post_ID) {
-               if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
-                       $last_user = get_userdata($last_id);
-                       printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
-               } else {
-                       printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
-               }
-       }
-?>
-       </td>
-</tr></tbody></table>
-
-<?php
-wp_nonce_field( 'autosave', 'autosavenonce', false );
-wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
-wp_nonce_field( 'getpermalink', 'getpermalinknonce', false );
-wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
-wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
-</div>
-
-<?php
-do_meta_boxes('page', 'normal', $post);
-do_action('edit_page_form');
-do_meta_boxes('page', 'advanced', $post);
-?>
-
-</div>
-</div>
-</div>
-
-</form>
-</div>
-
-<script type="text/javascript">
-try{document.post.title.focus();}catch(e){}
-</script>
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
deleted file mode 100644 (file)
index afab955..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-<?php
-/**
- * Edit Pages Administration Panel.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-
-if ( !current_user_can('edit_pages') )
-       wp_die(__('Cheatin&#8217; uh?'));
-
-// Handle bulk actions
-if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {
-       check_admin_referer('bulk-pages');
-       $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
-
-       if ( strpos($sendback, 'page.php') !== false )
-               $sendback = admin_url('page-new.php');
-
-       if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
-               $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);
-               $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = %s", $post_status ) );
-               $doaction = 'delete';
-       } elseif ( ( $_GET['action'] != -1 || $_GET['action2'] != -1 ) && ( isset($_GET['post']) || isset($_GET['ids']) ) ) {
-               $post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);
-               $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
-       } else {
-               wp_redirect( admin_url('edit-pages.php') );
-       }
-
-       switch ( $doaction ) {
-               case 'trash':
-                       $trashed = 0;
-                       foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can('delete_page', $post_id) )
-                                       wp_die( __('You are not allowed to move this page to the trash.') );
-
-                               if ( !wp_trash_post($post_id) )
-                                       wp_die( __('Error in moving to trash...') );
-
-                               $trashed++;
-                       }
-                       $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids)), $sendback );
-                       break;
-               case 'untrash':
-                       $untrashed = 0;
-                       foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can('delete_page', $post_id) )
-                                       wp_die( __('You are not allowed to restore this page from the trash.') );
-
-                               if ( !wp_untrash_post($post_id) )
-                                       wp_die( __('Error in restoring from trash...') );
-
-                               $untrashed++;
-                       }
-                       $sendback = add_query_arg('untrashed', $untrashed, $sendback);
-                       break;
-               case 'delete':
-                       $deleted = 0;
-                       foreach( (array) $post_ids as $post_id ) {
-                               $post_del = & get_post($post_id);
-
-                               if ( !current_user_can('delete_page', $post_id) )
-                                       wp_die( __('You are not allowed to delete this page.') );
-
-                               if ( $post_del->post_type == 'attachment' ) {
-                                       if ( ! wp_delete_attachment($post_id) )
-                                               wp_die( __('Error in deleting...') );
-                               } else {
-                                       if ( !wp_delete_post($post_id) )
-                                               wp_die( __('Error in deleting...') );
-                               }
-                               $deleted++;
-                       }
-                       $sendback = add_query_arg('deleted', $deleted, $sendback);
-                       break;
-               case 'edit':
-                       $_GET['post_type'] = 'page';
-                       $done = bulk_edit_posts($_GET);
-
-                       if ( is_array($done) ) {
-                               $done['updated'] = count( $done['updated'] );
-                               $done['skipped'] = count( $done['skipped'] );
-                               $done['locked'] = count( $done['locked'] );
-                               $sendback = add_query_arg( $done, $sendback );
-                       }
-                       break;
-       }
-
-       if ( isset($_GET['action']) )
-               $sendback = remove_query_arg( array('action', 'action2', 'post_parent', 'page_template', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view', 'post_type'), $sendback );
-
-       wp_redirect($sendback);
-       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;
-}
-
-if ( empty($title) )
-       $title = __('Edit Pages');
-$parent_file = 'edit-pages.php';
-wp_enqueue_script('inline-edit-post');
-
-$post_stati  = array(  //      array( adj, noun )
-               'publish' => array(_x('Published', 'page'), __('Published pages'), _nx_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>', 'page')),
-               'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')),
-               'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')),
-               'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')),
-               'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')),
-               'trash' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page'))
-       );
-
-if ( !EMPTY_TRASH_DAYS )
-       unset($post_stati['trash']);
-
-$post_stati = apply_filters('page_stati', $post_stati);
-
-$query = array('post_type' => 'page', 'orderby' => 'menu_order title',
-       'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
-
-$post_status_label = __('Pages');
-if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
-       $post_status_label = $post_stati[$_GET['post_status']][1];
-       $query['post_status'] = $_GET['post_status'];
-       $query['perm'] = 'readable';
-}
-
-$query = apply_filters('manage_pages_query', $query);
-wp($query);
-
-if ( is_singular() ) {
-       wp_enqueue_script( 'admin-comments' );
-       enqueue_comment_hotkeys_js();
-}
-
-require_once('admin-header.php'); ?>
-
-<div class="wrap">
-<?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="page-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a> <?php
-if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
-</h2>
-
-<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) ) { ?>
-<div id="message" class="updated fade"><p>
-<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
-       printf( _n( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
-       unset($_GET['updated']);
-}
-if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
-       printf( _n( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
-       unset($_GET['skipped']);
-}
-if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
-       printf( _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
-       unset($_GET['locked']);
-}
-if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       printf( _n( 'Page permanently deleted.', '%s pages permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
-       unset($_GET['deleted']);
-}
-if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
-       printf( _n( 'Page moved to the trash.', '%s pages moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
-       $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
-       echo ' <a href="' . esc_url( wp_nonce_url( "edit-pages.php?doaction=undo&action=untrash&ids=$ids", "bulk-pages" ) ) . '">' . __('Undo') . '</a><br />';
-       unset($_GET['trashed']);
-}
-if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
-       printf( _n( 'Page restored from the trash.', '%s pages restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
-       unset($_GET['untrashed']);
-}
-$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_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="<?php echo admin_url('edit-pages.php'); ?>" method="get">
-<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');
-$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
-$class = empty($_GET['post_status']) ? ' class="current"' : '';
-$status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>';
-foreach ( $post_stati as $status => $label ) {
-       $class = '';
-
-       if ( !in_array($status, $avail_post_stati) || $num_posts->$status <= 0 )
-               continue;
-
-       if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
-               $class = ' class="current"';
-
-       $status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nx( $label[2][0], $label[2][1], $num_posts->$status, $label[2][2] ), number_format_i18n( $num_posts->$status ) ) . '</a>';
-}
-echo implode( " |</li>\n", $status_links ) . '</li>';
-unset($status_links);
-endif;
-?>
-</ul>
-
-<p class="search-box">
-       <label class="screen-reader-text" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>
-       <input type="text" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php esc_attr_e( 'Search Pages' ); ?>" class="button" />
-</p>
-
-<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_GET['post_status']) ? esc_attr($_GET['post_status']) : 'all'; ?>" />
-
-<?php if ($posts) { ?>
-
-<div class="tablenav">
-
-<?php
-$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
-if ( empty($pagenum) )
-       $pagenum = 1;
-$per_page = (int) get_user_option( 'edit_pages_per_page', 0, false );
-if ( empty( $per_page ) || $per_page < 1 )
-       $per_page = 20;
-$per_page = apply_filters( 'edit_pages_per_page', $per_page );
-
-$num_pages = ceil($wp_query->post_count / $per_page);
-$page_links = paginate_links( array(
-       'base' => add_query_arg( 'pagenum', '%#%' ),
-       'format' => '',
-       'prev_text' => __('&laquo;'),
-       'next_text' => __('&raquo;'),
-       'total' => $num_pages,
-       'current' => $pagenum
-));
-
-$is_trash = isset($_GET['post_status']) && $_GET['post_status'] == 'trash';
-
-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>
-<?php if ( $is_trash ) { ?>
-<option value="untrash"><?php _e('Restore'); ?></option>
-<?php } else { ?>
-<option value="edit"><?php _e('Edit'); ?></option>
-<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
-<option value="delete"><?php _e('Delete Permanently'); ?></option>
-<?php } else { ?>
-<option value="trash"><?php _e('Move to Trash'); ?></option>
-<?php } ?>
-</select>
-<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-<?php wp_nonce_field('bulk-pages'); ?>
-<?php if ( $is_trash ) { ?>
-<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
-<?php } ?>
-</div>
-
-<br class="clear" />
-</div>
-
-<div class="clear"></div>
-
-<table class="widefat page fixed" cellspacing="0">
-  <thead>
-  <tr>
-<?php print_column_headers('edit-pages'); ?>
-  </tr>
-  </thead>
-
-  <tfoot>
-  <tr>
-<?php print_column_headers('edit-pages', false); ?>
-  </tr>
-  </tfoot>
-
-  <tbody>
-  <?php page_rows($posts, $pagenum, $per_page); ?>
-  </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 ( $is_trash ) { ?>
-<option value="untrash"><?php _e('Restore'); ?></option>
-<?php } else { ?>
-<option value="edit"><?php _e('Edit'); ?></option>
-<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
-<option value="delete"><?php _e('Delete Permanently'); ?></option>
-<?php } else { ?>
-<option value="trash"><?php _e('Move to Trash'); ?></option>
-<?php } ?>
-</select>
-<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
-<?php if ( $is_trash ) { ?>
-<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
-<?php } ?>
-</div>
-
-<br class="clear" />
-</div>
-
-<?php } else { ?>
-<div class="clear"></div>
-<p><?php _e('No pages found.') ?></p>
-<?php
-} // end if ($posts)
-?>
-
-</form>
-
-<?php inline_edit_row( 'page' ) ?>
-
-<div id="ajax-response"></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" />
-
-<table class="widefat" cellspacing="0">
-<thead>
-  <tr>
-    <th scope="col" class="column-comment">
-               <?php  /* translators: column name */ echo _x('Comment', 'column name') ?>
-       </th>
-    <th scope="col" class="column-author"><?php _e('Author') ?></th>
-    <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
-  </tr>
-</thead>
-<tbody id="the-comment-list" class="list:comment">
-<?php
-       foreach ($comments as $comment)
-               _wp_comment_row( $comment->comment_ID, 'single', false, false );
-?>
-</tbody>
-</table>
-
-<?php
-wp_comment_reply();
-endif; // comments
-endif; // posts;
-
-?>
-
-</div>
-
-<?php
-include('admin-footer.php');
index 8db9e89d5fb4c4dc3e12200817c188c3991befaa..2bf88416cd33c0ba84b8231d7793d6c9eea5e6af 100644 (file)
 if ( !defined('ABSPATH') )
        die('-1');
 ?>
-<table class="widefat post fixed" cellspacing="0">
+<table class="widefat <?php echo $post_type_object->hierarchical ? 'page' : 'post'; ?> fixed" cellspacing="0">
        <thead>
        <tr>
-<?php print_column_headers('edit'); ?>
+<?php print_column_headers( $current_screen ); ?>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
-<?php print_column_headers('edit', false); ?>
+<?php print_column_headers($current_screen, false); ?>
        </tr>
        </tfoot>
 
        <tbody>
-<?php post_rows(); ?>
+<?php
+if ( $post_type_object->hierarchical )
+       page_rows($posts, $pagenum, $per_page);
+else
+       post_rows();
+?>
        </tbody>
 </table>
\ No newline at end of file
index 31f609423c187b3bcdd3902d11012d4ed7300c55..56674de00d4b1b7178d96ede4a0669022d434834 100644 (file)
 if ( !defined('ABSPATH') )
        die('-1');
 
-if ( !current_user_can('manage_categories') )
-       wp_die(__('You do not have sufficient permissions to edit tags for this blog.'));
-
 if ( empty($tag_ID) ) { ?>
-       <div id="message" class="updated fade"><p><strong><?php _e('A tag was not selected for editing.'); ?></strong></p></div>
+       <div id="message" class="updated"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
 <?php
        return;
 }
 
-do_action('edit_tag_form_pre', $tag); ?>
+if ( 'category' == $taxonomy )
+       do_action('edit_category_form_pre', $tag );
+else
+       do_action('edit_tag_form_pre', $tag);
+do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy);  ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php _e('Edit Tag'); ?></h2>
+<h2><?php echo $tax->labels->edit_item; ?></h2>
 <div id="ajax-response"></div>
 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
 <input type="hidden" name="action" value="editedtag" />
@@ -32,22 +33,48 @@ do_action('edit_tag_form_pre', $tag); ?>
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
        <table class="form-table">
                <tr class="form-field form-required">
-                       <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
-                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /></td>
+                       <th scope="row" valign="top"><label for="name"><?php _ex('Name', 'Taxonomy Name'); ?></label></th>
+                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
+                       <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
                </tr>
+<?php if ( !global_terms_enabled() ) { ?>
                <tr class="form-field">
-                       <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
+                       <th scope="row" valign="top"><label for="slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label></th>
                        <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
-            <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+                       <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+               </tr>
+<?php } ?>
+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
+               <tr class="form-field">
+                       <th scope="row" valign="top"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label></th>
+                       <td>
+                               <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
+                               <?php if ( 'category' == $taxonomy ) : ?>
+                               <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
+                               <?php endif; ?>
+                       </td>
                </tr>
+<?php endif; // is_taxonomy_hierarchical() ?>
                <tr class="form-field">
-                       <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
+                       <th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
-            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
+                       <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
                </tr>
-               <?php do_action('edit_tag_form_fields', $tag); ?>
+               <?php
+               if ( 'category' == $taxonomy )
+                       do_action('edit_category_form_fields', $tag);
+               else
+                       do_action('edit_tag_form_fields', $tag);
+               do_action($taxonomy . '_edit_form_fields', $tag, $taxonomy);
+               ?>
        </table>
-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Tag'); ?>" /></p>
-<?php do_action('edit_tag_form', $tag); ?>
+<?php
+if ( 'category' == $taxonomy )
+       do_action('edit_category_form', $tag);
+else
+       do_action('edit_tag_form', $tag);
+do_action($taxonomy . '_edit_form', $tag, $taxonomy);
+?>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr( __( 'Update' ) ); ?>" /></p>
 </form>
 </div>
index 44b7a8b82d5a98dce163f78455931a402519434b..19912705408f3ce0adead7c1431cbb6ac3f205a1 100644 (file)
@@ -7,20 +7,30 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-$title = __('Tags');
-
-wp_reset_vars( array('action', 'tag', 'taxonomy') );
+wp_reset_vars( array('action', 'tag', 'taxonomy', 'post_type') );
 
 if ( empty($taxonomy) )
        $taxonomy = 'post_tag';
 
-if ( !is_taxonomy($taxonomy) )
+if ( !taxonomy_exists($taxonomy) )
        wp_die(__('Invalid taxonomy'));
 
-$parent_file = 'edit.php';
-$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
+$tax = get_taxonomy($taxonomy);
+
+$title = $tax->labels->name;
+
+if ( empty($post_type) || !in_array( $post_type, get_post_types( array('public' => true) ) ) )
+       $post_type = 'post';
+
+if ( 'post' != $post_type ) {
+       $parent_file = "edit.php?post_type=$post_type";
+       $submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type";
+} else {
+       $parent_file = 'edit.php';
+       $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
+}
 
 if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
        $action = 'bulk-delete';
@@ -31,38 +41,49 @@ case 'add-tag':
 
        check_admin_referer('add-tag');
 
-       if ( !current_user_can('manage_categories') )
+       if ( !current_user_can($tax->cap->edit_terms) )
                wp_die(__('Cheatin&#8217; uh?'));
 
        $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
-       if ( $ret && !is_wp_error( $ret ) ) {
-               wp_redirect('edit-tags.php?message=1#addtag');
-       } else {
-               wp_redirect('edit-tags.php?message=4#addtag');
+       $location = 'edit-tags.php?taxonomy=' . $taxonomy;
+       if ( 'post' != $post_type )
+               $location .= '&post_type=' . $post_type;
+
+       if ( $referer = wp_get_original_referer() ) {
+               if ( false !== strpos($referer, 'edit-tags.php') )
+                       $location = $referer;
        }
+
+       if ( $ret && !is_wp_error( $ret ) )
+               $location = add_query_arg('message', 1, $location);
+       else
+               $location = add_query_arg('message', 4, $location);
+       wp_redirect($location);
        exit;
 break;
 
 case 'delete':
+       $location = 'edit-tags.php?taxonomy=' . $taxonomy;
+       if ( 'post' != $post_type )
+               $location .= '&post_type=' . $post_type;
+       if ( $referer = wp_get_referer() ) {
+               if ( false !== strpos($referer, 'edit-tags.php') )
+                       $location = $referer;
+       }
+
        if ( !isset( $_GET['tag_ID'] ) ) {
-               wp_redirect("edit-tags.php?taxonomy=$taxonomy");
+               wp_redirect($location);
                exit;
        }
 
        $tag_ID = (int) $_GET['tag_ID'];
        check_admin_referer('delete-tag_' .  $tag_ID);
 
-       if ( !current_user_can('manage_categories') )
+       if ( !current_user_can($tax->cap->delete_terms) )
                wp_die(__('Cheatin&#8217; uh?'));
 
        wp_delete_term( $tag_ID, $taxonomy);
 
-       $location = 'edit-tags.php';
-       if ( $referer = wp_get_referer() ) {
-               if ( false !== strpos($referer, 'edit-tags.php') )
-                       $location = $referer;
-       }
-
        $location = add_query_arg('message', 2, $location);
        wp_redirect($location);
        exit;
@@ -72,7 +93,7 @@ break;
 case 'bulk-delete':
        check_admin_referer('bulk-tags');
 
-       if ( !current_user_can('manage_categories') )
+       if ( !current_user_can($tax->cap->delete_terms) )
                wp_die(__('Cheatin&#8217; uh?'));
 
        $tags = (array) $_GET['delete_tags'];
@@ -80,7 +101,9 @@ case 'bulk-delete':
                wp_delete_term( $tag_ID, $taxonomy);
        }
 
-       $location = 'edit-tags.php';
+       $location = 'edit-tags.php?taxonomy=' . $taxonomy;
+       if ( 'post' != $post_type )
+               $location .= '&post_type=' . $post_type;
        if ( $referer = wp_get_referer() ) {
                if ( false !== strpos($referer, 'edit-tags.php') )
                        $location = $referer;
@@ -93,13 +116,13 @@ case 'bulk-delete':
 break;
 
 case 'edit':
-       $title = __('Edit Tag');
+       $title = $tax->labels->edit_item;
 
        require_once ('admin-header.php');
        $tag_ID = (int) $_GET['tag_ID'];
 
        $tag = get_term($tag_ID, $taxonomy, OBJECT, 'edit');
-       include('edit-tag-form.php');
+       include('./edit-tag-form.php');
 
 break;
 
@@ -107,12 +130,15 @@ case 'editedtag':
        $tag_ID = (int) $_POST['tag_ID'];
        check_admin_referer('update-tag_' . $tag_ID);
 
-       if ( !current_user_can('manage_categories') )
+       if ( !current_user_can($tax->cap->edit_terms) )
                wp_die(__('Cheatin&#8217; uh?'));
 
        $ret = wp_update_term($tag_ID, $taxonomy, $_POST);
 
-       $location = 'edit-tags.php';
+       $location = 'edit-tags.php?taxonomy=' . $taxonomy;
+       if ( 'post' != $post_type )
+               $location .= '&post_type=' . $post_type;
+
        if ( $referer = wp_get_original_referer() ) {
                if ( false !== strpos($referer, 'edit-tags.php') )
                        $location = $referer;
@@ -129,45 +155,83 @@ break;
 
 default:
 
-if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+if ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
-$can_manage = current_user_can('manage_categories');
-
 wp_enqueue_script('admin-tags');
-if ( $can_manage )
+if ( current_user_can($tax->cap->edit_terms) )
        wp_enqueue_script('inline-edit-tax');
 
+if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) {
+       if ( 'category' == $taxonomy )
+               $help = '<p>' . sprintf(__('You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.'), 'options-writing.php') . '</p>';
+       else
+               $help = '<p>' . __('You can assign keywords to your posts using Post Tags. Unlike categories, tags have no hierarchy, meaning there&#8217;s no relationship from one tag to another.') . '</p>';
+
+       $help .='<p>' . __('What&#8217;s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.') . '</p>';
+
+       if ( 'category' == $taxonomy )
+               $help .= '<p>' . __('When adding a new category on this screen, you&#8217;ll fill in the following fields:') . '</p>';
+       else
+               $help .= '<p>' . __('When adding a new tag on this screen, you&#8217;ll fill in the following fields:') . '</p>';
+
+       $help .= '<ul>' .
+               '<li>' . __('<strong>Name</strong> - The name is how it appears on your site.') . '</li>';
+       if ( ! global_terms_enabled() )
+               $help .= '<li>' . __('<strong>Slug</strong> - The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.') . '</li>';
+
+       if ( 'category' == $taxonomy )
+               $help .= '<li>' . __('<strong>Parent</strong> - 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. To create a subcategory, just choose another category from the Parent dropdown.') . '</li>';
+
+       $help .= '<li>' . __('<strong>Description</strong> - The description is not prominent by default; however, some themes may display it.') . '</li>' .
+               '</ul>' .
+               '<p>' . __('You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.') . '</p>' .
+               '<p><strong>' . __('For more information:') . '</strong></p>';
+
+       if ( 'category' == $taxonomy )
+               $help .= '<p>' . __('<a href="http://codex.wordpress.org/Manage_Categories_SubPanel" target="_blank">Categories Documentation</a>') . '</p>';
+       else
+               $help .= '<p>' . __('<a href="http://codex.wordpress.org/Post_Tags_SubPanel" target="_blank">Tags Documentation</a>') . '</p>';
+
+       $help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+
+       add_contextual_help($current_screen, $help);
+       unset($help);
+}
+
 require_once ('admin-header.php');
 
-$messages[1] = __('Tag added.');
-$messages[2] = __('Tag deleted.');
-$messages[3] = __('Tag updated.');
-$messages[4] = __('Tag not added.');
-$messages[5] = __('Tag not updated.');
-$messages[6] = __('Tags deleted.'); ?>
+$messages[1] = __('Item added.');
+$messages[2] = __('Item deleted.');
+$messages[3] = __('Item updated.');
+$messages[4] = __('Item not added.');
+$messages[5] = __('Item not updated.');
+$messages[6] = __('Items deleted.');
+
+?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title );
-if ( isset($_GET['s']) && $_GET['s'] )
+if ( !empty($_GET['s']) )
        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
+<div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div>
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 <div id="ajax-response"></div>
 
 <form class="search-form" action="" method="get">
 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
+<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
 <p class="search-box">
-       <label class="screen-reader-text" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
+       <label class="screen-reader-text" for="tag-search-input"><?php echo $tax->labels->search_items; ?>:</label>
        <input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php esc_attr_e( 'Search Tags' ); ?>" class="button" />
+       <input type="submit" value="<?php echo esc_attr( $tax->labels->search_items );  ?>" class="button" />
 </p>
 </form>
 <br class="clear" />
@@ -178,24 +242,35 @@ endif; ?>
 <div class="col-wrap">
 <form id="posts-filter" action="" method="get">
 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
+<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
 <div class="tablenav">
 <?php
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 
-$tags_per_page = (int) get_user_option( 'edit_tags_per_page', 0, false );
+$tags_per_page = (int) get_user_option( 'edit_' .  $taxonomy . '_per_page' );
+
 if ( empty($tags_per_page) || $tags_per_page < 1 )
        $tags_per_page = 20;
-$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
-$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
+
+if ( 'post_tag' == $taxonomy ) {
+       $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
+       $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
+} elseif ( 'category' == $taxonomy ) {
+       $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
+} else {
+       $tags_per_page = apply_filters( 'edit_' . $taxonomy . '_per_page', $tags_per_page );
+}
+
+$searchterms = !empty($_GET['s']) ? trim(stripslashes($_GET['s'])) : '';
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
-       'total' => ceil(wp_count_terms($taxonomy) / $tags_per_page),
+       'total' => ceil(wp_count_terms($taxonomy, array('search' => $searchterms)) / $tags_per_page),
        'current' => $pagenum
 ));
 
@@ -216,27 +291,21 @@ if ( $page_links )
 </div>
 
 <div class="clear"></div>
-
 <table class="widefat tag fixed" cellspacing="0">
        <thead>
        <tr>
-<?php print_column_headers('edit-tags'); ?>
+<?php print_column_headers($current_screen); ?>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
-<?php print_column_headers('edit-tags', false); ?>
+<?php print_column_headers($current_screen, false); ?>
        </tr>
        </tfoot>
 
        <tbody id="the-list" class="list:tag">
-<?php
-
-$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
-
-$count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
-?>
+<?php tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy ); ?>
        </tbody>
 </table>
 
@@ -259,52 +328,102 @@ if ( $page_links )
 
 <br class="clear" />
 </form>
+
+<?php if ( 'category' == $taxonomy ) : ?>
+<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_cat_name(get_option('default_category')))) ?></p>
+<?php if ( current_user_can( 'import' ) ) : ?>
+<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'import.php') ?></p>
+<?php endif; ?>
+</div>
+<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?>
+<div class="form-wrap">
+<p><?php printf(__('Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>'), 'import.php') ;?>.</p>
+</div>
+<?php endif;
+do_action('after-' . $taxonomy . '-table', $taxonomy);
+?>
+
 </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('taxonomy' => $taxonomy, 'link' => 'edit'));
-else
-       wp_tag_cloud(array('taxonomy' => $taxonomy));
-?>
+
+if ( !is_taxonomy_hierarchical($taxonomy) ) {
+       if ( current_user_can( $tax->cap->edit_terms ) )
+               $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false, 'link' => 'edit' ) );
+       else
+               $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
+
+       if ( $tag_cloud ) :
+       ?>
+<div class="tagcloud">
+<h3><?php echo $tax->labels->popular_items; ?></h3>
+<?php echo $tag_cloud; unset( $tag_cloud ); ?>
 </div>
+<?php
+endif;
+}
 
-<?php if ( $can_manage ) {
-       do_action('add_tag_form_pre'); ?>
+if ( current_user_can($tax->cap->edit_terms) ) {
+       if ( 'category' == $taxonomy )
+               do_action('add_category_form_pre', (object)array('parent' => 0) );  // Back compat hook. Deprecated in preference to $taxonomy_pre_add_form
+       else
+               do_action('add_tag_form_pre', $taxonomy); // Back compat hook. Applies to all Taxonomies -not- categories
+       do_action($taxonomy . '_pre_add_form', $taxonomy);
+?>
 
 <div class="form-wrap">
-<h3><?php _e('Add a New Tag'); ?></h3>
+<h3><?php echo $tax->labels->add_new_item; ?></h3>
 <form id="addtag" method="post" action="edit-tags.php" class="validate">
 <input type="hidden" name="action" value="add-tag" />
+<input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" />
 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
 <?php wp_nonce_field('add-tag'); ?>
 
 <div class="form-field form-required">
-       <label for="tag-name"><?php _e('Tag name') ?></label>
+       <label for="tag-name"><?php _ex('Name', 'Taxonomy Name'); ?></label>
        <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
-       <p><?php _e('The name is how the tag appears on your site.'); ?></p>
+       <p><?php _e('The name is how it appears on your site.'); ?></p>
 </div>
-
+<?php if ( ! global_terms_enabled() ) : ?>
 <div class="form-field">
-       <label for="slug"><?php _e('Tag slug') ?></label>
-       <input name="slug" id="slug" type="text" value="" size="40" />
+       <label for="tag-slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label>
+       <input name="slug" id="tag-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; // is_multisite() ?>
+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
 <div class="form-field">
-       <label for="description"><?php _e('Description') ?></label>
-       <textarea name="description" id="description" rows="5" cols="40"></textarea>
-    <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
+       <label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label>
+       <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
+       <?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?>
+               <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>
+       <?php endif; ?>
+</div>
+<?php endif; // is_taxonomy_hierarchical() ?>
+<div class="form-field">
+       <label for="tag-description"><?php _ex('Description', 'Taxonomy Description'); ?></label>
+       <textarea name="description" id="tag-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" id="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
-<?php do_action('add_tag_form'); ?>
+<?php
+if ( ! is_taxonomy_hierarchical($taxonomy) )
+       do_action('add_tag_form_fields', $taxonomy);
+do_action($taxonomy . '_add_form_fields', $taxonomy);
+?>
+<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /></p>
+<?php
+if ( 'category' == $taxonomy )
+       do_action('edit_category_form', (object)array('parent' => 0) );  // Back compat hook. Deprecated in preference to $taxonomy_add_form
+else
+       do_action('add_tag_form', $taxonomy); // Back compat hook. Applies to all Taxonomies -not- categories
+do_action($taxonomy . '_add_form', $taxonomy);
+?>
 </form></div>
 <?php } ?>
 
@@ -314,12 +433,12 @@ else
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
-<?php inline_edit_term_row('edit-tags'); ?>
+<?php inline_edit_term_row('edit-tags', $taxonomy); ?>
 
 <?php
 break;
 }
 
-include('admin-footer.php');
+include('./admin-footer.php');
 
 ?>
index dc0d3f2d4422fb66ddd89597c8e3cb1fd93e59b5..e141d56e1fb03722a529d504b77633dc9b9be138 100644 (file)
@@ -7,9 +7,19 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( !current_user_can('edit_posts') )
+if ( !isset($_GET['post_type']) )
+       $post_type = 'post';
+elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
+       $post_type = $_GET['post_type'];
+else
+       wp_die( __('Invalid post type') );
+$_GET['post_type'] = $post_type;
+
+$post_type_object = get_post_type_object($post_type);
+
+if ( !current_user_can($post_type_object->cap->edit_posts) )
        wp_die(__('Cheatin&#8217; uh?'));
 
 // Back-compat for viewing comments of an entry
@@ -20,34 +30,54 @@ if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['pag
        unset( $_redirect );
 }
 
+if ( 'post' != $post_type ) {
+       $parent_file = "edit.php?post_type=$post_type";
+       $submenu_file = "edit.php?post_type=$post_type";
+       $post_new_file = "post-new.php?post_type=$post_type";
+} else {
+       $parent_file = 'edit.php';
+       $submenu_file = 'edit.php';
+       $post_new_file = 'post-new.php';
+}
+
+$pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
+if ( empty($pagenum) )
+       $pagenum = 1;
+$per_page = 'edit_' . $post_type . '_per_page';
+$per_page = (int) get_user_option( $per_page );
+if ( empty( $per_page ) || $per_page < 1 )
+       $per_page = 20;
+// @todo filter based on type
+$per_page = apply_filters( 'edit_posts_per_page', $per_page );
+
 // Handle bulk actions
 if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {
        check_admin_referer('bulk-posts');
        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
 
        if ( strpos($sendback, 'post.php') !== false )
-               $sendback = admin_url('post-new.php');
+               $sendback = admin_url($post_new_file);
 
        if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
                $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);
-               $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='post' AND post_status = %s", $post_status ) );
+               $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
                $doaction = 'delete';
        } elseif ( ( $_GET['action'] != -1 || $_GET['action2'] != -1 ) && ( isset($_GET['post']) || isset($_GET['ids']) ) ) {
                $post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);
                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
        } else {
-               wp_redirect( admin_url('edit.php') );
+               wp_redirect( admin_url("edit.php?post_type=$post_type") );
        }
 
        switch ( $doaction ) {
                case 'trash':
                        $trashed = 0;
                        foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can('delete_post', $post_id) )
-                                       wp_die( __('You are not allowed to move this post to the trash.') );
+                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                                       wp_die( __('You are not allowed to move this item to the Trash.') );
 
                                if ( !wp_trash_post($post_id) )
-                                       wp_die( __('Error in moving to trash...') );
+                                       wp_die( __('Error in moving to Trash.') );
 
                                $trashed++;
                        }
@@ -56,11 +86,11 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
                case 'untrash':
                        $untrashed = 0;
                        foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can('delete_post', $post_id) )
-                                       wp_die( __('You are not allowed to restore this post from the trash.') );
+                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                                       wp_die( __('You are not allowed to restore this item from the Trash.') );
 
                                if ( !wp_untrash_post($post_id) )
-                                       wp_die( __('Error in restoring from trash...') );
+                                       wp_die( __('Error in restoring from Trash.') );
 
                                $untrashed++;
                        }
@@ -71,8 +101,8 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
                        foreach( (array) $post_ids as $post_id ) {
                                $post_del = & get_post($post_id);
 
-                               if ( !current_user_can('delete_post', $post_id) )
-                                       wp_die( __('You are not allowed to delete this post.') );
+                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                                       wp_die( __('You are not allowed to delete this item.') );
 
                                if ( $post_del->post_type == 'attachment' ) {
                                        if ( ! wp_delete_attachment($post_id) )
@@ -98,34 +128,67 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
        }
 
        if ( isset($_GET['action']) )
-               $sendback = remove_query_arg( array('action', 'action2', 'cat', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view', 'post_type'), $sendback );
+               $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );
 
        wp_redirect($sendback);
        exit();
-} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+} elseif ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
-if ( empty($title) )
-       $title = __('Edit Posts');
-$parent_file = 'edit.php';
 wp_enqueue_script('inline-edit-post');
 
 $user_posts = false;
-if ( !current_user_can('edit_others_posts') ) {
-       $user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = 'post' AND post_status != 'trash' AND post_author = %d", $current_user->ID) );
+if ( !current_user_can($post_type_object->cap->edit_others_posts) ) {
+       $user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = '%s' AND post_status NOT IN ('trash', 'auto-draft') AND post_author = %d", $post_type, $current_user->ID) );
        $user_posts = true;
        if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) )
                $_GET['author'] = $current_user->ID;
 }
 
-list($post_stati, $avail_post_stati) = wp_edit_posts_query();
+$avail_post_stati = wp_edit_posts_query();
 
-require_once('admin-header.php');
+if ( $post_type_object->hierarchical )
+       $num_pages = ceil($wp_query->post_count / $per_page);
+else
+       $num_pages = $wp_query->max_num_pages;
+
+$title = $post_type_object->labels->name;
+
+if ( 'post' == $post_type ) {
+       add_contextual_help($current_screen,
+       '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' .
+       '<ul>' .
+       '<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' .
+       '<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' .
+       '<li>' . __('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.') . '</li>' .
+       '<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' .
+       '</ul>' .
+       '<p>' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '</p>' .
+       '<ul>' .
+       '<li>' . __('Edit takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' .
+       '<li>' . __('Quick Edit provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' .
+       '<li>' . __('Trash removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' .
+       '<li>' . __('Preview will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.') . '</li>' .
+       '</ul>' .
+       '<p>' . __('You can also edit multiple posts at once. Select the posts you want to edit using the checkboxes, select Edit from the Bulk Actions menu and click Apply. You will be able to change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Posts_Edit_SubPanel" target="_blank">Edit Posts Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+} elseif ( 'page' == $post_type ) {
+       add_contextual_help($current_screen,
+       '<p>' . __('Pages are similar to to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' .
+       '<p>' . __('Managing Pages is very similar to managing Posts, and the screens can be customized in the same way.') . '</p>' .
+       '<p>' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a Page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple Pages at once.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Pages_Edit_SubPanel" target="_blank">Page Management Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+}
 
-if ( !isset( $_GET['paged'] ) )
-       $_GET['paged'] = 1;
+require_once('./admin-header.php');
 
 if ( empty($_GET['mode']) )
        $mode = 'list';
@@ -134,19 +197,19 @@ else
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="post-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'post'); ?></a> <?php
+<h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="button add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
 </h2>
 
 <?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>
+<div id="message" class="updated"><p><strong><?php _e('This 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']) || isset($_GET['trashed']) || isset($_GET['untrashed']) ) { ?>
-<div id="message" class="updated fade"><p>
+<div id="message" class="updated"><p>
 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
        printf( _n( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
        unset($_GET['updated']);
@@ -156,24 +219,24 @@ if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
        unset($_GET['skipped']);
 
 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
-       printf( _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
+       printf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
        unset($_GET['locked']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       printf( _n( 'Post permanently deleted.', '%s posts permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+       printf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
        unset($_GET['deleted']);
 }
 
 if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
-       printf( _n( 'Post moved to the trash.', '%s posts moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
+       printf( _n( 'Item moved to the trash.', '%s items moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
        $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
-       echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
+       echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
        unset($_GET['trashed']);
 }
 
 if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
-       printf( _n( 'Post restored from the trash.', '%s posts restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
+       printf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
        unset($_GET['undeleted']);
 }
 
@@ -188,34 +251,41 @@ $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated'
 <?php
 if ( empty($locked_post_status) ) :
 $status_links = array();
-$num_posts = wp_count_posts( 'post', 'readable' );
+$num_posts = wp_count_posts( $post_type, 'readable' );
 $class = '';
 $allposts = '';
 
 if ( $user_posts ) {
        if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user->ID ) )
                $class = ' class="current"';
-       $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'My Posts <span class="count">(%s)</span>', 'My Posts <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
-       $allposts = '?all_posts=1';
+       $status_links[] = "<li><a href='edit.php?post_type=$post_type&author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
+       $allposts = '&all_posts=1';
 }
 
-$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
+$total_posts = array_sum( (array) $num_posts );
+
+// Subtract post types that are not included in the admin all list.
+foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
+       $total_posts -= $num_posts->$state;
+
 $class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : '';
-$status_links[] = "<li><a href='edit.php{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
+$status_links[] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
 
-foreach ( $post_stati as $status => $label ) {
+foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
        $class = '';
 
-       if ( !in_array( $status, $avail_post_stati ) )
+       $status_name = $status->name;
+
+       if ( !in_array( $status_name, $avail_post_stati ) )
                continue;
 
-       if ( empty( $num_posts->$status ) )
+       if ( empty( $num_posts->$status_name ) )
                continue;
 
-       if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
+       if ( isset($_GET['post_status']) && $status_name == $_GET['post_status'] )
                $class = ' class="current"';
 
-       $status_links[] = "<li><a href='edit.php?post_status=$status'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
+       $status_links[] = "<li><a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset( $status_links );
@@ -224,12 +294,13 @@ endif;
 </ul>
 
 <p class="search-box">
-       <label class="screen-reader-text" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
+       <label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
-       <input type="submit" value="<?php esc_attr_e( 'Search Posts' ); ?>" class="button" />
+       <input type="submit" value="<?php echo esc_attr( $post_type_object->labels->search_items  ); ?>" class="button" />
 </p>
 
 <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_GET['post_status']) ? esc_attr($_GET['post_status']) : 'all'; ?>" />
+<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
 <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
 
 <?php if ( have_posts() ) { ?>
@@ -241,8 +312,8 @@ $page_links = paginate_links( array(
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
-       'total' => $wp_query->max_num_pages,
-       'current' => $_GET['paged']
+       'total' => $num_pages,
+       'current' => $pagenum
 ));
 
 $is_trash = isset($_GET['post_status']) && $_GET['post_status'] == 'trash';
@@ -267,7 +338,7 @@ $is_trash = isset($_GET['post_status']) && $_GET['post_status'] == 'trash';
 
 <?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";
+$arc_query = $wpdb->prepare("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = %s ORDER BY post_date DESC", $post_type);
 
 $arc_result = $wpdb->get_results( $arc_query );
 
@@ -298,39 +369,50 @@ foreach ($arc_result as $arc_row) {
 <?php } ?>
 
 <?php
-$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1,
-       'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
-wp_dropdown_categories($dropdown_options);
+if ( is_object_in_taxonomy($post_type, 'category') ) {
+       $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1,
+               'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
+       wp_dropdown_categories($dropdown_options);
+}
 do_action('restrict_manage_posts');
 ?>
 <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 <?php }
 
-if ( $is_trash && current_user_can('edit_others_posts') ) { ?>
+if ( $is_trash && current_user_can($post_type_object->cap->edit_others_posts) ) { ?>
 <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
 <?php } ?>
 </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 } ?>
+<div class="tablenav-pages"><?php
+       $count_posts = $post_type_object->hierarchical ? $wp_query->post_count : $wp_query->found_posts;
+       $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, $count_posts ) ),
+                                               number_format_i18n( $count_posts ),
+                                               $page_links
+                                               );
+       echo $page_links_text;
+       ?></div>
+<?php
+}
+
+if ( !$post_type_object->hierarchical ) {
+?>
 
 <div class="view-switch">
-       <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
-       <a href="<?php echo esc_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
+       <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
+       <a href="<?php echo esc_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
 </div>
 
+<?php } ?>
 <div class="clear"></div>
 </div>
 
 <div class="clear"></div>
 
-<?php include( 'edit-post-rows.php' ); ?>
+<?php include( './edit-post-rows.php' ); ?>
 
 <div class="tablenav">
 
@@ -353,7 +435,7 @@ if ( $page_links )
 <?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
-<?php if ( $is_trash && current_user_can('edit_others_posts') ) { ?>
+<?php if ( $is_trash && current_user_can($post_type_object->cap->edit_others_posts) ) { ?>
 <input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
 <?php } ?>
 <br class="clear" />
@@ -365,19 +447,19 @@ if ( $page_links )
 <div class="clear"></div>
 <p><?php
 if ( isset($_GET['post_status']) && 'trash' == $_GET['post_status'] )
-       _e('No posts found in the trash');
+       echo $post_type_object->labels->not_found_in_trash;
 else
-       _e('No posts found');
+       echo $post_type_object->labels->not_found;
 ?></p>
 <?php } ?>
 
 </form>
 
-<?php inline_edit_row( 'post' ); ?>
+<?php inline_edit_row( $current_screen ); ?>
 
 <div id="ajax-response"></div>
 <br class="clear" />
 </div>
 
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
index 807ef0faf8ee8a65b4e692f012ac731d2ac07d3c..dcaa8137b4c5753c595ec51e180a67ac55cd8f64 100644 (file)
@@ -9,20 +9,59 @@
 /** Load WordPress Bootstrap */
 require_once ('admin.php');
 
-if ( !current_user_can('edit_files') )
-       wp_die(__('You do not have sufficient permissions to export the content of this blog.'));
+if ( !current_user_can('export') )
+       wp_die(__('You do not have sufficient permissions to export the content of this site.'));
 
 /** Load WordPress export API */
-require_once('includes/export.php');
+require_once('./includes/export.php');
 $title = __('Export');
 
+add_contextual_help($current_screen,
+       '<p>' . __('You can export a file of your site&#8217;s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can set filters to have the WXR file only include a certain date, author, category, tag, all posts or all pages, certain publishing statuses.') . '</p>' .
+       '<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Export_SubPanel" target="_blank">Export Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 if ( isset( $_GET['download'] ) ) {
-       $author = isset($_GET['author']) ? $_GET['author'] : 'all';
-       export_wp( $author );
+               $author = isset($_GET['author']) ? $_GET['author'] : 'all';
+               $taxonomy = array();
+               foreach ( get_taxonomies( array( 'show_ui' => true ) ) as $tax )
+                       $taxonomy[ $tax ] = ! empty( $_GET['taxonomy'][ $tax ] ) ? $_GET['taxonomy'][ $tax ] : 'all';
+               $post_type = isset($_GET['post_type']) ? stripslashes_deep($_GET['post_type']) : 'all';
+               $status = isset($_GET['status']) ? stripslashes_deep($_GET['status']) : 'all';
+               $mm_start = isset($_GET['mm_start']) ? $_GET['mm_start'] : 'all';
+               $mm_end = isset($_GET['mm_end']) ? $_GET['mm_end'] : 'all';
+               if( $mm_start != 'all' ) {
+                       $start_date = sprintf( "%04d-%02d-%02d", substr( $mm_start, 0, 4 ), substr( $mm_start, 5, 2 ), 1 );
+               } else {
+                       $start_date = 'all';
+               }
+               if( $mm_end != 'all' ) {
+                       $end_date = sprintf( "%04d-%02d-%02d", substr( $mm_end, 0, 4 ), substr( $mm_end, 5, 2 ), 1 );
+               } else {
+                       $end_date = 'all';
+               }
+
+       export_wp( array( 'author' => $author, 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'post_status' => $status, 'start_date' => $start_date, 'end_date' => $end_date ) );
        die();
 }
 
 require_once ('admin-header.php');
+
+$dateoptions = $edateoptions = '';
+$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'";
+$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'";
+if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, YEAR(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `eyear`, MONTH(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `emonth` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) {
+       foreach ( $monthyears as $k => $monthyear )
+               $monthyears[$k]->lmonth = $wp_locale->get_month( $monthyear->month, 2 );
+       for( $s = 0, $e = count( $monthyears ) - 1; $e >= 0; $s++, $e-- ) {
+               $dateoptions .= "\t<option value=\"" . $monthyears[$s]->year . '-' . zeroise( $monthyears[$s]->month, 2 ) . '">' . $monthyears[$s]->lmonth . ' ' . $monthyears[$s]->year . "</option>\n";
+               $edateoptions .= "\t<option value=\"" . $monthyears[$e]->eyear . '-' . zeroise( $monthyears[$e]->emonth, 2 ) . '">' . $monthyears[$e]->lmonth . ' ' . $monthyears[$e]->year . "</option>\n";
+       }
+}
+
 ?>
 
 <div class="wrap">
@@ -31,26 +70,71 @@ require_once ('admin-header.php');
 
 <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('Once you&#8217;ve saved the download file, you can use the Import function on another WordPress site to import this site.'); ?></p>
 <form action="" method="get">
-<h3><?php _e('Options'); ?></h3>
+<h3><?php _e('Filters'); ?></h3>
 
 <table class="form-table">
 <tr>
-<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
+<th><label for="mm_start"><?php _e('Start Date'); ?></label></th>
+<td>
+<select name="mm_start" id="mm_start">
+       <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
+<?php echo $dateoptions; ?>
+</select>
+</td>
+</tr>
+<tr>
+<th><label for="mm_end" id="mm_end"><?php _e('End Date'); ?></label></th>
+<td>
+<select name="mm_end" id="mm_end">
+       <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
+<?php echo $edateoptions; ?>
+</select>
+</td>
+</tr>
+<tr>
+<th><label for="author"><?php _e('Authors'); ?></label></th>
 <td>
 <select name="author" id="author">
 <option value="all" selected="selected"><?php _e('All Authors'); ?></option>
 <?php
-$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
-foreach ( $authors as $id ) {
-       $o = get_userdata( $id );
-       echo "<option value='" . esc_attr($o->ID) . "'>$o->display_name</option>";
+$authors = $wpdb->get_results( "SELECT DISTINCT u.id, u.display_name FROM $wpdb->users u INNER JOIN $wpdb->posts p WHERE u.id = p.post_author ORDER BY u.display_name" );
+foreach ( (array) $authors as $author ) {
+       echo "<option value='{$author->id}'>{$author->display_name}</option>\n";
 }
 ?>
 </select>
 </td>
 </tr>
+<?php foreach ( get_taxonomies( array( 'show_ui' => true ), 'objects' ) as $tax_obj ) {
+       $term_dropdown = wp_dropdown_categories( array( 'taxonomy' => $tax_obj->name, 'hide_if_empty' => true, 'show_option_all' => __( 'All Terms' ), 'name' => 'taxonomy[' . $tax_obj->name . ']', 'id' => 'taxonomy-' . $tax_obj->name, 'class' => '', 'echo' => false ) );
+       if ( $term_dropdown )
+               echo '<tr><th><label for="taxonomy-' . $tax_obj->name . '">' . $tax_obj->labels->name . '</label></th><td>' . $term_dropdown . '</td></tr>';
+}
+?>
+<tr>
+<th><label for="post_type"><?php _e('Content Types'); ?></label></th>
+<td>
+<select name="post_type" id="post_type">
+       <option value="all" selected="selected"><?php _e('All Content'); ?></option>
+       <?php foreach ( get_post_types( array( 'public' => true, 'can_export' => true ), 'objects' ) as $post_type_obj ) { ?>
+               <option value="<?php echo $post_type_obj->name; ?>"><?php echo $post_type_obj->labels->name; ?></option>
+       <?php } ?>
+</select>
+</td>
+</tr>
+<tr>
+<th><label for="status"><?php _e('Statuses'); ?></label></th>
+<td>
+<select name="status" id="status">
+       <option value="all" selected="selected"><?php _e('All Statuses'); ?></option>
+<?php foreach ( get_post_stati( array( 'internal' => false ), 'objects' ) as $post_status_obj ) { ?>
+       <option value="<?php echo $post_status_obj->name; ?>"><?php echo $post_status_obj->label; ?></option>
+<?php } ?>
+</select>
+</td>
+</tr>
 </table>
 <p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Download Export File'); ?>" />
 <input type="hidden" name="download" value="true" />
index 6bd926b813004f9549e3655b2803cbc4120ffac7..8feb485f9139c42df20646aca027a2fbd64afa98 100644 (file)
@@ -34,15 +34,15 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 $entries = '';
 
 foreach ( $files as $file ) {
+       // Set ignoreQuery, defaulting to true
+       $ignore_query = ( isset($file[2]) && !$file[2] ) ? '' : ', "ignoreQuery" : true ';
+
        // If version is not set, just output the file
        if ( !isset($file[1]) )
-               $entries .= '{ "url" : "' . $file[0] . '" },' . "\n";
-       // If ver is set but ignoreQuery is not, output file with ver tacked on
-       elseif ( !isset($file[2]) )
-               $entries .= '{ "url" : "' . $file[0] . '?' . $file[1] . '" },' . "\n";
-       // Output url, src, and ignoreQuery
+               $entries .= '{ "url" : "' . $file[0] . '"' . $ignore_query . ' }' . "\n";
+       // Output url and src
        else
-               $entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?' . $file[1] . '", "ignoreQuery" : true },' . "\n";
+               $entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?' . $file[1] . '"' . $ignore_query . ' },' . "\n";
 }
 
 echo trim( trim($entries), ',' );
diff --git a/wp-admin/images/browse-happy.gif b/wp-admin/images/browse-happy.gif
deleted file mode 100644 (file)
index c5b64a5..0000000
Binary files a/wp-admin/images/browse-happy.gif and /dev/null differ
index 9c9fd15a3fe8c8a1a94c9a5584998d0ec2f0b1fb..e9aeba050766144782ae9eee56a70346df262d62 100644 (file)
Binary files a/wp-admin/images/fav-arrow-rtl.gif and b/wp-admin/images/fav-arrow-rtl.gif differ
diff --git a/wp-admin/images/fav-arrow-vs-rtl.gif b/wp-admin/images/fav-arrow-vs-rtl.gif
new file mode 100644 (file)
index 0000000..a9c0721
Binary files /dev/null and b/wp-admin/images/fav-arrow-vs-rtl.gif differ
index 69e0352482807c899f16add0e6f6b618b55b1420..28fc6bbe60ef1973b78fc273c07af04c5f8d5060 100644 (file)
Binary files a/wp-admin/images/fav-arrow.gif 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
deleted file mode 100644 (file)
index 85a6852..0000000
Binary files a/wp-admin/images/fav-top.png and /dev/null differ
index 468317478de9a07d80f08a149c3a2f3401fe2d37..d910bc1b499c0d05d9d8f70573a4ab88401e5ece 100644 (file)
Binary files a/wp-admin/images/icons32-vs.png and b/wp-admin/images/icons32-vs.png differ
index 6677d1ce07b35d5defa70aae8bf2adf6d9e9cca4..d94e38af1dcd961531b5f8cfc53b66c680f59469 100644 (file)
Binary files a/wp-admin/images/icons32.png and b/wp-admin/images/icons32.png differ
index 11278c857b912ba38a498e00bb46345f7c0c0fa0..5e7e4265f8f40117642214da16e3cc88feb553a2 100644 (file)
Binary files a/wp-admin/images/media-button-image.gif and b/wp-admin/images/media-button-image.gif differ
index f85cd4346328d8ab2ba4d1637447d5d07fcfebdd..0254a0881101b767577c82b30a7f6a7f522e6dad 100644 (file)
Binary files a/wp-admin/images/media-button-music.gif and b/wp-admin/images/media-button-music.gif differ
index f3f2f8ae9e960b4a216bfa5b989bf52351219b30..414a95785b20af83e8f63b58bb1af90654b1e189 100644 (file)
Binary files a/wp-admin/images/media-button-other.gif and b/wp-admin/images/media-button-other.gif differ
index ceb2734134c0f304f721917c7772a41a88fdd46d..50ac6e0283a959c8afe2d49dcc04ce12f5be6015 100644 (file)
Binary files a/wp-admin/images/media-button-video.gif and b/wp-admin/images/media-button-video.gif differ
index 3765bfb807ef524845c68d1ed1644c47d11fe84c..b193af0dec506e1e9ae8920a53c279938e429ec6 100644 (file)
Binary files a/wp-admin/images/menu-bits-rtl.gif and b/wp-admin/images/menu-bits-rtl.gif differ
index 9a10a9a168d6e17db802ded92ac0c3c990096a2d..218e184d350fd762ddd69933bdb35ec066ee0a88 100644 (file)
Binary files a/wp-admin/images/menu-bits.gif and b/wp-admin/images/menu-bits.gif differ
index eb53fe8d1b31c0f81eaaf4be3e08d85854cc2616..76372bc3317d8e90d68838619c939a8584e1e5be 100644 (file)
Binary files a/wp-admin/images/menu-vs.png and b/wp-admin/images/menu-vs.png differ
index cc299fc63bef440d466d7bea9940fc8b4b218149..fa6ed84bf799a4c9772792f3ee7a7a8382d5522a 100644 (file)
Binary files a/wp-admin/images/menu.png and b/wp-admin/images/menu.png differ
diff --git a/wp-admin/images/screen-options-left.gif b/wp-admin/images/screen-options-left.gif
deleted file mode 100644 (file)
index d692d86..0000000
Binary files a/wp-admin/images/screen-options-left.gif and /dev/null differ
index 908e37fdb04b37687c30d752f2337896766e5d7b..6556aeeda3d51f89d3bf3026e8220863babf69bd 100644 (file)
Binary files a/wp-admin/images/screen-options-right-up.gif and b/wp-admin/images/screen-options-right-up.gif differ
index e2508a051e4a9bc144f88073b57577b1aff40e4d..8fcf25489905d9855e8e8402e3017b8541a4642a 100644 (file)
Binary files a/wp-admin/images/screen-options-right.gif and b/wp-admin/images/screen-options-right.gif differ
diff --git a/wp-admin/images/widgets-arrow.gif b/wp-admin/images/widgets-arrow.gif
new file mode 100644 (file)
index 0000000..69e0352
Binary files /dev/null and b/wp-admin/images/widgets-arrow.gif differ
diff --git a/wp-admin/images/wp-logo-vs.gif b/wp-admin/images/wp-logo-vs.gif
deleted file mode 100644 (file)
index 7154d49..0000000
Binary files a/wp-admin/images/wp-logo-vs.gif and /dev/null differ
diff --git a/wp-admin/images/wp-logo-vs.png b/wp-admin/images/wp-logo-vs.png
new file mode 100644 (file)
index 0000000..793f54c
Binary files /dev/null and b/wp-admin/images/wp-logo-vs.png differ
diff --git a/wp-admin/images/wp-logo.gif b/wp-admin/images/wp-logo.gif
deleted file mode 100644 (file)
index 42bc676..0000000
Binary files a/wp-admin/images/wp-logo.gif and /dev/null differ
diff --git a/wp-admin/images/wp-logo.png b/wp-admin/images/wp-logo.png
new file mode 100644 (file)
index 0000000..81e7d59
Binary files /dev/null and b/wp-admin/images/wp-logo.png differ
index 86dcb1479aa4d1f6c5a5461b1ad0110425d99032..d3ade57a26fbb9a2590352b5b8d481fc88b3ef64 100644 (file)
@@ -6,13 +6,42 @@
  * @subpackage Administration
  */
 
+define('WP_LOAD_IMPORTERS', true);
+
 /** Load WordPress Bootstrap */
 require_once ('admin.php');
 
-if ( !current_user_can('edit_files') )
-       wp_die(__('You do not have sufficient permissions to import content in this blog.'));
+if ( !current_user_can('import') )
+       wp_die(__('You do not have sufficient permissions to import content in this site.'));
 
 $title = __('Import');
+
+add_contextual_help($current_screen,
+       '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' .
+       '<p>' . __('In previous versions of WordPress, all the importers were built-in, but they have been turned into plugins as of version 3.0 since most people only use them once or infrequently.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Import_SubPanel" target="_blank">Import Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$popular_importers = array();
+if ( current_user_can('install_plugins') )
+       $popular_importers = array(
+               'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ),
+               'wpcat2tag' => array(__('Categories and Tags Converter'), __('Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.'), 'install', 'wp-cat2tag' ),
+               'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ),
+               'movabletype' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install', 'mt' ),
+               'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ),
+               'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ),
+               'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' )
+       );
+
+if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) {
+       wp_redirect("import.php?import=" . $popular_importers[$_GET['invalid']][3]);
+       exit;
+}
+
+add_thickbox();
 require_once ('admin-header.php');
 $parent_file = 'tools.php';
 ?>
@@ -20,7 +49,10 @@ $parent_file = 'tools.php';
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
-<p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>
+<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
+       <div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
+<?php endif; ?>
+<p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p>
 
 <?php
 
@@ -41,9 +73,20 @@ if ($imports_dir) {
 
 $importers = get_importers();
 
+// If a popular importer is not registered, create a dummy registration that links to the plugin installer.
+foreach ( $popular_importers as $pop_importer => $pop_data ) {
+       if ( isset($importers[$pop_importer] ) )
+               continue;
+       if ( isset( $pop_data[3] ) && isset( $importers[ $pop_data[3] ] ) )
+               continue;
+
+       $importers[$pop_importer] = $popular_importers[$pop_importer];
+}
+
 if (empty ($importers)) {
        echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
 } else {
+       uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
 ?>
 <table class="widefat" cellspacing="0">
 
@@ -51,7 +94,26 @@ if (empty ($importers)) {
        $style = '';
        foreach ($importers as $id => $data) {
                $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
-               $action = "<a href='admin.php?import=$id' title='".wptexturize(strip_tags($data[1]))."'>{$data[0]}</a>";
+               $action = '';
+               if ( 'install' == $data[2] ) {
+                       $plugin_slug = $id . '-importer';
+                       if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
+                               // Looks like Importer is installed, But not active
+                               $plugins = get_plugins( '/' . $plugin_slug );
+                               if ( !empty($plugins) ) {
+                                       $keys = array_keys($plugins);
+                                       $plugin_file = $plugin_slug . '/' . $keys[0];
+                                       $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) .
+                                                                                       '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
+                               }
+                       }
+                       if ( empty($action) )
+                               $action = '<a href="' . esc_url(admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug .
+                                                                               '&from=import&TB_iframe=true&width=600&height=550')) . '" class="thickbox" title="' .
+                                                                               esc_attr__('Install importer') . '">' . $data[0] . '</a>';
+               } else {
+                       $action = "<a href='" . esc_url("admin.php?import=$id") . "' title='" . esc_attr( wptexturize(strip_tags($data[1])) ) ."'>{$data[0]}</a>";
+               }
 
                if ($style != '')
                        $style = 'class="'.$style.'"';
@@ -66,6 +128,9 @@ if (empty ($importers)) {
 </table>
 <?php
 }
+
+if ( current_user_can('install_plugins') )
+       echo '<p>' . sprintf('If the importer you need is not listed, <a href="%s">search the plugins directory</a> to see if an importer is available.', esc_url(admin_url('plugin-install.php?tab=search&type=tag&s=importer')) ) . '</p>';
 ?>
 
 </div>
@@ -74,4 +139,3 @@ if (empty ($importers)) {
 
 include ('admin-footer.php');
 ?>
-
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
deleted file mode 100644 (file)
index 58aa684..0000000
+++ /dev/null
@@ -1,1077 +0,0 @@
-<?php
-/**
- * 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() {
-               $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.');
-               $prereqs = __('To use this importer, you must have a Google account and an upgraded (New, was Beta) blog hosted on blogspot.com or a custom domain (not FTP).');
-               $stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.');
-               $auth = esc_attr__('Authorize');
-
-               echo "
-               <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' />
-                                       <input type='hidden' name='scope' value='http://www.blogger.com/feeds/' />
-                                       <input type='hidden' name='session' value='1' />
-                                       <input type='hidden' name='secure' value='0' />
-                                       <input type='hidden' name='next' value='$next_url' />
-                               </p>
-                       </form>
-               </div>\n";
-       }
-
-       function uh_oh($title, $message, $info) {
-               echo "<div class='wrap'>";
-               screen_icon();
-               echo "<h2>$title</h2><p>$message</p><pre>$info</pre></div>";
-       }
-
-       function auth() {
-               // We have a single-use token that must be upgraded to a session token.
-               $token = preg_replace( '/[^-_0-9a-zA-Z]/', '', $_GET['token'] );
-               $headers = array(
-                       "GET /accounts/AuthSubSessionToken HTTP/1.0",
-                       "Authorization: AuthSub token=\"$token\""
-               );
-               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-               $sock = $this->_get_auth_sock( );
-               if ( ! $sock ) return false;
-               $response = $this->_txrx( $sock, $request );
-               preg_match( '/token=([-_0-9a-z]+)/i', $response, $matches );
-               if ( empty( $matches[1] ) ) {
-                       $this->uh_oh(
-                               __( 'Authorization failed' ),
-                               __( 'Something went wrong. If the problem persists, send this info to support:' ),
-                               htmlspecialchars($response)
-                       );
-                       return false;
-               }
-               $this->token = $matches[1];
-
-               wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) );
-       }
-
-       function get_token_info() {
-               $headers = array(
-                       "GET /accounts/AuthSubTokenInfo  HTTP/1.0",
-                       "Authorization: AuthSub token=\"$this->token\""
-               );
-               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-               $sock = $this->_get_auth_sock( );
-               if ( ! $sock ) return;
-               $response = $this->_txrx( $sock, $request );
-               return $this->parse_response($response);
-       }
-
-       function token_is_valid() {
-               $info = $this->get_token_info();
-
-               if ( $info['code'] == 200 )
-                       return true;
-
-               return false;
-       }
-
-       function show_blogs($iter = 0) {
-               if ( empty($this->blogs) ) {
-                       $headers = array(
-                               "GET /feeds/default/blogs HTTP/1.0",
-                               "Host: www.blogger.com",
-                               "Authorization: AuthSub token=\"$this->token\""
-                       );
-                       $request = join( "\r\n", $headers ) . "\r\n\r\n";
-                       $sock = $this->_get_blogger_sock( );
-                       if ( ! $sock ) return;
-                       $response = $this->_txrx( $sock, $request );
-
-                       // Quick and dirty XML mining.
-                       list( $headers, $xml ) = explode( "\r\n\r\n", $response );
-                       $p = xml_parser_create();
-                       xml_parse_into_struct($p, $xml, $vals, $index);
-                       xml_parser_free($p);
-
-                       $this->title = $vals[$index['TITLE'][0]]['value'];
-
-                       // Give it a few retries... this step often flakes out the first time.
-                       if ( empty( $index['ENTRY'] ) ) {
-                               if ( $iter < 3 ) {
-                                       return $this->show_blogs($iter + 1);
-                               } else {
-                                       $this->uh_oh(
-                                               __('Trouble signing in'),
-                                               __('We were not able to gain access to your account. Try starting over.'),
-                                               ''
-                                       );
-                                       return false;
-                               }
-                       }
-
-                       foreach ( $index['ENTRY'] as $i ) {
-                               $blog = array();
-                               while ( ( $tag = $vals[$i] ) && ! ( $tag['tag'] == 'ENTRY' && $tag['type'] == 'close' ) ) {
-                                       if ( $tag['tag'] == 'TITLE' ) {
-                                               $blog['title'] = $tag['value'];
-                                       } elseif ( $tag['tag'] == 'SUMMARY' ) {
-                                               $blog['summary'] == $tag['value'];
-                                       } elseif ( $tag['tag'] == 'LINK' ) {
-                                               if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) {
-                                                       $parts = parse_url( $tag['attributes']['HREF'] );
-                                                       $blog['host'] = $parts['host'];
-                                               } elseif ( $tag['attributes']['REL'] == 'edit' )
-                                                       $blog['gateway'] = $tag['attributes']['HREF'];
-                                       }
-                                       ++$i;
-                               }
-                               if ( ! empty ( $blog ) ) {
-                                       $blog['total_posts'] = $this->get_total_results('posts', $blog['host']);
-                                       $blog['total_comments'] = $this->get_total_results('comments', $blog['host']);
-                                       $blog['mode'] = 'init';
-                                       $this->blogs[] = $blog;
-                               }
-                       }
-
-                       if ( empty( $this->blogs ) ) {
-                               $this->uh_oh(
-                                       __('No blogs found'),
-                                       __('We were able to log in but there were no blogs. Try a different account next time.'),
-                                       ''
-                               );
-                               return false;
-                       }
-               }
-//echo '<pre>'.print_r($this,1).'</pre>';
-               $start    = esc_js( __('Import') );
-               $continue = esc_js( __('Continue') );
-               $stop     = esc_js( __('Importing...') );
-               $authors  = esc_js( __('Set Authors') );
-               $loadauth = esc_js( __('Preparing author mapping form...') );
-               $authhead = esc_js( __('Final Step: Author Mapping') );
-               $nothing  = esc_js( __('Nothing was imported. Had you already imported this blog?') );
-               $stopping = ''; //Missing String used below.
-               $title    = __('Blogger Blogs');
-               $name     = __('Blog Name');
-               $url      = __('Blog URL');
-               $action   = __('The Magic Button');
-               $posts    = __('Posts');
-               $comments = __('Comments');
-               $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don&#8217;t worry, you can turn it back off when you&#8217;re done.');
-
-               $interval = STATUS_INTERVAL * 1000;
-
-               foreach ( $this->blogs as $i => $blog ) {
-                       if ( $blog['mode'] == 'init' )
-                               $value = $start;
-                       elseif ( $blog['mode'] == 'posts' || $blog['mode'] == 'comments' )
-                               $value = $continue;
-                       else
-                               $value = $authors;
-                       $value = esc_attr($value);
-                       $blogtitle = esc_js( $blog['title'] );
-                       $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0;
-                       $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0;
-                       $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');';
-                       $pstat = "<div class='ind' id='pind$i'>&nbsp;</div><div id='pstat$i' class='stat'>$pdone/{$blog['total_posts']}</div>";
-                       $cstat = "<div class='ind' id='cind$i'>&nbsp;</div><div id='cstat$i' class='stat'>$cdone/{$blog['total_comments']}</div>";
-                       $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><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'>
-               /* <![CDATA[ */
-                       var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'};
-                       var blogs = {};
-                       function blog(i, title, mode, status){
-                               this.blog   = i;
-                               this.mode   = mode;
-                               this.title  = title;
-                               this.status = status;
-                               this.button = document.getElementById('submit'+this.blog);
-                       };
-                       blog.prototype = {
-                               start: function() {
-                                       this.cont = true;
-                                       this.kick();
-                                       this.check();
-                               },
-                               kick: function() {
-                                       ++this.kicks;
-                                       var i = this.blog;
-                                       jQuery.post('admin.php?import=blogger&noheader=true',{blog:this.blog},function(text,result){blogs[i].kickd(text,result)});
-                               },
-                               check: function() {
-                                       ++this.checks;
-                                       var i = this.blog;
-                                       jQuery.post('admin.php?import=blogger&noheader=true&status=true',{blog:this.blog},function(text,result){blogs[i].checkd(text,result)});
-                               },
-                               kickd: function(text, result) {
-                                       if ( result == 'error' ) {
-                                               // TODO: exception handling
-                                               if ( this.cont )
-                                                       setTimeout('blogs['+this.blog+'].kick()', 1000);
-                                       } else {
-                                               if ( text == 'done' ) {
-                                                       this.stop();
-                                                       this.done();
-                                               } else if ( text == 'nothing' ) {
-                                                       this.stop();
-                                                       this.nothing();
-                                               } else if ( text == 'continue' ) {
-                                                       this.kick();
-                                               } else if ( this.mode = 'stopped' )
-                                                       jQuery(this.button).attr('value', strings.cont);
-                                       }
-                                       --this.kicks;
-                               },
-                               checkd: function(text, result) {
-                                       if ( result == 'error' ) {
-                                               // TODO: exception handling
-                                       } else {
-                                               eval('this.status='+text);
-                                               jQuery('#pstat'+this.blog).empty().append(this.status.p1+'/'+this.status.p2);
-                                               jQuery('#cstat'+this.blog).empty().append(this.status.c1+'/'+this.status.c2);
-                                               this.update();
-                                               if ( this.cont || this.kicks > 0 )
-                                                       setTimeout('blogs['+this.blog+'].check()', $interval);
-                                       }
-                                       --this.checks;
-                               },
-                               update: function() {
-                                       jQuery('#pind'+this.blog).width(((this.status.p1>0&&this.status.p2>0)?(this.status.p1/this.status.p2*jQuery('#pind'+this.blog).parent().width()):1)+'px');
-                                       jQuery('#cind'+this.blog).width(((this.status.c1>0&&this.status.c2>0)?(this.status.c1/this.status.c2*jQuery('#cind'+this.blog).parent().width()):1)+'px');
-                               },
-                               stop: function() {
-                                       this.cont = false;
-                               },
-                               done: function() {
-                                       this.mode = 'authors';
-                                       jQuery(this.button).attr('value', strings.authors);
-                               },
-                               nothing: function() {
-                                       this.mode = 'nothing';
-                                       jQuery(this.button).remove();
-                                       alert(strings.nothing);
-                               },
-                               getauthors: function() {
-                                       if ( jQuery('div.wrap').length > 1 )
-                                               jQuery('div.wrap').gt(0).remove();
-                                       jQuery('div.wrap').empty().append('<h2>$authhead</h2><h3>' + this.title + '</h3>');
-                                       jQuery('div.wrap').append('<p id=\"auth\">$loadauth</p>');
-                                       jQuery('p#auth').load('index.php?import=blogger&noheader=true&authors=1',{blog:this.blog});
-                               },
-                               init: function() {
-                                       this.update();
-                                       var i = this.blog;
-                                       jQuery(this.button).bind('click', function(){return blogs[i].click();});
-                                       this.kicks = 0;
-                                       this.checks = 0;
-                               },
-                               click: function() {
-                                       if ( this.mode == 'init' || this.mode == 'stopped' || this.mode == 'posts' || this.mode == 'comments' ) {
-                                               this.mode = 'started';
-                                               this.start();
-                                               jQuery(this.button).attr('value', strings.stop);
-                                       } else if ( this.mode == 'started' ) {
-                                               return false; // let it run...
-                                               this.mode = 'stopped';
-                                               this.stop();
-                                               if ( this.checks > 0 || this.kicks > 0 ) {
-                                                       this.mode = 'stopping';
-                                                       jQuery(this.button).attr('value', strings.stopping);
-                                               } else {
-                                                       jQuery(this.button).attr('value', strings.cont);
-                                               }
-                                       } else if ( this.mode == 'authors' ) {
-                                               document.location = 'index.php?import=blogger&authors=1&blog='+this.blog;
-                                               //this.mode = 'authors2';
-                                               //this.getauthors();
-                                       }
-                                       return false;
-                               }
-                       };
-                       $init
-                       jQuery.each(blogs, function(i, me){me.init();});
-               /* ]]> */
-               </script>\n";
-       }
-
-       // Handy function for stopping the script after a number of seconds.
-       function have_time() {
-               global $importer_started;
-               if ( time() - $importer_started > MAX_EXECUTION_TIME )
-                       die('continue');
-               return true;
-       }
-
-       function get_total_results($type, $host) {
-               $headers = array(
-                       "GET /feeds/$type/default?max-results=1&start-index=2 HTTP/1.0",
-                       "Host: $host",
-                       "Authorization: AuthSub token=\"$this->token\""
-               );
-               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-               $sock = $this->_get_blogger_sock( $host );
-               if ( ! $sock ) return;
-               $response = $this->_txrx( $sock, $request );
-               $response = $this->parse_response( $response );
-               $parser = xml_parser_create();
-               xml_parse_into_struct($parser, $response['body'], $struct, $index);
-               xml_parser_free($parser);
-               $total_results = $struct[$index['OPENSEARCH:TOTALRESULTS'][0]]['value'];
-               return (int) $total_results;
-       }
-
-       function import_blog($blogID) {
-               global $importing_blog;
-               $importing_blog = $blogID;
-
-               if ( isset($_GET['authors']) )
-                       return print($this->get_author_form());
-
-               header('Content-Type: text/plain');
-
-               if ( isset($_GET['status']) )
-                       die($this->get_js_status());
-
-               if ( isset($_GET['saveauthors']) )
-                       die($this->save_authors());
-
-               $blog = $this->blogs[$blogID];
-               $total_results = $this->get_total_results('posts', $blog['host']);
-               $this->blogs[$importing_blog]['total_posts'] = $total_results;
-
-               $start_index = $total_results - MAX_RESULTS + 1;
-
-               if ( isset( $this->blogs[$importing_blog]['posts_start_index'] ) )
-                       $start_index = (int) $this->blogs[$importing_blog]['posts_start_index'];
-               elseif ( $total_results > MAX_RESULTS )
-                       $start_index = $total_results - MAX_RESULTS + 1;
-               else
-                       $start_index = 1;
-
-               // This will be positive until we have finished importing posts
-               if ( $start_index > 0 ) {
-                       // Grab all the posts
-                       $this->blogs[$importing_blog]['mode'] = 'posts';
-                       $query = "start-index=$start_index&max-results=" . MAX_RESULTS;
-                       do {
-                               $index = $struct = $entries = array();
-                               $headers = array(
-                                       "GET /feeds/posts/default?$query HTTP/1.0",
-                                       "Host: {$blog['host']}",
-                                       "Authorization: AuthSub token=\"$this->token\""
-                               );
-                               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-                               $sock = $this->_get_blogger_sock( $blog['host'] );
-                               if ( ! $sock ) return; // TODO: Error handling
-                               $response = $this->_txrx( $sock, $request );
-
-                               $response = $this->parse_response( $response );
-
-                               // Extract the entries and send for insertion
-                               preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
-                               if ( count( $matches[0] ) ) {
-                                       $entries = array_reverse($matches[0]);
-                                       foreach ( $entries as $entry ) {
-                                               $entry = "<feed>$entry</feed>";
-                                               $AtomParser = new AtomParser();
-                                               $AtomParser->parse( $entry );
-                                               $result = $this->import_post($AtomParser->entry);
-                                               if ( is_wp_error( $result ) )
-                                                       return $result;
-                                               unset($AtomParser);
-                                       }
-                               } else break;
-
-                               // Get the 'previous' query string which we'll use on the next iteration
-                               $query = '';
-                               $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
-                               if ( count( $matches[1] ) )
-                                       foreach ( $matches[1] as $match )
-                                               if ( preg_match('/rel=.previous./', $match) )
-                                                       $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') );
-
-                               if ( $query ) {
-                                       parse_str($query, $q);
-                                       $this->blogs[$importing_blog]['posts_start_index'] = (int) $q['start-index'];
-                               } else
-                                       $this->blogs[$importing_blog]['posts_start_index'] = 0;
-                               $this->save_vars();
-                       } while ( !empty( $query ) && $this->have_time() );
-               }
-
-               $total_results = $this->get_total_results( 'comments', $blog['host'] );
-               $this->blogs[$importing_blog]['total_comments'] = $total_results;
-
-               if ( isset( $this->blogs[$importing_blog]['comments_start_index'] ) )
-                       $start_index = (int) $this->blogs[$importing_blog]['comments_start_index'];
-               elseif ( $total_results > MAX_RESULTS )
-                       $start_index = $total_results - MAX_RESULTS + 1;
-               else
-                       $start_index = 1;
-
-               if ( $start_index > 0 ) {
-                       // Grab all the comments
-                       $this->blogs[$importing_blog]['mode'] = 'comments';
-                       $query = "start-index=$start_index&max-results=" . MAX_RESULTS;
-                       do {
-                               $index = $struct = $entries = array();
-                               $headers = array(
-                                       "GET /feeds/comments/default?$query HTTP/1.0",
-                                       "Host: {$blog['host']}",
-                                       "Authorization: AuthSub token=\"$this->token\""
-                               );
-                               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-                               $sock = $this->_get_blogger_sock( $blog['host'] );
-                               if ( ! $sock ) return; // TODO: Error handling
-                               $response = $this->_txrx( $sock, $request );
-
-                               $response = $this->parse_response( $response );
-
-                               // Extract the comments and send for insertion
-                               preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
-                               if ( count( $matches[0] ) ) {
-                                       $entries = array_reverse( $matches[0] );
-                                       foreach ( $entries as $entry ) {
-                                               $entry = "<feed>$entry</feed>";
-                                               $AtomParser = new AtomParser();
-                                               $AtomParser->parse( $entry );
-                                               $this->import_comment($AtomParser->entry);
-                                               unset($AtomParser);
-                                       }
-                               }
-
-                               // Get the 'previous' query string which we'll use on the next iteration
-                               $query = '';
-                               $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
-                               if ( count( $matches[1] ) )
-                                       foreach ( $matches[1] as $match )
-                                               if ( preg_match('/rel=.previous./', $match) )
-                                                       $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') );
-
-                               parse_str($query, $q);
-
-                               $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index'];
-                               $this->save_vars();
-                       } while ( !empty( $query ) && $this->have_time() );
-               }
-               $this->blogs[$importing_blog]['mode'] = 'authors';
-               $this->save_vars();
-               if ( !$this->blogs[$importing_blog]['posts_done'] && !$this->blogs[$importing_blog]['comments_done'] )
-                       die('nothing');
-               do_action('import_done', 'blogger');
-               die('done');
-       }
-
-       function convert_date( $date ) {
-           preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?(Z|[\+|\-][0-9]{2,4}){0,1}#', $date, $date_bits);
-           $offset = iso8601_timezone_to_offset( $date_bits[7] );
-               $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
-               $timestamp -= $offset; // Convert from Blogger local time to GMT
-               $timestamp += get_option('gmt_offset') * 3600; // Convert from GMT to WP local time
-               return gmdate('Y-m-d H:i:s', $timestamp);
-       }
-
-       function no_apos( $string ) {
-               return str_replace( '&apos;', "'", $string);
-       }
-
-       function min_whitespace( $string ) {
-               return preg_replace( '|\s+|', ' ', $string );
-       }
-
-       function _normalize_tag( $matches ) {
-               return '<' . strtolower( $matches[1] );
-       }
-
-       function import_post( $entry ) {
-               global $importing_blog;
-
-               // The old permalink is all Blogger gives us to link comments to their posts.
-               if ( isset( $entry->draft ) )
-                       $rel = 'self';
-               else
-                       $rel = 'alternate';
-               foreach ( $entry->links as $link ) {
-                       if ( $link['rel'] == $rel ) {
-                               $parts = parse_url( $link['href'] );
-                               $entry->old_permalink = $parts['path'];
-                               break;
-                       }
-               }
-
-               $post_date    = $this->convert_date( $entry->published );
-               $post_content = trim( addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) ) );
-               $post_title   = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) );
-               $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
-
-               // Clean up content
-               $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
-               $post_content = str_replace('<br>', '<br />', $post_content);
-               $post_content = str_replace('<hr>', '<hr />', $post_content);
-
-               // Checks for duplicates
-               if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) {
-                       ++$this->blogs[$importing_blog]['posts_skipped'];
-               } elseif ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
-                       $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
-                       ++$this->blogs[$importing_blog]['posts_skipped'];
-               } else {
-                       $post = compact('post_date', 'post_content', 'post_title', 'post_status');
-
-                       $post_id = wp_insert_post($post);
-                       if ( is_wp_error( $post_id ) )
-                               return $post_id;
-
-                       wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );
-
-                       $author = $this->no_apos( strip_tags( $entry->author ) );
-
-                       add_post_meta( $post_id, 'blogger_blog', $this->blogs[$importing_blog]['host'], true );
-                       add_post_meta( $post_id, 'blogger_author', $author, true );
-                       add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true );
-
-                       $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
-                       ++$this->blogs[$importing_blog]['posts_done'];
-               }
-               $this->save_vars();
-               return;
-       }
-
-       function import_comment( $entry ) {
-               global $importing_blog;
-
-               // Drop the #fragment and we have the comment's old post permalink.
-               foreach ( $entry->links as $link ) {
-                       if ( $link['rel'] == 'alternate' ) {
-                               $parts = parse_url( $link['href'] );
-                               $entry->old_permalink = $parts['fragment'];
-                               $entry->old_post_permalink = $parts['path'];
-                               break;
-                       }
-               }
-
-               $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink];
-               preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches);
-               $comment_author  = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
-               $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );
-               $comment_date    = $this->convert_date( $entry->updated );
-               $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) );
-
-               // Clean up content
-               $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content);
-               $comment_content = str_replace('<br>', '<br />', $comment_content);
-               $comment_content = str_replace('<hr>', '<hr />', $comment_content);
-
-               // Checks for duplicates
-               if (
-                       isset( $this->blogs[$importing_blog]['comments'][$entry->old_permalink] ) ||
-                       comment_exists( $comment_author, $comment_date )
-               ) {
-                       ++$this->blogs[$importing_blog]['comments_skipped'];
-               } else {
-                       $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');
-
-                       $comment = wp_filter_comment($comment);
-                       $comment_id = wp_insert_comment($comment);
-
-                       $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id;
-
-                       ++$this->blogs[$importing_blog]['comments_done'];
-               }
-               $this->save_vars();
-       }
-
-       function get_js_status($blog = false) {
-               global $importing_blog;
-               if ( $blog === false )
-                       $blog = $this->blogs[$importing_blog];
-               else
-                       $blog = $this->blogs[$blog];
-               $p1 = isset( $blog['posts_done'] ) ? (int) $blog['posts_done'] : 0;
-               $p2 = isset( $blog['total_posts'] ) ? (int) $blog['total_posts'] : 0;
-               $c1 = isset( $blog['comments_done'] ) ? (int) $blog['comments_done'] : 0;
-               $c2 = isset( $blog['total_comments'] ) ? (int) $blog['total_comments'] : 0;
-               return "{p1:$p1,p2:$p2,c1:$c1,c2:$c2}";
-       }
-
-       function get_author_form($blog = false) {
-               global $importing_blog, $wpdb, $current_user;
-               if ( $blog === false )
-                       $blog = & $this->blogs[$importing_blog];
-               else
-                       $blog = & $this->blogs[$blog];
-
-               if ( !isset( $blog['authors'] ) ) {
-                       $post_ids = array_values($blog['posts']);
-                       $authors = (array) $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN (" . join( ',', $post_ids ) . ")");
-                       $blog['authors'] = array_map(null, $authors, array_fill(0, count($authors), $current_user->ID));
-                       $this->save_vars();
-               }
-
-               $directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user&#8217;s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the &#8220;Restart&#8221; function below.');
-               $heading = __('Author mapping');
-               $blogtitle = "{$blog['title']} ({$blog['host']})";
-               $mapthis = __('Blogger username');
-               $tothis = __('WordPress login');
-               $submit = esc_js( __('Save Changes') );
-
-               foreach ( $blog['authors'] as $i => $author )
-                       $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>";
-
-               return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&amp;noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='" . esc_attr($importing_blog) . "' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='button authorsubmit' value='$submit' /></td></tr></table></form></div>";
-       }
-
-       function get_user_options($current) {
-               global $importer_users;
-               if ( ! isset( $importer_users ) )
-                       $importer_users = (array) get_users_of_blog();
-
-               foreach ( $importer_users as $user ) {
-                       $sel = ( $user->user_id == $current ) ? " selected='selected'" : '';
-                       $options .= "<option value='$user->user_id'$sel>$user->display_name</option>";
-               }
-
-               return $options;
-       }
-
-       function save_authors() {
-               global $importing_blog, $wpdb;
-               $authors = (array) $_POST['authors'];
-
-               $host = $this->blogs[$importing_blog]['host'];
-
-               // Get an array of posts => authors
-               $post_ids = (array) $wpdb->get_col( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s", $host) );
-               $post_ids = join( ',', $post_ids );
-               $results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)");
-               foreach ( $results as $row )
-                       $authors_posts[$row->post_id] = $row->meta_value;
-
-               foreach ( $authors as $author => $user_id ) {
-                       $user_id = (int) $user_id;
-
-                       // Skip authors that haven't been changed
-                       if ( $user_id == $this->blogs[$importing_blog]['authors'][$author][1] )
-                               continue;
-
-                       // Get a list of the selected author's posts
-                       $post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
-                       $post_ids = join( ',', $post_ids);
-
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) );
-                       $this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
-               }
-               $this->save_vars();
-
-               wp_redirect('edit.php');
-       }
-
-       function _get_auth_sock() {
-               // Connect to https://www.google.com
-               if ( !$sock = @ fsockopen('ssl://www.google.com', 443, $errno, $errstr) ) {
-                       $this->uh_oh(
-                               __('Could not connect to https://www.google.com'),
-                               __('There was a problem opening a secure connection to Google. This is what went wrong:'),
-                               "$errstr ($errno)"
-                       );
-                       return false;
-               }
-               return $sock;
-       }
-
-       function _get_blogger_sock($host = 'www2.blogger.com') {
-               if ( !$sock = @ fsockopen($host, 80, $errno, $errstr) ) {
-                       $this->uh_oh(
-                               sprintf( __('Could not connect to %s'), $host ),
-                               __('There was a problem opening a connection to Blogger. This is what went wrong:'),
-                               "$errstr ($errno)"
-                       );
-                       return false;
-               }
-               return $sock;
-       }
-
-       function _txrx( $sock, $request ) {
-               fwrite( $sock, $request );
-               while ( ! feof( $sock ) )
-                       $response .= @ fread ( $sock, 8192 );
-               fclose( $sock );
-               return $response;
-       }
-
-       function revoke($token) {
-               $headers = array(
-                       "GET /accounts/AuthSubRevokeToken HTTP/1.0",
-                       "Authorization: AuthSub token=\"$token\""
-               );
-               $request = join( "\r\n", $headers ) . "\r\n\r\n";
-               $sock = $this->_get_auth_sock( );
-               if ( ! $sock ) return false;
-               $this->_txrx( $sock, $request );
-       }
-
-       function restart() {
-               global $wpdb;
-               $options = get_option( 'blogger_importer' );
-
-               if ( isset( $options['token'] ) )
-                       $this->revoke( $options['token'] );
-
-               delete_option('blogger_importer');
-               $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'blogger_author'");
-               wp_redirect('?import=blogger');
-       }
-
-       // Returns associative array of code, header, cookies, body. Based on code from php.net.
-       function parse_response($this_response) {
-               // Split response into header and body sections
-               list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
-               $response_header_lines = explode("\r\n", $response_headers);
-
-               // First line of headers is the HTTP response code
-               $http_response_line = array_shift($response_header_lines);
-               if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
-
-               // put the rest of the headers in an array
-               $response_header_array = array();
-               foreach($response_header_lines as $header_line) {
-                       list($header,$value) = explode(': ', $header_line, 2);
-                       $response_header_array[$header] .= $value."\n";
-               }
-
-               $cookie_array = array();
-               $cookies = explode("\n", $response_header_array["Set-Cookie"]);
-               foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); }
-
-               return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body);
-       }
-
-       // Step 9: Congratulate the user
-       function congrats() {
-               $blog = (int) $_GET['blog'];
-               echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
-               if ( count($this->import['blogs']) > 1 )
-                       echo '<li>'.__('In case you haven&#8217;t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
-               if ( $n = count($this->import['blogs'][$blog]['newusers']) )
-                       echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
-               echo '<li>'.__('For security, click the link below to reset this importer.').'</li>';
-               echo '</ul>';
-       }
-
-       // Figures out what to do, then does it.
-       function start() {
-               if ( isset($_POST['restart']) )
-                       $this->restart();
-
-               $options = get_option('blogger_importer');
-
-               if ( is_array($options) )
-                       foreach ( $options as $key => $value )
-                               $this->$key = $value;
-
-               if ( isset( $_REQUEST['blog'] ) ) {
-                       $blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
-                       $blog = (int) $blog;
-                       $result = $this->import_blog( $blog );
-                       if ( is_wp_error( $result ) )
-                               echo $result->get_error_message();
-               } elseif ( isset($_GET['token']) )
-                       $this->auth();
-               elseif ( isset($this->token) && $this->token_is_valid() )
-                       $this->show_blogs();
-               else
-                       $this->greet();
-
-               $saved = $this->save_vars();
-
-               if ( $saved && !isset($_GET['noheader']) ) {
-                       $restart = __('Restart');
-                       $message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.');
-                       $submit = esc_attr__('Clear account information');
-                       echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&amp;noheader=true'><p class='submit' style='text-align:left;'><input type='submit' class='button' value='$submit' name='restart' /></p></form></div>";
-               }
-       }
-
-       function save_vars() {
-               $vars = get_object_vars($this);
-               update_option( 'blogger_importer', $vars );
-
-               return !empty($vars);
-       }
-
-       function admin_head() {
-?>
-<style type="text/css">
-td { text-align: center; line-height: 2em;}
-thead td { font-weight: bold; }
-.bar {
-       width: 200px;
-       text-align: left;
-       line-height: 2em;
-       padding: 0px;
-}
-.ind {
-       position: absolute;
-       background-color: #83B4D8;
-       width: 1px;
-       z-index: 9;
-}
-.stat {
-       z-index: 10;
-       position: relative;
-       text-align: center;
-}
-</style>
-<?php
-       }
-
-       function Blogger_Import() {
-               global $importer_started;
-               $importer_started = time();
-               if ( isset( $_GET['import'] ) && $_GET['import'] == 'blogger' ) {
-                       wp_enqueue_script('jquery');
-                       add_action('admin_head', array(&$this, 'admin_head'));
-               }
-       }
-}
-
-$blogger_import = new Blogger_Import();
-
-register_importer('blogger', __('Blogger'), __('Import posts, comments, and users from a Blogger blog.'), array ($blogger_import, 'start'));
-
-class AtomEntry {
-       var $links = array();
-       var $categories = array();
-}
-
-class AtomParser {
-
-       var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights');
-       var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft','author');
-
-       var $depth = 0;
-       var $indent = 2;
-       var $in_content;
-       var $ns_contexts = array();
-       var $ns_decls = array();
-       var $is_xhtml = false;
-       var $skipped_div = false;
-
-       var $entry;
-
-       function AtomParser() {
-               $this->entry = new AtomEntry();
-       }
-
-       function _map_attrs_func( $k, $v ) {
-               return "$k=\"$v\"";
-       }
-
-       function _map_xmlns_func( $p, $n ) {
-               $xd = "xmlns";
-               if ( strlen( $n[0] ) > 0 )
-                       $xd .= ":{$n[0]}";
-
-               return "{$xd}=\"{$n[1]}\"";
-       }
-
-       function parse($xml) {
-
-               global $app_logging;
-               array_unshift($this->ns_contexts, array());
-
-               $parser = xml_parser_create_ns();
-               xml_set_object($parser, $this);
-               xml_set_element_handler($parser, "start_element", "end_element");
-               xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
-               xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0);
-               xml_set_character_data_handler($parser, "cdata");
-               xml_set_default_handler($parser, "_default");
-               xml_set_start_namespace_decl_handler($parser, "start_ns");
-               xml_set_end_namespace_decl_handler($parser, "end_ns");
-
-               $contents = "";
-
-               xml_parse($parser, $xml);
-
-               xml_parser_free($parser);
-
-               return true;
-       }
-
-       function start_element($parser, $name, $attrs) {
-
-               $tag = array_pop(split(":", $name));
-
-               array_unshift($this->ns_contexts, $this->ns_decls);
-
-               $this->depth++;
-
-               if(!empty($this->in_content)) {
-                       $attrs_prefix = array();
-
-                       // resolve prefixes for attributes
-                       foreach($attrs as $key => $value) {
-                               $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value);
-                       }
-                       $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix)));
-                       if(strlen($attrs_str) > 0) {
-                               $attrs_str = " " . $attrs_str;
-                       }
-
-                       $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
-                       if(strlen($xmlns_str) > 0) {
-                               $xmlns_str = " " . $xmlns_str;
-                       }
-
-                       // handle self-closing tags (case: a new child found right-away, no text node)
-                       if(count($this->in_content) == 2) {
-                               array_push($this->in_content, ">");
-                       }
-
-                       array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
-               } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
-                       $this->in_content = array();
-                       $this->is_xhtml = $attrs['type'] == 'xhtml';
-                       array_push($this->in_content, array($tag,$this->depth));
-               } else if($tag == 'link') {
-                       array_push($this->entry->links, $attrs);
-               } else if($tag == 'category') {
-                       array_push($this->entry->categories, $attrs['term']);
-               }
-
-               $this->ns_decls = array();
-       }
-
-       function end_element($parser, $name) {
-
-               $tag = array_pop(split(":", $name));
-
-               if(!empty($this->in_content)) {
-                       if($this->in_content[0][0] == $tag &&
-                       $this->in_content[0][1] == $this->depth) {
-                               array_shift($this->in_content);
-                               if($this->is_xhtml) {
-                                       $this->in_content = array_slice($this->in_content, 2, count($this->in_content)-3);
-                               }
-                               $this->entry->$tag = join('',$this->in_content);
-                               $this->in_content = array();
-                       } else {
-                               $endtag = $this->ns_to_prefix($name);
-                               if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) {
-                                       array_push($this->in_content, "/>");
-                               } else {
-                                       array_push($this->in_content, "</$endtag>");
-                               }
-                       }
-               }
-
-               array_shift($this->ns_contexts);
-
-               #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
-
-               $this->depth--;
-       }
-
-       function start_ns($parser, $prefix, $uri) {
-               #print str_repeat(" ", $this->depth * $this->indent) . "starting: " . $prefix . ":" . $uri . "\n";
-               array_push($this->ns_decls, array($prefix,$uri));
-       }
-
-       function end_ns($parser, $prefix) {
-               #print str_repeat(" ", $this->depth * $this->indent) . "ending: #" . $prefix . "#\n";
-       }
-
-       function cdata($parser, $data) {
-               #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
-               if(!empty($this->in_content)) {
-                       // handle self-closing tags (case: text node found, need to close element started)
-                       if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
-                               array_push($this->in_content, ">");
-                       }
-                       array_push($this->in_content, $this->xml_escape($data));
-               }
-       }
-
-       function _default($parser, $data) {
-               # when does this gets called?
-       }
-
-
-       function ns_to_prefix($qname) {
-               $components = split(":", $qname);
-               $name = array_pop($components);
-
-               if(!empty($components)) {
-                       $ns = join(":",$components);
-                       foreach($this->ns_contexts as $context) {
-                               foreach($context as $mapping) {
-                                       if($mapping[1] == $ns && strlen($mapping[0]) > 0) {
-                                               return "$mapping[0]:$name";
-                                       }
-                               }
-                       }
-               }
-               return $name;
-       }
-
-       function xml_escape($string)
-       {
-                        return str_replace(array('&','"',"'",'<','>'),
-                               array('&amp;','&quot;','&apos;','&lt;','&gt;'),
-                               $string );
-       }
-}
-
-?>
diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php
deleted file mode 100644 (file)
index 531cedd..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-/**
- * 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">';
-               screen_icon();
-               echo '<h2>'.__('Import Blogware').'</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function unhtmlentities($string) { // From php.net for < 4.3 compat
-               $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-               $trans_tbl = array_flip($trans_tbl);
-               return strtr($string, $trans_tbl);
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog.  Pick a Blogware file to upload and click Import.').'</p>';
-               wp_import_upload_form("admin.php?import=blogware&amp;step=1");
-               echo '</div>';
-       }
-
-       function _normalize_tag( $matches ) {
-               return '<' . strtolower( $matches[1] );
-       }
-
-       function import_posts() {
-               global $wpdb, $current_user;
-
-               set_magic_quotes_runtime(0);
-               $importdata = file($this->file); // Read the file into an array
-               $importdata = implode('', $importdata); // squish it
-               $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);
-
-               preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
-               $posts = $posts[1];
-               unset($importdata);
-               echo '<ol>';
-               foreach ($posts as $post) {
-                       flush();
-                       preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
-                       $post_type = $post_type[1];
-                       if($post_type == "photo") {
-                               preg_match('|<photoFilename>(.*?)</photoFilename>|is', $post, $post_title);
-                       } else {
-                               preg_match('|<title>(.*?)</title>|is', $post, $post_title);
-                       }
-                       $post_title = $wpdb->escape(trim($post_title[1]));
-
-                       preg_match('|<pubDate>(.*?)</pubDate>|is', $post, $post_date);
-                       $post_date = strtotime($post_date[1]);
-                       $post_date = gmdate('Y-m-d H:i:s', $post_date);
-
-                       preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
-                       $categories = $categories[1];
-
-                       $cat_index = 0;
-                       foreach ($categories as $category) {
-                               $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
-                               $cat_index++;
-                       }
-
-                       if(strcasecmp($post_type, "photo") === 0) {
-                               preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
-                               $post_content = '<img src="'.trim($post_content[1]).'" />';
-                               $post_content = $this->unhtmlentities($post_content);
-                       } else {
-                               preg_match('|<body>(.*?)</body>|is', $post, $post_content);
-                               $post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
-                               $post_content = $this->unhtmlentities($post_content);
-                       }
-
-                       // Clean up content
-                       $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
-                       $post_content = str_replace('<br>', '<br />', $post_content);
-                       $post_content = str_replace('<hr>', '<hr />', $post_content);
-                       $post_content = $wpdb->escape($post_content);
-
-                       $post_author = $current_user->ID;
-                       preg_match('|<postStatus>(.*?)</postStatus>|is', $post, $post_status);
-                       $post_status = trim($post_status[1]);
-
-                       echo '<li>';
-                       if ($post_id = post_exists($post_title, $post_content, $post_date)) {
-                               printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
-                       } else {
-                               printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
-                               $postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
-                               $post_id = wp_insert_post($postdata);
-                               if ( is_wp_error( $post_id ) ) {
-                                       return $post_id;
-                               }
-                               if (!$post_id) {
-                                       _e('Couldn&#8217;t get post ID');
-                                       echo '</li>';
-                                       break;
-                               }
-                               if(0 != count($categories))
-                                       wp_create_categories($categories, $post_id);
-                       }
-
-                       preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
-                       $comments = $comments[1];
-
-                       if ( $comments ) {
-                               $comment_post_ID = (int) $post_id;
-                               $num_comments = 0;
-                               foreach ($comments as $comment) {
-                                       preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
-                                       $comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
-                                       $comment_content = $this->unhtmlentities($comment_content);
-
-                                       // Clean up content
-                                       $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content);
-                                       $comment_content = str_replace('<br>', '<br />', $comment_content);
-                                       $comment_content = str_replace('<hr>', '<hr />', $comment_content);
-                                       $comment_content = $wpdb->escape($comment_content);
-
-                                       preg_match('|<pubDate>(.*?)</pubDate>|is', $comment, $comment_date);
-                                       $comment_date = trim($comment_date[1]);
-                                       $comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
-
-                                       preg_match('|<author>(.*?)</author>|is', $comment, $comment_author);
-                                       $comment_author = $wpdb->escape(trim($comment_author[1]));
-
-                                       $comment_author_email = NULL;
-
-                                       $comment_approved = 1;
-                                       // Check if it's already there
-                                       if (!comment_exists($comment_author, $comment_date)) {
-                                               $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved');
-                                               $commentdata = wp_filter_comment($commentdata);
-                                               wp_insert_comment($commentdata);
-                                               $num_comments++;
-                                       }
-                               }
-                       }
-                       if ( $num_comments ) {
-                               echo ' ';
-                               printf( _n('%s comment', '%s comments', $num_comments), $num_comments );
-                       }
-                       echo '</li>';
-                       flush();
-                       ob_flush();
-               }
-               echo '</ol>';
-       }
-
-       function import() {
-               $file = wp_import_handle_upload();
-               if ( isset($file['error']) ) {
-                       echo $file['error'];
-                       return;
-               }
-
-               $this->file = $file['file'];
-               $result = $this->import_posts();
-               if ( is_wp_error( $result ) )
-                       return $result;
-               wp_import_cleanup($file['id']);
-               do_action('import_done', 'blogware');
-               echo '<h3>';
-               printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
-               echo '</h3>';
-       }
-
-       function dispatch() {
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-
-               $this->header();
-
-               switch ($step) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               $result = $this->import();
-                               if ( is_wp_error( $result ) )
-                                       $result->get_error_message();
-                               break;
-               }
-
-               $this->footer();
-       }
-
-       function BW_Import() {
-               // Nothing.
-       }
-}
-
-$blogware_import = new BW_Import();
-
-register_importer('blogware', __('Blogware'), __('Import posts from Blogware.'), array ($blogware_import, 'dispatch'));
-?>
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
deleted file mode 100644 (file)
index fcde9b1..0000000
+++ /dev/null
@@ -1,718 +0,0 @@
-<?php
-/**
- * DotClear Importer
- *
- * @package WordPress
- * @subpackage Importer
- * @author Thomas Quinot
- * @link http://thomas.quinot.org/
- */
-
-/**
-       Add These Functions to make our lives easier
-**/
-
-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;
-               return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
-       }
-}
-
-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;
-               return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
-       }
-}
-
-/**
- * Convert from dotclear charset to utf8 if required
- *
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $s
- * @return string
- */
-function csc ($s) {
-       if (seems_utf8 ($s)) {
-               return $s;
-       } else {
-               return iconv(get_option ("dccharset"),"UTF-8",$s);
-       }
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $s
- * @return string
- */
-function textconv ($s) {
-       return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
-}
-
-/**
- * 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">';
-               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>';
-       }
-
-       function footer()
-       {
-               echo '</div>';
-       }
-
-       function greet()
-       {
-               echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog.  Mileage may vary.').'</p>';
-               echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
-               echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
-               wp_nonce_field('import-dotclear');
-               $this->db_form();
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Categories').'" /></p>';
-               echo '</form></div>';
-       }
-
-       function get_dc_cats()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
-               set_magic_quotes_runtime(0);
-               $dbprefix = get_option('dcdbprefix');
-
-               // Get Categories
-               return $dcdb->get_results('SELECT * FROM '.$dbprefix.'categorie', ARRAY_A);
-       }
-
-       function get_dc_users()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
-               set_magic_quotes_runtime(0);
-               $dbprefix = get_option('dcdbprefix');
-
-               // Get Users
-
-               return $dcdb->get_results('SELECT * FROM '.$dbprefix.'user', ARRAY_A);
-       }
-
-       function get_dc_posts()
-       {
-               // General Housekeeping
-               $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
-               set_magic_quotes_runtime(0);
-               $dbprefix = get_option('dcdbprefix');
-
-               // Get Posts
-               return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
-                                               FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
-                                               ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
-       }
-
-       function get_dc_comments()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
-               set_magic_quotes_runtime(0);
-               $dbprefix = get_option('dcdbprefix');
-
-               // Get Comments
-               return $dcdb->get_results('SELECT * FROM '.$dbprefix.'comment', ARRAY_A);
-       }
-
-       function get_dc_links()
-       {
-               //General Housekeeping
-               $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
-               set_magic_quotes_runtime(0);
-               $dbprefix = get_option('dcdbprefix');
-
-               return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
-       }
-
-       function cat2wp($categories='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $dccat2wpcat = array();
-               // Do the Magic
-               if(is_array($categories))
-               {
-                       echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
-                       foreach ($categories as $category)
-                       {
-                               $count++;
-                               extract($category);
-
-                               // Make Nice Variables
-                               $name = $wpdb->escape($cat_libelle_url);
-                               $title = $wpdb->escape(csc ($cat_libelle));
-                               $desc = $wpdb->escape(csc ($cat_desc));
-
-                               if($cinfo = category_exists($name))
-                               {
-                                       $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
-                               }
-                               $dccat2wpcat[$id] = $ret_id;
-                       }
-
-                       // Store category translation for future use
-                       add_option('dccat2wpcat',$dccat2wpcat);
-                       echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Categories to Import!');
-               return false;
-       }
-
-       function users2wp($users='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $dcid2wpid = array();
-
-               // Midnight Mojo
-               if(is_array($users))
-               {
-                       echo '<p>'.__('Importing Users...').'<br /><br /></p>';
-                       foreach($users as $user)
-                       {
-                               $count++;
-                               extract($user);
-
-                               // Make Nice Variables
-                               $name = $wpdb->escape(csc ($name));
-                               $RealName = $wpdb->escape(csc ($user_pseudo));
-
-                               if($uinfo = get_userdatabylogin($name))
-                               {
-
-                                       $ret_id = wp_insert_user(array(
-                                                               'ID'            => $uinfo->ID,
-                                                               'user_login'    => $user_id,
-                                                               'user_nicename' => $Realname,
-                                                               'user_email'    => $user_email,
-                                                               'user_url'      => 'http://',
-                                                               'display_name'  => $Realname)
-                                                               );
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_user(array(
-                                                               'user_login'    => $user_id,
-                                                               'user_nicename' => csc ($user_pseudo),
-                                                               'user_email'    => $user_email,
-                                                               'user_url'      => 'http://',
-                                                               'display_name'  => $Realname)
-                                                               );
-                               }
-                               $dcid2wpid[$user_id] = $ret_id;
-
-                               // Set DotClear-to-WordPress permissions translation
-
-                               // Update Usermeta Data
-                               $user = new WP_User($ret_id);
-                               $wp_perms = $user_level + 1;
-                               if(10 == $wp_perms) { $user->set_role('administrator'); }
-                               else if(9  == $wp_perms) { $user->set_role('editor'); }
-                               else if(5  <= $wp_perms) { $user->set_role('editor'); }
-                               else if(4  <= $wp_perms) { $user->set_role('author'); }
-                               else if(3  <= $wp_perms) { $user->set_role('contributor'); }
-                               else if(2  <= $wp_perms) { $user->set_role('contributor'); }
-                               else                     { $user->set_role('subscriber'); }
-
-                               update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
-                               update_usermeta( $ret_id, 'rich_editing', 'false');
-                               update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
-                               update_usermeta( $ret_id, 'last_name', csc ($user_nom));
-                       }// End foreach($users as $user)
-
-                       // Store id translation array for future use
-                       add_option('dcid2wpid',$dcid2wpid);
-
-
-                       echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
-                       return true;
-               }// End if(is_array($users)
-
-               echo __('No Users to Import!');
-               return false;
-
-       }// End function user2wp()
-
-       function posts2wp($posts='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $dcposts2wpposts = array();
-               $cats = array();
-
-               // Do the Magic
-               if(is_array($posts))
-               {
-                       echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
-                       foreach($posts as $post)
-                       {
-                               $count++;
-                               extract($post);
-
-                               // Set DotClear-to-WordPress status translation
-                               $stattrans = array(0 => 'draft', 1 => 'publish');
-                               $comment_status_map = array (0 => 'closed', 1 => 'open');
-
-                               //Can we do this more efficiently?
-                               $uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
-                               $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
-
-                               $Title = $wpdb->escape(csc ($post_titre));
-                               $post_content = textconv ($post_content);
-                               $post_excerpt = "";
-                               if ($post_chapo != "") {
-                                       $post_excerpt = textconv ($post_chapo);
-                                       $post_content = $post_excerpt ."\n<!--more-->\n".$post_content;
-                               }
-                               $post_excerpt = $wpdb->escape ($post_excerpt);
-                               $post_content = $wpdb->escape ($post_content);
-                               $post_status = $stattrans[$post_pub];
-
-                               // Import Post data into WordPress
-
-                               if($pinfo = post_exists($Title,$post_content))
-                               {
-                                       $ret_id = wp_insert_post(array(
-                                                       'ID'                    => $pinfo,
-                                                       'post_author'           => $authorid,
-                                                       'post_date'             => $post_dt,
-                                                       'post_date_gmt'         => $post_dt,
-                                                       'post_modified'         => $post_upddt,
-                                                       'post_modified_gmt'     => $post_upddt,
-                                                       'post_title'            => $Title,
-                                                       'post_content'          => $post_content,
-                                                       'post_excerpt'          => $post_excerpt,
-                                                       'post_status'           => $post_status,
-                                                       'post_name'             => $post_titre_url,
-                                                       'comment_status'        => $comment_status_map[$post_open_comment],
-                                                       'ping_status'           => $comment_status_map[$post_open_tb],
-                                                       'comment_count'         => $post_nb_comment + $post_nb_trackback)
-                                                       );
-                                       if ( is_wp_error( $ret_id ) )
-                                               return $ret_id;
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_post(array(
-                                                       'post_author'           => $authorid,
-                                                       'post_date'             => $post_dt,
-                                                       'post_date_gmt'         => $post_dt,
-                                                       'post_modified'         => $post_modified_gmt,
-                                                       'post_modified_gmt'     => $post_modified_gmt,
-                                                       'post_title'            => $Title,
-                                                       'post_content'          => $post_content,
-                                                       'post_excerpt'          => $post_excerpt,
-                                                       'post_status'           => $post_status,
-                                                       'post_name'             => $post_titre_url,
-                                                       'comment_status'        => $comment_status_map[$post_open_comment],
-                                                       'ping_status'           => $comment_status_map[$post_open_tb],
-                                                       'comment_count'         => $post_nb_comment + $post_nb_trackback)
-                                                       );
-                                       if ( is_wp_error( $ret_id ) )
-                                               return $ret_id;
-                               }
-                               $dcposts2wpposts[$post_id] = $ret_id;
-
-                               // Make Post-to-Category associations
-                               $cats = array();
-                               $category1 = get_category_by_slug($post_cat_name);
-                               $category1 = $category1->term_id;
-
-                               if($cat1 = $category1) { $cats[1] = $cat1; }
-
-                               if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
-                       }
-               }
-               // Store ID translation for later use
-               add_option('dcposts2wpposts',$dcposts2wpposts);
-
-               echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
-               return true;
-       }
-
-       function comments2wp($comments='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $dccm2wpcm = array();
-               $postarr = get_option('dcposts2wpposts');
-
-               // Magic Mojo
-               if(is_array($comments))
-               {
-                       echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
-                       foreach($comments as $comment)
-                       {
-                               $count++;
-                               extract($comment);
-
-                               // WordPressify Data
-                               $comment_ID = (int) ltrim($comment_id, '0');
-                               $comment_post_ID = (int) $postarr[$post_id];
-                               $comment_approved = "$comment_pub";
-                               $name = $wpdb->escape(csc ($comment_auteur));
-                               $email = $wpdb->escape($comment_email);
-                               $web = "http://".$wpdb->escape($comment_site);
-                               $message = $wpdb->escape(textconv ($comment_content));
-
-                               $comment = array(
-                                                       'comment_post_ID'       => $comment_post_ID,
-                                                       'comment_author'        => $name,
-                                                       'comment_author_email'  => $email,
-                                                       'comment_author_url'    => $web,
-                                                       'comment_author_IP'     => $comment_ip,
-                                                       'comment_date'          => $comment_dt,
-                                                       'comment_date_gmt'      => $comment_dt,
-                                                       'comment_content'       => $message,
-                                                       'comment_approved'      => $comment_approved);
-                               $comment = wp_filter_comment($comment);
-
-                               if ( $cinfo = comment_exists($name, $comment_dt) ) {
-                                       // Update comments
-                                       $comment['comment_ID'] = $cinfo;
-                                       $ret_id = wp_update_comment($comment);
-                               } else {
-                                       // Insert comments
-                                       $ret_id = wp_insert_comment($comment);
-                               }
-                               $dccm2wpcm[$comment_ID] = $ret_id;
-                       }
-                       // Store Comment ID translation for future use
-                       add_option('dccm2wpcm', $dccm2wpcm);
-
-                       // Associate newly formed categories with posts
-                       get_comment_count($ret_id);
-
-
-                       echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Comments to Import!');
-               return false;
-       }
-
-       function links2wp($links='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-
-               // Deal with the links
-               if(is_array($links))
-               {
-                       echo '<p>'.__('Importing Links...').'<br /><br /></p>';
-                       foreach($links as $link)
-                       {
-                               $count++;
-                               extract($link);
-
-                               if ($title != "") {
-                                       if ($cinfo = is_term(csc ($title), 'link_category')) {
-                                               $category = $cinfo['term_id'];
-                                       } else {
-                                               $category = wp_insert_term($wpdb->escape (csc ($title)), 'link_category');
-                                               $category = $category['term_id'];
-                                       }
-                               } else {
-                                       $linkname = $wpdb->escape(csc ($label));
-                                       $description = $wpdb->escape(csc ($title));
-
-                                       if($linfo = link_exists($linkname)) {
-                                               $ret_id = wp_insert_link(array(
-                                                                       'link_id'               => $linfo,
-                                                                       'link_url'              => $href,
-                                                                       'link_name'             => $linkname,
-                                                                       'link_category'         => $category,
-                                                                       'link_description'      => $description)
-                                                                       );
-                                       } else {
-                                               $ret_id = wp_insert_link(array(
-                                                                       'link_url'              => $url,
-                                                                       'link_name'             => $linkname,
-                                                                       'link_category'         => $category,
-                                                                       'link_description'      => $description)
-                                                                       );
-                                       }
-                                       $dclinks2wplinks[$link_id] = $ret_id;
-                               }
-                       }
-                       add_option('dclinks2wplinks',$dclinks2wplinks);
-                       echo '<p>';
-                       printf(_n('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
-                       echo '<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Links to Import!');
-               return false;
-       }
-
-       function import_categories()
-       {
-               // Category Import
-               $cats = $this->get_dc_cats();
-               $this->cat2wp($cats);
-               add_option('dc_cats', $cats);
-
-
-
-               echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
-               wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
-               echo '</form>';
-
-       }
-
-       function import_users()
-       {
-               // User Import
-               $users = $this->get_dc_users();
-               $this->users2wp($users);
-
-               echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
-               wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
-               echo '</form>';
-       }
-
-       function import_posts()
-       {
-               // Post Import
-               $posts = $this->get_dc_posts();
-               $result = $this->posts2wp($posts);
-               if ( is_wp_error( $result ) )
-                       return $result;
-
-               echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
-               wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
-               echo '</form>';
-       }
-
-       function import_comments()
-       {
-               // Comment Import
-               $comments = $this->get_dc_comments();
-               $this->comments2wp($comments);
-
-               echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
-               wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
-               echo '</form>';
-       }
-
-       function import_links()
-       {
-               //Link Import
-               $links = $this->get_dc_links();
-               $this->links2wp($links);
-               add_option('dc_links', $links);
-
-               echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
-               wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
-               echo '</form>';
-       }
-
-       function cleanup_dcimport()
-       {
-               delete_option('dcdbprefix');
-               delete_option('dc_cats');
-               delete_option('dcid2wpid');
-               delete_option('dccat2wpcat');
-               delete_option('dcposts2wpposts');
-               delete_option('dccm2wpcm');
-               delete_option('dclinks2wplinks');
-               delete_option('dcuser');
-               delete_option('dcpass');
-               delete_option('dcname');
-               delete_option('dchost');
-               delete_option('dccharset');
-               do_action('import_done', 'dotclear');
-               $this->tips();
-       }
-
-       function tips()
-       {
-               echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from DotClear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
-               echo '<h3>'.__('Users').'</h3>';
-               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;t have that login in DotClear, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Log in</a> and change it.'), '/wp-login.php').'</p>';
-               echo '<h3>'.__('Preserving Authors').'</h3>';
-               echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
-               echo '<h3>'.__('Textile').'</h3>';
-               echo '<p>'.__('Also, since you&#8217;re coming from DotClear, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me&#8230; You&#8217;ll want it.').'</p>';
-               echo '<h3>'.__('WordPress Resources').'</h3>';
-               echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
-               echo '<ul>';
-               echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
-               echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
-               echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
-               echo '</ul>';
-               echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">log in</a>!'), '../wp-login.php').'</p>';
-       }
-
-       function db_form()
-       {
-               echo '<table class="form-table">';
-               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" 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>';
-       }
-
-       function dispatch()
-       {
-
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-               $this->header();
-
-               if ( $step > 0 )
-               {
-                       check_admin_referer('import-dotclear');
-
-                       if($_POST['dbuser'])
-                       {
-                               if(get_option('dcuser'))
-                                       delete_option('dcuser');
-                               add_option('dcuser', sanitize_user($_POST['dbuser'], true));
-                       }
-                       if($_POST['dbpass'])
-                       {
-                               if(get_option('dcpass'))
-                                       delete_option('dcpass');
-                               add_option('dcpass', sanitize_user($_POST['dbpass'], true));
-                       }
-
-                       if($_POST['dbname'])
-                       {
-                               if(get_option('dcname'))
-                                       delete_option('dcname');
-                               add_option('dcname', sanitize_user($_POST['dbname'], true));
-                       }
-                       if($_POST['dbhost'])
-                       {
-                               if(get_option('dchost'))
-                                       delete_option('dchost');
-                               add_option('dchost', sanitize_user($_POST['dbhost'], true));
-                       }
-                       if($_POST['dccharset'])
-                       {
-                               if(get_option('dccharset'))
-                                       delete_option('dccharset');
-                               add_option('dccharset', sanitize_user($_POST['dccharset'], true));
-                       }
-                       if($_POST['dbprefix'])
-                       {
-                               if(get_option('dcdbprefix'))
-                                       delete_option('dcdbprefix');
-                               add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true));
-                       }
-
-
-               }
-
-               switch ($step)
-               {
-                       default:
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               $this->import_categories();
-                               break;
-                       case 2 :
-                               $this->import_users();
-                               break;
-                       case 3 :
-                               $result = $this->import_posts();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-                       case 4 :
-                               $this->import_comments();
-                               break;
-                       case 5 :
-                               $this->import_links();
-                               break;
-                       case 6 :
-                               $this->cleanup_dcimport();
-                               break;
-               }
-
-               $this->footer();
-       }
-
-       function Dotclear_Import()
-       {
-               // Nothing.
-       }
-}
-
-$dc_import = new Dotclear_Import();
-
-register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog.'), array ($dc_import, 'dispatch'));
-
-?>
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php
deleted file mode 100644 (file)
index 47c15d4..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-<?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">';
-               screen_icon();
-               echo '<h2>'.__('Import GreyMatter').'</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function greet() {
-               $this->header();
-?>
-<p><?php _e('This is a basic GreyMatter to WordPress import script.') ?></p>
-<p><?php _e('What it does:') ?></p>
-<ul>
-<li><?php _e('Parses gm-authors.cgi to import (new) authors. Everyone is imported at level 1.') ?></li>
-<li><?php _e('Parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress yet).<br />If authors are found not to be in gm-authors.cgi, imports them at level 0.') ?></li>
-<li><?php _e("Detects duplicate entries or comments. If you don't import everything the first time, or this import should fail in the middle, duplicate entries will not be made when you try again.") ?></li>
-</ul>
-<p><?php _e('What it does not:') ?></p>
-<ul>
-<li><?php _e('Parse gm-counter.cgi, gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log).') ?></li>
-<li><?php _e('Import gm-templates.') ?></li>
-<li><?php _e("Doesn't keep entries on top.")?></li>
-</ul>
-<p>&nbsp;</p>
-
-<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'); ?>
-<h3><?php _e('Second step: GreyMatter details:') ?></h3>
-<table class="form-table">
-<tr>
-<td><label for="gmpath"><?php _e('Path to GM files:') ?></label></td>
-<td><input type="text" style="width:300px" name="gmpath" id="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
-</tr>
-<tr>
-<td><label for="archivespath"><?php _e('Path to GM entries:') ?></label></td>
-<td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
-</tr>
-<tr>
-<td><label for="lastentry"><?php _e('Last entry&#8217;s number:') ?></label></td>
-<td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
-       <?php _e('This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don&#8217;t know that number, just log in to your FTP and look it out<br />in the entries&#8217; folder)') ?></td>
-</tr>
-</table>
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Start Importing') ?>" /></p>
-</form>
-<?php
-               $this->footer();
-       }
-
-
-
-       function gm2autobr($string) { // transforms GM's |*| into b2's <br />\n
-               $string = str_replace("|*|","<br />\n",$string);
-               return($string);
-       }
-
-       function import() {
-               global $wpdb;
-
-               $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
-               for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-                       $wpvar = $wpvarstoreset[$i];
-                       if (!isset($$wpvar)) {
-                               if (empty($_POST["$wpvar"])) {
-                                       if (empty($_GET["$wpvar"])) {
-                                               $$wpvar = '';
-                                       } else {
-                                               $$wpvar = $_GET["$wpvar"];
-                                       }
-                               } else {
-                                       $$wpvar = $_POST["$wpvar"];
-                               }
-                       }
-               }
-
-               if (!chdir($archivespath))
-                       wp_die(__("Wrong path, the path to the GM entries does not exist on the server"));
-
-               if (!chdir($gmpath))
-                       wp_die(__("Wrong path, the path to the GM files does not exist on the server"));
-
-               $lastentry = (int) $lastentry;
-
-               $this->header();
-?>
-<p><?php _e('The importer is running...') ?></p>
-<ul>
-<li><?php _e('importing users...') ?><ul><?php
-
-       chdir($gmpath);
-       $userbase = file("gm-authors.cgi");
-
-       foreach($userbase as $user) {
-               $userdata=explode("|", $user);
-
-               $user_ip="127.0.0.1";
-               $user_domain="localhost";
-               $user_browser="server";
-
-               $s=$userdata[4];
-               $user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
-
-               $user_login=$wpdb->escape($userdata[0]);
-               $pass1=$wpdb->escape($userdata[1]);
-               $user_nickname=$wpdb->escape($userdata[0]);
-               $user_email=$wpdb->escape($userdata[2]);
-               $user_url=$wpdb->escape($userdata[3]);
-               $user_joindate=$wpdb->escape($user_joindate);
-
-               $user_id = username_exists($user_login);
-               if ($user_id) {
-                       printf('<li>'.__('user %s').'<strong>'.__('Already exists').'</strong></li>', "<em>$user_login</em>");
-                       $this->gmnames[$userdata[0]] = $user_id;
-                       continue;
-               }
-
-               $user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname");
-               $user_id = wp_insert_user($user_info);
-               $this->gmnames[$userdata[0]] = $user_id;
-
-               printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
-       }
-
-?></ul><strong><?php _e('Done') ?></strong></li>
-<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
-
-       chdir($archivespath);
-
-       for($i = 0; $i <= $lastentry; $i = $i + 1) {
-
-               $entryfile = "";
-
-               if ($i<10000000) {
-                       $entryfile .= "0";
-                       if ($i<1000000) {
-                               $entryfile .= "0";
-                               if ($i<100000) {
-                                       $entryfile .= "0";
-                                       if ($i<10000) {
-                                               $entryfile .= "0";
-                                               if ($i<1000) {
-                                                       $entryfile .= "0";
-                                                       if ($i<100) {
-                                                               $entryfile .= "0";
-                                                               if ($i<10) {
-                                                                       $entryfile .= "0";
-               }}}}}}}
-
-               $entryfile .= "$i";
-
-               if (is_file($entryfile.".cgi")) {
-
-                       $entry=file($entryfile.".cgi");
-                       $postinfo=explode("|",$entry[0]);
-                       $postmaincontent=$this->gm2autobr($entry[2]);
-                       $postmorecontent=$this->gm2autobr($entry[3]);
-
-                       $post_author=trim($wpdb->escape($postinfo[1]));
-
-                       $post_title=$this->gm2autobr($postinfo[2]);
-                       printf('<li>'.__('entry # %s : %s : by %s'), $entryfile, $post_title, $postinfo[1]);
-                       $post_title=$wpdb->escape($post_title);
-
-                       $postyear=$postinfo[6];
-                       $postmonth=zeroise($postinfo[4],2);
-                       $postday=zeroise($postinfo[5],2);
-                       $posthour=zeroise($postinfo[7],2);
-                       $postminute=zeroise($postinfo[8],2);
-                       $postsecond=zeroise($postinfo[9],2);
-
-                       if (($postinfo[10]=="PM") && ($posthour!="12"))
-                               $posthour=$posthour+12;
-
-                       $post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
-
-                       $post_content=$postmaincontent;
-                       if (strlen($postmorecontent)>3)
-                               $post_content .= "<!--more--><br /><br />".$postmorecontent;
-                       $post_content=$wpdb->escape($post_content);
-
-                       $post_karma=$postinfo[12];
-
-                       $post_status = 'publish'; //in greymatter, there are no drafts
-                       $comment_status = 'open';
-                       $ping_status = 'closed';
-
-                       if ($post_ID = post_exists($post_title, '', $post_date)) {
-                               echo ' ';
-                               _e('(already exists)');
-                       } else {
-                               //just so that if a post already exists, new users are not created by checkauthor
-                               // we'll check the author is registered, or if it's a deleted author
-                               $user_id = username_exists($post_author);
-                               if (!$user_id) {        // if deleted from GM, we register the author as a level 0 user
-                                       $user_ip="127.0.0.1";
-                                       $user_domain="localhost";
-                                       $user_browser="server";
-                                       $user_joindate="1979-06-06 00:41:00";
-                                       $user_login=$wpdb->escape($post_author);
-                                       $pass1=$wpdb->escape("password");
-                                       $user_nickname=$wpdb->escape($post_author);
-                                       $user_email=$wpdb->escape("user@deleted.com");
-                                       $user_url=$wpdb->escape("");
-                                       $user_joindate=$wpdb->escape($user_joindate);
-
-                                       $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
-                                       $user_id = wp_insert_user($user_info);
-                                       $this->gmnames[$postinfo[1]] = $user_id;
-
-                                       echo ': ';
-                                       printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
-                               }
-
-                               if (array_key_exists($postinfo[1], $this->gmnames)) {
-                                       $post_author = $this->gmnames[$postinfo[1]];
-                               } else {
-                                       $post_author = $user_id;
-                               }
-
-                               $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
-                               $post_ID = wp_insert_post($postdata);
-                               if ( is_wp_error( $post_ID ) )
-                                       return $post_ID;
-                       }
-
-                       $c=count($entry);
-                       if ($c>4) {
-                               $numAddedComments = 0;
-                               $numComments = 0;
-                               for ($j=4;$j<$c;$j++) {
-                                       $entry[$j]=$this->gm2autobr($entry[$j]);
-                                       $commentinfo=explode("|",$entry[$j]);
-                                       $comment_post_ID=$post_ID;
-                                       $comment_author=$wpdb->escape($commentinfo[0]);
-                                       $comment_author_email=$wpdb->escape($commentinfo[2]);
-                                       $comment_author_url=$wpdb->escape($commentinfo[3]);
-                                       $comment_author_IP=$wpdb->escape($commentinfo[1]);
-
-                                       $commentyear=$commentinfo[7];
-                                       $commentmonth=zeroise($commentinfo[5],2);
-                                       $commentday=zeroise($commentinfo[6],2);
-                                       $commenthour=zeroise($commentinfo[8],2);
-                                       $commentminute=zeroise($commentinfo[9],2);
-                                       $commentsecond=zeroise($commentinfo[10],2);
-                                       if (($commentinfo[11]=="PM") && ($commenthour!="12"))
-                                               $commenthour=$commenthour+12;
-                                       $comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
-
-                                       $comment_content=$wpdb->escape($commentinfo[12]);
-
-                                       if (!comment_exists($comment_author, $comment_date)) {
-                                               $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
-                                               $commentdata = wp_filter_comment($commentdata);
-                                               wp_insert_comment($commentdata);
-                                               $numAddedComments++;
-                                       }
-                                       $numComments++;
-                               }
-                               if ($numAddedComments > 0) {
-                                       echo ': ';
-                               printf( _n('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments);
-                               }
-                               $preExisting = $numComments - numAddedComments;
-                               if ($preExisting > 0) {
-                                       echo ' ';
-                                       printf( _n( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting);
-                               }
-                       }
-                       echo '... <strong>'.__('Done').'</strong></li>';
-               }
-       }
-       do_action('import_done', 'greymatter');
-       ?>
-</ul><strong><?php _e('Done') ?></strong></li></ul>
-<p>&nbsp;</p>
-<p><?php _e('Completed GreyMatter import!') ?></p>
-<?php
-       $this->footer();
-       return;
-       }
-
-       function dispatch() {
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-
-               switch ($step) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1:
-                               check_admin_referer('import-greymatter');
-                               $result = $this->import();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-               }
-       }
-
-       function GM_Import() {
-               // Nothing.
-       }
-}
-
-$gm_import = new GM_Import();
-
-register_importer('greymatter', __('GreyMatter'), __('Import users, posts, and comments from a Greymatter blog.'), array ($gm_import, 'dispatch'));
-?>
diff --git a/wp-admin/import/livejournal.php b/wp-admin/import/livejournal.php
deleted file mode 100644 (file)
index 7acfaa5..0000000
+++ /dev/null
@@ -1,1059 +0,0 @@
-<?php
-
-/**
- * LiveJournal API Importer
- *
- * @package WordPress
- * @subpackage Importer
- */
-
-// XML-RPC library for communicating with LiveJournal API
-require_once( ABSPATH . WPINC . '/class-IXR.php' );
-
-/**
- * LiveJournal API Importer class
- *
- * Imports your LiveJournal contents into WordPress using the LJ API
- *
- * @since 2.8
- */
-class LJ_API_Import {
-
-       var $comments_url = 'http://www.livejournal.com/export_comments.bml';
-       var $ixr_url      = 'http://www.livejournal.com/interface/xmlrpc';
-       var $ixr;
-       var $username;
-       var $password;
-       var $comment_meta;
-       var $comments;
-       var $usermap;
-       var $postmap;
-       var $commentmap;
-       var $pointers = array();
-
-       // This list taken from LJ, they don't appear to have an API for it
-       var $moods = array( '1' => 'aggravated',
-                                               '10' => 'discontent',
-                                               '100' => 'rushed',
-                                               '101' => 'contemplative',
-                                               '102' => 'nerdy',
-                                               '103' => 'geeky',
-                                               '104' => 'cynical',
-                                               '105' => 'quixotic',
-                                               '106' => 'crazy',
-                                               '107' => 'creative',
-                                               '108' => 'artistic',
-                                               '109' => 'pleased',
-                                               '11' => 'energetic',
-                                               '110' => 'bitchy',
-                                               '111' => 'guilty',
-                                               '112' => 'irritated',
-                                               '113' => 'blank',
-                                               '114' => 'apathetic',
-                                               '115' => 'dorky',
-                                               '116' => 'impressed',
-                                               '117' => 'naughty',
-                                               '118' => 'predatory',
-                                               '119' => 'dirty',
-                                               '12' => 'enraged',
-                                               '120' => 'giddy',
-                                               '121' => 'surprised',
-                                               '122' => 'shocked',
-                                               '123' => 'rejected',
-                                               '124' => 'numb',
-                                               '125' => 'cheerful',
-                                               '126' => 'good',
-                                               '127' => 'distressed',
-                                               '128' => 'intimidated',
-                                               '129' => 'crushed',
-                                               '13' => 'enthralled',
-                                               '130' => 'devious',
-                                               '131' => 'thankful',
-                                               '132' => 'grateful',
-                                               '133' => 'jealous',
-                                               '134' => 'nervous',
-                                               '14' => 'exhausted',
-                                               '15' => 'happy',
-                                               '16' => 'high',
-                                               '17' => 'horny',
-                                               '18' => 'hungry',
-                                               '19' => 'infuriated',
-                                               '2' => 'angry',
-                                               '20' => 'irate',
-                                               '21' => 'jubilant',
-                                               '22' => 'lonely',
-                                               '23' => 'moody',
-                                               '24' => 'pissed off',
-                                               '25' => 'sad',
-                                               '26' => 'satisfied',
-                                               '27' => 'sore',
-                                               '28' => 'stressed',
-                                               '29' => 'thirsty',
-                                               '3' => 'annoyed',
-                                               '30' => 'thoughtful',
-                                               '31' => 'tired',
-                                               '32' => 'touched',
-                                               '33' => 'lazy',
-                                               '34' => 'drunk',
-                                               '35' => 'ditzy',
-                                               '36' => 'mischievous',
-                                               '37' => 'morose',
-                                               '38' => 'gloomy',
-                                               '39' => 'melancholy',
-                                               '4' => 'anxious',
-                                               '40' => 'drained',
-                                               '41' => 'excited',
-                                               '42' => 'relieved',
-                                               '43' => 'hopeful',
-                                               '44' => 'amused',
-                                               '45' => 'determined',
-                                               '46' => 'scared',
-                                               '47' => 'frustrated',
-                                               '48' => 'indescribable',
-                                               '49' => 'sleepy',
-                                               '5' => 'bored',
-                                               '51' => 'groggy',
-                                               '52' => 'hyper',
-                                               '53' => 'relaxed',
-                                               '54' => 'restless',
-                                               '55' => 'disappointed',
-                                               '56' => 'curious',
-                                               '57' => 'mellow',
-                                               '58' => 'peaceful',
-                                               '59' => 'bouncy',
-                                               '6' => 'confused',
-                                               '60' => 'nostalgic',
-                                               '61' => 'okay',
-                                               '62' => 'rejuvenated',
-                                               '63' => 'complacent',
-                                               '64' => 'content',
-                                               '65' => 'indifferent',
-                                               '66' => 'silly',
-                                               '67' => 'flirty',
-                                               '68' => 'calm',
-                                               '69' => 'refreshed',
-                                               '7' => 'crappy',
-                                               '70' => 'optimistic',
-                                               '71' => 'pessimistic',
-                                               '72' => 'giggly',
-                                               '73' => 'pensive',
-                                               '74' => 'uncomfortable',
-                                               '75' => 'lethargic',
-                                               '76' => 'listless',
-                                               '77' => 'recumbent',
-                                               '78' => 'exanimate',
-                                               '79' => 'embarrassed',
-                                               '8' => 'cranky',
-                                               '80' => 'envious',
-                                               '81' => 'sympathetic',
-                                               '82' => 'sick',
-                                               '83' => 'hot',
-                                               '84' => 'cold',
-                                               '85' => 'worried',
-                                               '86' => 'loved',
-                                               '87' => 'awake',
-                                               '88' => 'working',
-                                               '89' => 'productive',
-                                               '9' => 'depressed',
-                                               '90' => 'accomplished',
-                                               '91' => 'busy',
-                                               '92' => 'blah',
-                                               '93' => 'full',
-                                               '95' => 'grumpy',
-                                               '96' => 'weird',
-                                               '97' => 'nauseated',
-                                               '98' => 'ecstatic',
-                                               '99' => 'chipper' );
-
-       function header() {
-               echo '<div class="wrap">';
-               screen_icon();
-               echo '<h2>' . __( 'Import LiveJournal' ) . '</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function greet() {
-               ?>
-               <div class="narrow">
-               <form action="admin.php?import=livejournal" method="post">
-               <?php wp_nonce_field( 'lj-api-import' ) ?>
-               <?php if ( get_option( 'ljapi_username' ) && get_option( 'ljapi_password' ) ) : ?>
-                       <input type="hidden" name="step" value="<?php echo esc_attr( get_option( 'ljapi_step' ) ) ?>" />
-                       <p><?php _e( 'It looks like you attempted to import your LiveJournal posts previously and got interrupted.' ) ?></p>
-                       <p class="submit">
-                               <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Continue previous import' ) ?>" />
-                       </p>
-                       <p class="submitbox"><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( $_SERVER['REQUEST_URI'] )) ?>" class="deletion submitdelete"><?php _e( 'Cancel &amp; start a new import' ) ?></a></p>
-                       <p>
-               <?php else : ?>
-                       <input type="hidden" name="step" value="1" />
-                       <input type="hidden" name="login" value="true" />
-                       <p><?php _e( 'Howdy! This importer allows you to connect directly to LiveJournal and download all your entries and comments' ) ?></p>
-                       <p><?php _e( 'Enter your LiveJournal username and password below so we can connect to your account:' ) ?></p>
-
-                       <table class="form-table">
-
-                       <tr>
-                       <th scope="row"><label for="lj_username"><?php _e( 'LiveJournal Username' ) ?></label></th>
-                       <td><input type="text" name="lj_username" id="lj_username" class="regular-text" /></td>
-                       </tr>
-
-                       <tr>
-                       <th scope="row"><label for="lj_password"><?php _e( 'LiveJournal Password' ) ?></label></th>
-                       <td><input type="password" name="lj_password" id="lj_password" class="regular-text" /></td>
-                       </tr>
-
-                       </table>
-
-                       <p><?php _e( 'If you have any entries on LiveJournal which are marked as private, they will be password-protected when they are imported so that only people who know the password can see them.' ) ?></p>
-                       <p><?php _e( 'If you don&#8217;t enter a password, ALL ENTRIES from your LiveJournal will be imported as public posts in WordPress.' ) ?></p>
-                       <p><?php _e( 'Enter the password you would like to use for all protected entries here:' ) ?></p>
-                       <table class="form-table">
-
-                       <tr>
-                       <th scope="row"><label for="protected_password"><?php _e( 'Protected Post Password' ) ?></label></th>
-                       <td><input type="text" name="protected_password" id="protected_password" class="regular-text" /></td>
-                       </tr>
-
-                       </table>
-
-                       <p><?php _e( "<strong>WARNING:</strong> This can take a really long time if you have a lot of entries in your LiveJournal, or a lot of comments. Ideally, you should only start this process if you can leave your computer alone while it finishes the import." ) ?></p>
-
-                       <p class="submit">
-                               <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Connect to LiveJournal and Import' ) ?>" />
-                       </p>
-
-                       <p><?php _e( '<strong>NOTE:</strong> If the import process is interrupted for <em>any</em> reason, come back to this page and it will continue from where it stopped automatically.' ) ?></p>
-
-                       <noscript>
-                               <p><?php _e( '<strong>NOTE:</strong> You appear to have JavaScript disabled, so you will need to manually click through each step of this importer. If you enable JavaScript, it will step through automatically.' ) ?></p>
-                       </noscript>
-               <?php endif; ?>
-               </form>
-               </div>
-               <?php
-       }
-
-       function download_post_meta() {
-               $total           = (int) get_option( 'ljapi_total' );
-               $count           = (int) get_option( 'ljapi_count' );
-               $lastsync        = get_option( 'ljapi_lastsync' );
-               if ( !$lastsync ) {
-                       update_option( 'ljapi_lastsync', '1900-01-01 00:00:00' );
-               }
-               $sync_item_times = get_option( 'ljapi_sync_item_times' );
-               if ( !is_array( $sync_item_times ) )
-                       $sync_item_times = array();
-
-               do {
-                       $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync' ) ) );
-                       $synclist = $this->lj_ixr( 'syncitems', array( 'ver' => 1, 'lastsync' => $lastsync ) );
-                       if ( is_wp_error( $synclist ) )
-                               return $synclist;
-
-                       // Keep track of if we've downloaded everything
-                       $total = $synclist['total'];
-                       $count = $synclist['count'];
-
-                       foreach ( $synclist['syncitems'] as $event ) {
-                               if ( substr( $event['item'], 0, 2 ) == 'L-' ) {
-                                       $sync_item_times[ str_replace( 'L-', '', $event['item'] ) ] = $event['time'];
-                                       if ( $event['time'] > $lastsync ) {
-                                               $lastsync = $event['time'];
-                                               update_option( 'ljapi_lastsync', $lastsync );
-                                       }
-                               }
-                       }
-               } while ( $total > $count );
-               // endwhile - all post meta is cached locally
-               unset( $synclist );
-               update_option( 'ljapi_sync_item_times', $sync_item_times );
-               update_option( 'ljapi_total', $total );
-               update_option( 'ljapi_count', $count );
-
-               echo '<p>' . __( 'Post metadata has been downloaded, proceeding with posts...' ) . '</p>';
-       }
-
-       function download_post_bodies() {
-               $imported_count  = (int) get_option( 'ljapi_imported_count' );
-               $sync_item_times = get_option( 'ljapi_sync_item_times' );
-               $lastsync        = get_option( 'ljapi_lastsync_posts' );
-               if ( !$lastsync )
-                       update_option( 'ljapi_lastsync_posts', date( 'Y-m-d H:i:s', 0 ) );
-
-               $count = 0;
-               echo '<ol>';
-               do {
-                       $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync_posts' ) ) );
-
-                       // Get the batch of items that match up with the syncitems list
-                       $itemlist = $this->lj_ixr( 'getevents', array( 'ver' => 1,
-                                                                                                                       'selecttype' => 'syncitems',
-                                                                                                                       'lineendings' => 'pc',
-                                                                                                                       'lastsync' => $lastsync ) );
-                       if ( is_wp_error( $itemlist ) )
-                               return $itemlist;
-
-                       if ( $num = count( $itemlist['events'] ) ) {
-                               for ( $e = 0; $e < count( $itemlist['events'] ); $e++ ) {
-                                       $event = $itemlist['events'][$e];
-                                       $imported_count++;
-                                       $inserted = $this->import_post( $event );
-                                       if ( is_wp_error( $inserted ) )
-                                               return $inserted;
-                                       if ( $sync_item_times[ $event['itemid'] ] > $lastsync )
-                                               $lastsync = $sync_item_times[ $event['itemid'] ];
-                                       wp_cache_flush();
-                               }
-                               update_option( 'ljapi_lastsync_posts',  $lastsync );
-                               update_option( 'ljapi_imported_count',  $imported_count );
-                               update_option( 'ljapi_last_sync_count', $num );
-                       }
-                       $count++;
-               } while ( $num > 0 && $count < 3 ); // Doing up to 3 requests at a time to avoid memory problems
-
-               // Used so that step1 knows when to stop posting back on itself
-               update_option( 'ljapi_last_sync_count', $num );
-
-               // Counter just used to show progress to user
-               update_option( 'ljapi_post_batch', ( (int) get_option( 'ljapi_post_batch' ) + 1 ) );
-
-               echo '</ol>';
-       }
-
-       function _normalize_tag( $matches ) {
-               return '<' . strtolower( $matches[1] );
-       }
-
-       function import_post( $post ) {
-               global $wpdb;
-
-               // Make sure we haven't already imported this one
-               if ( $this->get_wp_post_ID( $post['itemid'] ) )
-                       return;
-
-               $user = wp_get_current_user();
-               $post_author      = $user->ID;
-               $post['security'] = !empty( $post['security'] ) ? $post['security'] : '';
-               $post_status      = ( 'private' == trim( $post['security'] ) ) ? 'private' : 'publish'; // Only me
-               $post_password    = ( 'usemask' == trim( $post['security'] ) ) ? $this->protected_password : ''; // "Friends" via password
-
-               // For some reason, LJ sometimes sends a date as "2004-04-1408:38:00" (no space btwn date/time)
-               $post_date = $post['eventtime'];
-               if ( 18 == strlen( $post_date ) )
-                       $post_date = substr( $post_date, 0, 10 ) . ' ' . substr( $post_date, 10 );
-
-               // Cleaning up and linking the title
-               $post_title = isset( $post['subject'] ) ? trim( $post['subject'] ) : '';
-               $post_title = $this->translate_lj_user( $post_title ); // Translate it, but then we'll strip the link
-               $post_title = strip_tags( $post_title ); // Can't have tags in the title in WP
-               $post_title = $wpdb->escape( $post_title );
-
-               // Clean up content
-               $post_content = $post['event'];
-               $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content );
-               // XHTMLize some tags
-               $post_content = str_replace( '<br>', '<br />', $post_content );
-               $post_content = str_replace( '<hr>', '<hr />', $post_content );
-               // lj-cut ==>  <!--more-->
-               $post_content = preg_replace( '|<lj-cut text="([^"]*)">|is', '<!--more $1-->', $post_content );
-               $post_content = str_replace( array( '<lj-cut>', '</lj-cut>' ), array( '<!--more-->', '' ), $post_content );
-               $first = strpos( $post_content, '<!--more' );
-               $post_content = substr( $post_content, 0, $first + 1 ) . preg_replace( '|<!--more(.*)?-->|sUi', '', substr( $post_content, $first + 1 ) );
-               // lj-user ==>  a href
-               $post_content = $this->translate_lj_user( $post_content );
-               //$post_content = force_balance_tags( $post_content );
-               $post_content = $wpdb->escape( $post_content );
-
-               // Handle any tags associated with the post
-               $tags_input = !empty( $post['props']['taglist'] ) ? $post['props']['taglist'] : '';
-
-               // Check if comments are closed on this post
-               $comment_status = !empty( $post['props']['opt_nocomments'] ) ? 'closed' : 'open';
-
-               echo '<li>';
-               if ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
-                       printf( __( 'Post <strong>%s</strong> already exists.' ), stripslashes( $post_title ) );
-               } else {
-                       printf( __( 'Imported post <strong>%s</strong>...' ), stripslashes( $post_title ) );
-                       $postdata = compact( 'post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'post_password', 'tags_input', 'comment_status' );
-                       $post_id = wp_insert_post( $postdata, true );
-                       if ( is_wp_error( $post_id ) ) {
-                               if ( 'empty_content' == $post_id->get_error_code() )
-                                       return; // Silent skip on "empty" posts
-                               return $post_id;
-                       }
-                       if ( !$post_id ) {
-                               _e( 'Couldn&#8217;t get post ID (creating post failed!)' );
-                               echo '</li>';
-                               return new WP_Error( 'insert_post_failed', __( 'Failed to create post.' ) );
-                       }
-
-                       // Handle all the metadata for this post
-                       $this->insert_postmeta( $post_id, $post );
-               }
-               echo '</li>';
-       }
-
-       // Convert lj-user tags to links to that user
-       function translate_lj_user( $str ) {
-               return preg_replace( '|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $str );
-       }
-
-       function insert_postmeta( $post_id, $post ) {
-               // Need the original LJ id for comments
-               add_post_meta( $post_id, 'lj_itemid', $post['itemid'] );
-
-               // And save the permalink on LJ in case we want to link back or something
-               add_post_meta( $post_id, 'lj_permalink', $post['url'] );
-
-               // Supports the following "props" from LJ, saved as lj_<prop_name> in wp_postmeta
-               //              Adult Content - adult_content
-               //              Location - current_coords + current_location
-               //              Mood - current_mood (translated from current_moodid)
-               //              Music - current_music
-               //              Userpic - picture_keyword
-               foreach ( array( 'adult_content', 'current_coords', 'current_location', 'current_moodid', 'current_music', 'picture_keyword' ) as $prop ) {
-                       if ( !empty( $post['props'][$prop] ) ) {
-                               if ( 'current_moodid' == $prop ) {
-                                       $prop = 'current_mood';
-                                       $val = $this->moods[ $post['props']['current_moodid'] ];
-                               } else {
-                                       $val = $post['props'][$prop];
-                               }
-                               add_post_meta( $post_id, 'lj_' . $prop, $val );
-                       }
-               }
-       }
-
-       // Set up a session (authenticate) with LJ
-       function get_session() {
-               // Get a session via XMLRPC
-               $cookie = $this->lj_ixr( 'sessiongenerate', array( 'ver' => 1, 'expiration' => 'short' ) );
-               if ( is_wp_error( $cookie ) )
-                       return new WP_Error( 'cookie', __( 'Could not get a cookie from LiveJournal. Please try again soon.' ) );
-               return new WP_Http_Cookie( array( 'name' => 'ljsession', 'value' => $cookie['ljsession'] ) );
-       }
-
-       // Loops through and gets comment meta from LJ in batches
-       function download_comment_meta() {
-               $cookie = $this->get_session();
-               if ( is_wp_error( $cookie ) )
-                       return $cookie;
-
-               // Load previous state (if any)
-               $this->usermap = (array) get_option( 'ljapi_usermap' );
-               $maxid         = get_option( 'ljapi_maxid' ) ? get_option( 'ljapi_maxid' ) : 1;
-               $highest_id    = get_option( 'ljapi_highest_id' ) ? get_option( 'ljapi_highest_id' ) : 0;
-
-               // We need to loop over the metadata request until we have it all
-               while ( $maxid > $highest_id ) {
-                       // Now get the meta listing
-                       $results = wp_remote_get( $this->comments_url . '?get=comment_meta&startid=' . ( $highest_id + 1 ),
-                                                                               array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
-                       if ( is_wp_error( $results ) )
-                               return new WP_Error( 'comment_meta', __( 'Failed to retrieve comment meta information from LiveJournal. Please try again soon.' ) );
-
-                       $results = wp_remote_retrieve_body( $results );
-
-                       // Get the maxid so we know if we have them all yet
-                       preg_match( '|<maxid>(\d+)</maxid>|', $results, $matches );
-                       if ( 0 == $matches[1] ) {
-                               // No comment meta = no comments for this journal
-                               echo '<p>' . __( 'You have no comments to import!' ) . '</p>';
-                               update_option( 'ljapi_highest_id', 1 );
-                               update_option( 'ljapi_highest_comment_id', 1 );
-                               return false; // Bail out of comment importing entirely
-                       }
-                       $maxid = !empty( $matches[1] ) ? $matches[1] : $maxid;
-
-                       // Parse comments and get highest id available
-                       preg_match_all( '|<comment id=\'(\d+)\'|is', $results, $matches );
-                       foreach ( $matches[1] as $id ) {
-                               if ( $id > $highest_id )
-                                       $highest_id = $id;
-                       }
-
-                       // Parse out the list of user mappings, and add it to the known list
-                       preg_match_all( '|<usermap id=\'(\d+)\' user=\'([^\']+)\' />|', $results, $matches );
-                       foreach ( $matches[1] as $count => $userid )
-                               $this->usermap[$userid] = $matches[2][$count]; // need this in memory for translating ids => names
-
-                       wp_cache_flush();
-               }
-               // endwhile - should have seen all comment meta at this point
-
-               update_option( 'ljapi_usermap',    $this->usermap );
-               update_option( 'ljapi_maxid',      $maxid );
-               update_option( 'ljapi_highest_id', $highest_id );
-
-               echo '<p>' . __( ' Comment metadata downloaded successfully, proceeding with comment bodies...' ) . '</p>';
-
-               return true;
-       }
-
-       // Downloads actual comment bodies from LJ
-       // Inserts them all directly to the DB, with additional info stored in "spare" fields
-       function download_comment_bodies() {
-               global $wpdb;
-               $cookie = $this->get_session();
-               if ( is_wp_error( $cookie ) )
-                       return $cookie;
-
-               // Load previous state (if any)
-               $this->usermap = (array) get_option( 'ljapi_usermap' );
-               $maxid         = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1;
-               $highest_id    = (int) get_option( 'ljapi_highest_comment_id' );
-               $loop = 0;
-               while ( $maxid > $highest_id && $loop < 5 ) { // We do 5 loops per call to avoid memory limits
-                       $loop++;
-
-                       // Get a batch of comments, using the highest_id we've already got as a starting point
-                       $results = wp_remote_get( $this->comments_url . '?get=comment_body&startid=' . ( $highest_id + 1 ),
-                                                                               array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
-                       if ( is_wp_error( $results ) )
-                               return new WP_Error( 'comment_bodies', __( 'Failed to retrieve comment bodies from LiveJournal. Please try again soon.' ) );
-
-                       $results = wp_remote_retrieve_body( $results );
-
-                       // Parse out each comment and insert directly
-                       preg_match_all( '|<comment id=\'(\d+)\'.*</comment>|iUs', $results, $matches );
-                       for ( $c = 0; $c < count( $matches[0] ); $c++ ) {
-                               // Keep track of highest id seen
-                               if ( $matches[1][$c] > $highest_id ) {
-                                       $highest_id = $matches[1][$c];
-                                       update_option( 'ljapi_highest_comment_id', $highest_id );
-                               }
-
-                               $comment = $matches[0][$c];
-
-                               // Filter out any captured, deleted comments (nothing useful to import)
-                               $comment = preg_replace( '|<comment id=\'\d+\' jitemid=\'\d+\' posterid=\'\d+\' state=\'D\'[^/]*/>|is', '', $comment );
-
-                               // Parse this comment into an array and insert
-                               $comment = $this->parse_comment( $comment );
-                               $comment = wp_filter_comment( $comment );
-                               $id = wp_insert_comment( $comment );
-
-                               // Clear cache
-                               clean_comment_cache( $id );
-                       }
-
-                       // Clear cache to preseve memory
-                       wp_cache_flush();
-               }
-               // endwhile - all comments downloaded and ready for bulk processing
-
-               // Counter just used to show progress to user
-               update_option( 'ljapi_comment_batch', ( (int) get_option( 'ljapi_comment_batch' ) + 1 ) );
-
-               return true;
-       }
-
-       // Takes a block of XML and parses out all the elements of the comment
-       function parse_comment( $comment ) {
-               global $wpdb;
-
-               // Get the top-level attributes
-               preg_match( '|<comment([^>]+)>|i', $comment, $attribs );
-               preg_match( '| id=\'(\d+)\'|i', $attribs[1], $matches );
-               $lj_comment_ID = $matches[1];
-               preg_match( '| jitemid=\'(\d+)\'|i', $attribs[1], $matches );
-               $lj_comment_post_ID = $matches[1];
-               preg_match( '| posterid=\'(\d+)\'|i', $attribs[1], $matches );
-               $comment_author_ID = isset( $matches[1] ) ? $matches[1] : 0;
-               preg_match( '| parentid=\'(\d+)\'|i', $attribs[1], $matches ); // optional
-               $lj_comment_parent = isset( $matches[1] ) ? $matches[1] : 0;
-               preg_match( '| state=\'([SDFA])\'|i', $attribs[1], $matches ); // optional
-               $lj_comment_state = isset( $matches[1] ) ? $matches[1] : 'A';
-
-               // Clean up "subject" - this will become the first line of the comment in WP
-               preg_match( '|<subject>(.*)</subject>|is', $comment, $matches );
-               if ( isset( $matches[1] ) ) {
-                       $comment_subject = $wpdb->escape( trim( $matches[1] ) );
-                       if ( 'Re:' == $comment_subject )
-                               $comment_subject = '';
-               }
-
-               // Get the body and HTMLize it
-               preg_match( '|<body>(.*)</body>|is', $comment, $matches );
-               $comment_content = !empty( $comment_subject ) ? $comment_subject . "\n\n" . $matches[1] : $matches[1];
-               $comment_content = @html_entity_decode( $comment_content, ENT_COMPAT, get_option('blog_charset') );
-               $comment_content = str_replace( '&apos;', "'", $comment_content );
-               $comment_content = wpautop( $comment_content );
-               $comment_content = str_replace( '<br>', '<br />', $comment_content );
-               $comment_content = str_replace( '<hr>', '<hr />', $comment_content );
-               $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content );
-               $comment_content = $wpdb->escape( trim( $comment_content ) );
-
-               // Get and convert the date
-               preg_match( '|<date>(.*)</date>|i', $comment, $matches );
-               $comment_date = trim( str_replace( array( 'T', 'Z' ), ' ', $matches[1] ) );
-
-               // Grab IP if available
-               preg_match( '|<property name=\'poster_ip\'>(.*)</property>|i', $comment, $matches ); // optional
-               $comment_author_IP = isset( $matches[1] ) ? $matches[1] : '';
-
-               // Try to get something useful for the comment author, especially if it was "my" comment
-               $author = ( empty( $comment_author_ID ) || empty( $this->usermap[$comment_author_ID] ) || substr( $this->usermap[$comment_author_ID], 0, 4 ) == 'ext_' ) ? __( 'Anonymous' ) : $this->usermap[$comment_author_ID];
-               if ( get_option( 'ljapi_username' ) == $author ) {
-                       $user    = wp_get_current_user();
-                       $user_id = $user->ID;
-                       $author  = $user->display_name;
-                       $url     = trailingslashit( get_option( 'home' ) );
-               } else {
-                       $user_id = 0;
-                       $url     = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/';
-               }
-
-               // Send back the array of details
-               return array( 'lj_comment_ID' => $lj_comment_ID,
-                                               'lj_comment_post_ID' => $lj_comment_post_ID,
-                                               'lj_comment_parent' => ( !empty( $lj_comment_parent ) ? $lj_comment_parent : 0 ),
-                                               'lj_comment_state' => $lj_comment_state,
-                                               'comment_post_ID' => $this->get_wp_post_ID( $lj_comment_post_ID ),
-                                               'comment_author' => $author,
-                                               'comment_author_url' => $url,
-                                               'comment_author_email' => '',
-                                               'comment_content' => $comment_content,
-                                               'comment_date' => $comment_date,
-                                               'comment_author_IP' => ( !empty( $comment_author_IP ) ? $comment_author_IP : '' ),
-                                               'comment_approved' => ( in_array( $lj_comment_state, array( 'A', 'F' ) ) ? 1 : 0 ),
-                                               'comment_karma' => $lj_comment_ID, // Need this and next value until rethreading is done
-                                               'comment_agent' => $lj_comment_parent,
-                                               'comment_type' => 'livejournal',  // Custom type, so we can find it later for processing
-                                               'user_ID' => $user_id
-                                       );
-       }
-
-
-       // Gets the post_ID that a LJ post has been saved as within WP
-       function get_wp_post_ID( $post ) {
-               global $wpdb;
-
-               if ( empty( $this->postmap[$post] ) )
-                       $this->postmap[$post] = (int) $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'lj_itemid' AND meta_value = %d", $post ) );
-
-               return $this->postmap[$post];
-       }
-
-       // Gets the comment_ID that a LJ comment has been saved as within WP
-       function get_wp_comment_ID( $comment ) {
-               global $wpdb;
-               if ( empty( $this->commentmap[$comment] ) )
-                       $this->commentmap[$comment] = $wpdb->get_var( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_karma = %d", $comment ) );
-               return $this->commentmap[$comment];
-       }
-
-       function lj_ixr() {
-               if ( $challenge = $this->ixr->query( 'LJ.XMLRPC.getchallenge' ) ) {
-                       $challenge = $this->ixr->getResponse();
-               }
-               if ( isset( $challenge['challenge'] ) ) {
-                       $params = array( 'username' => $this->username,
-                                                       'auth_method' => 'challenge',
-                                                       'auth_challenge' => $challenge['challenge'],
-                                                       'auth_response' => md5( $challenge['challenge'] . md5( $this->password ) ) );
-               } else {
-                       return new WP_Error( 'IXR', __( 'LiveJournal is not responding to authentication requests. Please wait a while and then try again.' ) );
-               }
-
-               $args = func_get_args();
-        $method = array_shift( $args );
-               if ( isset( $args[0] ) )
-                       $params = array_merge( $params, $args[0] );
-               if ( $this->ixr->query( 'LJ.XMLRPC.' . $method, $params ) ) {
-                       return $this->ixr->getResponse();
-               } else {
-                       return new WP_Error( 'IXR', __( 'XML-RPC Request Failed -- ' ) . $this->ixr->getErrorCode() . ': ' . $this->ixr->getErrorMessage() );
-               }
-       }
-
-       function dispatch() {
-               if ( empty( $_REQUEST['step'] ) )
-                       $step = 0;
-               else
-                       $step = (int) $_REQUEST['step'];
-
-               $this->header();
-
-               switch ( $step ) {
-                       case -1 :
-                               $this->cleanup();
-                               // Intentional no break
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                       case 2 :
-                       case 3 :
-                               check_admin_referer( 'lj-api-import' );
-                               $result = $this->{ 'step' . $step }();
-                               if ( is_wp_error( $result ) ) {
-                                       $this->throw_error( $result, $step );
-                               }
-                               break;
-               }
-
-               $this->footer();
-       }
-
-       // Technically the first half of step 1, this is separated to allow for AJAX
-       // calls. Sets up some variables and options and confirms authentication.
-       function setup() {
-               global $verified;
-               // Get details from form or from DB
-               if ( !empty( $_POST['lj_username'] ) && !empty( $_POST['lj_password'] ) ) {
-                       // Store details for later
-                       $this->username = $_POST['lj_username'];
-                       $this->password = $_POST['lj_password'];
-                       update_option( 'ljapi_username', $this->username );
-                       update_option( 'ljapi_password', $this->password );
-               } else {
-                       $this->username = get_option( 'ljapi_username' );
-                       $this->password = get_option( 'ljapi_password' );
-               }
-
-               // This is the password to set on protected posts
-               if ( !empty( $_POST['protected_password'] ) ) {
-                       $this->protected_password = $_POST['protected_password'];
-                       update_option( 'ljapi_protected_password', $this->protected_password );
-               } else {
-                       $this->protected_password = get_option( 'ljapi_protected_password' );
-               }
-
-               // Log in to confirm the details are correct
-               if ( empty( $this->username ) || empty( $this->password ) ) {
-                       ?>
-                       <p><?php _e( 'Please enter your LiveJournal username <em>and</em> password so we can download your posts and comments.' ) ?></p>
-                       <p><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( str_replace( '&step=1', '', $_SERVER['REQUEST_URI'] ) ) ) ?>"><?php _e( 'Start again' ) ?></a></p>
-                       <?php
-                       return false;
-               }
-               $verified = $this->lj_ixr( 'login' );
-               if ( is_wp_error( $verified ) ) {
-                       if ( 100 == $this->ixr->getErrorCode() || 101 == $this->ixr->getErrorCode() ) {
-                               delete_option( 'ljapi_username' );
-                               delete_option( 'ljapi_password' );
-                               delete_option( 'ljapi_protected_password' );
-                               ?>
-                               <p><?php _e( 'Logging in to LiveJournal failed. Check your username and password and try again.' ) ?></p>
-                               <p><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( str_replace( '&step=1', '', $_SERVER['REQUEST_URI'] ) ) ) ?>"><?php _e( 'Start again' ) ?></a></p>
-                               <?php
-                               return false;
-                       } else {
-                               return $verified;
-                       }
-               } else {
-                       update_option( 'ljapi_verified', 'yes' );
-               }
-
-               // Set up some options to avoid them autoloading (these ones get big)
-               add_option( 'ljapi_sync_item_times',  '', '', 'no' );
-               add_option( 'ljapi_usermap',          '', '', 'no' );
-               update_option( 'ljapi_comment_batch', 0 );
-
-               return true;
-       }
-
-       // Check form inputs and start importing posts
-       function step1() {
-               global $verified;
-               set_time_limit( 0 );
-               update_option( 'ljapi_step', 1 );
-               if ( !$this->ixr ) $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 );
-               if ( empty( $_POST['login'] ) ) {
-                       // We're looping -- load some details from DB
-                       $this->username = get_option( 'ljapi_username' );
-                       $this->password = get_option( 'ljapi_password' );
-                       $this->protected_password = get_option( 'ljapi_protected_password' );
-               } else {
-                       // First run (non-AJAX)
-                       $setup = $this->setup();
-                       if ( !$setup ) {
-                               return false;
-                       } else if ( is_wp_error( $setup ) ) {
-                               $this->throw_error( $setup, 1 );
-                               return false;
-                       }
-               }
-
-               echo '<div id="ljapi-status">';
-               echo '<h3>' . __( 'Importing Posts' ) . '</h3>';
-               echo '<p>' . __( 'We&#8217;re downloading and importing your LiveJournal posts...' ) . '</p>';
-               if ( get_option( 'ljapi_post_batch' ) && count( get_option( 'ljapi_sync_item_times' ) ) ) {
-                       $batch = count( get_option( 'ljapi_sync_item_times' ) );
-                       $batch = $count > 300 ? ceil( $batch / 300 ) : 1;
-                       echo '<p><strong>' . sprintf( __( 'Imported post batch %d of <strong>approximately</strong> %d' ), ( get_option( 'ljapi_post_batch' ) + 1 ), $batch ) . '</strong></p>';
-               }
-               ob_flush(); flush();
-
-               if ( !get_option( 'ljapi_lastsync' ) || '1900-01-01 00:00:00' == get_option( 'ljapi_lastsync' ) ) {
-                       // We haven't downloaded meta yet, so do that first
-                       $result = $this->download_post_meta();
-                       if ( is_wp_error( $result ) ) {
-                               $this->throw_error( $result, 1 );
-                               return false;
-                       }
-               }
-
-               // Download a batch of actual posts
-               $result = $this->download_post_bodies();
-               if ( is_wp_error( $result ) ) {
-                       if ( 406 == $this->ixr->getErrorCode() ) {
-                               ?>
-                               <p><strong><?php _e( 'Uh oh &ndash; LiveJournal has disconnected us because we made too many requests to their servers too quickly.' ) ?></strong></p>
-                               <p><strong><?php _e( 'We&#8217;ve saved where you were up to though, so if you come back to this importer in about 30 minutes, you should be able to continue from where you were.' ) ?></strong></p>
-                               <?php
-                               echo $this->next_step( 1, __( 'Try Again' ) );
-                               return false;
-                       } else {
-                               $this->throw_error( $result, 1 );
-                               return false;
-                       }
-               }
-
-               if ( get_option( 'ljapi_last_sync_count' ) > 0 ) {
-               ?>
-                       <form action="admin.php?import=livejournal" method="post" id="ljapi-auto-repost">
-                       <?php wp_nonce_field( 'lj-api-import' ) ?>
-                       <input type="hidden" name="step" id="step" value="1" />
-                       <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Import the next batch' ) ?>" /> <span id="auto-message"></span></p>
-                       </form>
-                       <?php $this->auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?>
-               <?php
-               } else {
-                       echo '<p>' . __( 'Your posts have all been imported, but wait &#8211; there&#8217;s more! Now we need to download &amp; import your comments.' ) . '</p>';
-                       echo $this->next_step( 2, __( 'Download my comments &raquo;' ) );
-                       $this->auto_submit();
-               }
-               echo '</div>';
-       }
-
-       // Download comments to local XML
-       function step2() {
-               set_time_limit( 0 );
-               update_option( 'ljapi_step', 2 );
-               $this->username = get_option( 'ljapi_username' );
-               $this->password = get_option( 'ljapi_password' );
-               $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 );
-
-               echo '<div id="ljapi-status">';
-               echo '<h3>' . __( 'Downloading Comments' ) . '</h3>';
-               echo '<p>' . __( 'Now we will download your comments so we can import them (this could take a <strong>long</strong> time if you have lots of comments)...' ) . '</p>';
-               ob_flush(); flush();
-
-               if ( !get_option( 'ljapi_usermap' ) ) {
-                       // We haven't downloaded meta yet, so do that first
-                       $result = $this->download_comment_meta();
-                       if ( is_wp_error( $result ) ) {
-                               $this->throw_error( $result, 2 );
-                               return false;
-                       }
-               }
-
-               // Download a batch of actual comments
-               $result = $this->download_comment_bodies();
-               if ( is_wp_error( $result ) ) {
-                       $this->throw_error( $result, 2 );
-                       return false;
-               }
-
-               $maxid      = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1;
-               $highest_id = (int) get_option( 'ljapi_highest_comment_id' );
-               if ( $maxid > $highest_id ) {
-                       $batch = $maxid > 5000 ? ceil( $maxid / 5000 ) : 1;
-               ?>
-                       <form action="admin.php?import=livejournal" method="post" id="ljapi-auto-repost">
-                       <p><strong><?php printf( __( 'Imported comment batch %d of <strong>approximately</strong> %d' ), get_option( 'ljapi_comment_batch' ), $batch ) ?></strong></p>
-                       <?php wp_nonce_field( 'lj-api-import' ) ?>
-                       <input type="hidden" name="step" id="step" value="2" />
-                       <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Import the next batch' ) ?>" /> <span id="auto-message"></span></p>
-                       </form>
-                       <?php $this->auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?>
-               <?php
-               } else {
-                       echo '<p>' . __( 'Your comments have all been imported now, but we still need to rebuild your conversation threads.' ) . '</p>';
-                       echo $this->next_step( 3, __( 'Rebuild my comment threads &raquo;' ) );
-                       $this->auto_submit();
-               }
-               echo '</div>';
-       }
-
-       // Re-thread comments already in the DB
-       function step3() {
-               global $wpdb;
-               set_time_limit( 0 );
-               update_option( 'ljapi_step', 3 );
-
-               echo '<div id="ljapi-status">';
-               echo '<h3>' . __( 'Threading Comments' ) . '</h3>';
-               echo '<p>' . __( 'We are now re-building the threading of your comments (this can also take a while if you have lots of comments)...' ) . '</p>';
-               ob_flush(); flush();
-
-               // Only bother adding indexes if they have over 5000 comments (arbitrary number)
-               $imported_comments = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'" );
-               $added_indices = false;
-               if ( 5000 < $imported_comments ) {
-                       include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
-                       $added_indices = true;
-                       add_clean_index( $wpdb->comments, 'comment_type'  );
-                       add_clean_index( $wpdb->comments, 'comment_karma' );
-                       add_clean_index( $wpdb->comments, 'comment_agent' );
-               }
-
-               // Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them
-               while ( $comments = $wpdb->get_results( "SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT ) ) {
-                       foreach ( $comments as $comment ) {
-                               $wpdb->update( $wpdb->comments,
-                                                               array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ),
-                                                               array( 'comment_ID' => $comment->comment_ID ) );
-                       }
-                       wp_cache_flush();
-                       $wpdb->flush();
-               }
-
-               // Revert the comments table back to normal and optimize it to reclaim space
-               if ( $added_indices ) {
-                       drop_index( $wpdb->comments, 'comment_type'  );
-                       drop_index( $wpdb->comments, 'comment_karma' );
-                       drop_index( $wpdb->comments, 'comment_agent' );
-                       $wpdb->query( "OPTIMIZE TABLE {$wpdb->comments}" );
-               }
-
-               // Clean up database and we're out
-               $this->cleanup();
-               do_action( 'import_done', 'livejournal' );
-               if ( $imported_comments > 1 )
-                       echo '<p>' . sprintf( __( "Successfully re-threaded %s comments." ), number_format( $imported_comments ) ) . '</p>';
-               echo '<h3>';
-               printf( __( 'All done. <a href="%s">Have fun!</a>' ), get_option( 'home' ) );
-               echo '</h3>';
-               echo '</div>';
-       }
-
-       // Output an error message with a button to try again.
-       function throw_error( $error, $step ) {
-               echo '<p><strong>' . $error->get_error_message() . '</strong></p>';
-               echo $this->next_step( $step, __( 'Try Again' ) );
-       }
-
-       // Returns the HTML for a link to the next page
-       function next_step( $next_step, $label, $id = 'ljapi-next-form' ) {
-               $str  = '<form action="admin.php?import=livejournal" method="post" id="' . $id . '">';
-               $str .= wp_nonce_field( 'lj-api-import', '_wpnonce', true, false );
-               $str .= wp_referer_field( false );
-               $str .= '<input type="hidden" name="step" id="step" value="' . esc_attr($next_step) . '" />';
-               $str .= '<p><input type="submit" class="button-primary" value="' . esc_attr( $label ) . '" /> <span id="auto-message"></span></p>';
-               $str .= '</form>';
-
-               return $str;
-       }
-
-       // Automatically submit the specified form after $seconds
-       // Include a friendly countdown in the element with id=$msg
-       function auto_submit( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 10 ) {
-               ?><script type="text/javascript">
-                       next_counter = <?php echo $seconds ?>;
-                       jQuery(document).ready(function(){
-                               ljapi_msg();
-                       });
-
-                       function ljapi_msg() {
-                               str = '<?php _e( "Continuing in %d" ) ?>';
-                               jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
-                               if ( next_counter <= 0 ) {
-                                       if ( jQuery( '#<?php echo $id ?>' ).length ) {
-                                               jQuery( "#<?php echo $id ?> input[type='submit']" ).hide();
-                                               str = '<?php _e( "Continuing" ) ?> <img src="images/wpspin_light.gif" alt="" id="processing" align="top" />';
-                                               jQuery( '#<?php echo $msg ?>' ).html( str );
-                                               jQuery( '#<?php echo $id ?>' ).submit();
-                                               return;
-                                       }
-                               }
-                               next_counter = next_counter - 1;
-                               setTimeout('ljapi_msg()', 1000);
-                       }
-               </script><?php
-       }
-
-       // Automatically submit the form with #id to continue the process
-       // Hide any submit buttons to avoid people clicking them
-       // Display a countdown in the element indicated by $msg for "Continuing in x"
-       function auto_ajax( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 5 ) {
-               ?><script type="text/javascript">
-                       next_counter = <?php echo $seconds ?>;
-                       jQuery(document).ready(function(){
-                               ljapi_msg();
-                       });
-
-                       function ljapi_msg() {
-                               str = '<?php _e( "Continuing in %d" ) ?>';
-                               jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
-                               if ( next_counter <= 0 ) {
-                                       if ( jQuery( '#<?php echo $id ?>' ).length ) {
-                                               jQuery( "#<?php echo $id ?> input[type='submit']" ).hide();
-                                               jQuery.ajaxSetup({'timeout':3600000});
-                                               str = '<?php _e( "Processing next batch." ) ?> <img src="images/wpspin_light.gif" alt="" id="processing" align="top" />';
-                                               jQuery( '#<?php echo $msg ?>' ).html( str );
-                                               jQuery('#ljapi-status').load(ajaxurl, {'action':'lj-importer',
-                                                                                                                               'step':jQuery('#step').val(),
-                                                                                                                               '_wpnonce':'<?php echo wp_create_nonce( 'lj-api-import' ) ?>',
-                                                                                                                               '_wp_http_referer':'<?php echo $_SERVER['REQUEST_URI'] ?>'});
-                                               return;
-                                       }
-                               }
-                               next_counter = next_counter - 1;
-                               setTimeout('ljapi_msg()', 1000);
-                       }
-               </script><?php
-       }
-
-       // Remove all options used during import process and
-       // set wp_comments entries back to "normal" values
-       function cleanup() {
-               global $wpdb;
-
-               delete_option( 'ljapi_username' );
-               delete_option( 'ljapi_password' );
-               delete_option( 'ljapi_protected_password' );
-               delete_option( 'ljapi_verified' );
-               delete_option( 'ljapi_total' );
-               delete_option( 'ljapi_count' );
-               delete_option( 'ljapi_lastsync' );
-               delete_option( 'ljapi_last_sync_count' );
-               delete_option( 'ljapi_sync_item_times' );
-               delete_option( 'ljapi_lastsync_posts' );
-               delete_option( 'ljapi_post_batch' );
-               delete_option( 'ljapi_imported_count' );
-               delete_option( 'ljapi_maxid' );
-               delete_option( 'ljapi_usermap' );
-               delete_option( 'ljapi_highest_id' );
-               delete_option( 'ljapi_highest_comment_id' );
-               delete_option( 'ljapi_comment_batch' );
-               delete_option( 'ljapi_step' );
-
-               $wpdb->update( $wpdb->comments,
-                                               array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
-                                               array( 'comment_type' => 'livejournal-done' ) );
-               $wpdb->update( $wpdb->comments,
-                                               array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
-                                               array( 'comment_type' => 'livejournal' ) );
-       }
-
-       function LJ_API_Import() {
-               $this->__construct();
-       }
-
-       function __construct() {
-               // Nothing
-       }
-}
-
-$lj_api_import = new LJ_API_Import();
-
-register_importer( 'livejournal', __( 'LiveJournal' ), __( 'Import posts from LiveJournal using their API.' ), array( $lj_api_import, 'dispatch' ) );
-?>
diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php
deleted file mode 100644 (file)
index 548e9ed..0000000
+++ /dev/null
@@ -1,514 +0,0 @@
-<?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 ();
-       var $file;
-       var $id;
-       var $mtnames = array ();
-       var $newauthornames = array ();
-       var $j = -1;
-
-       function header() {
-               echo '<div class="wrap">';
-               screen_icon();
-               echo '<h2>'.__('Import Movable Type or TypePad').'</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function greet() {
-               $this->header();
-?>
-<div class="narrow">
-<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or TypePad entries into WordPress. To begin, either choose a file to upload and click &#8220;Upload file and import&#8221;, or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>
-
-<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
-<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)); ?>" class="import-upload-form">
-
-<?php wp_nonce_field('import-upload'); ?>
-<p>
-       <input type="hidden" name="upload_type" value="ftp" />
-<?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
-<p class="submit">
-<input type="submit" class="button" value="<?php esc_attr_e('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&#8217;t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
-</div>
-<?php
-               $this->footer();
-       }
-
-       function users_form($n) {
-               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>
-       <?php
-
-
-               foreach ($users as $user) {
-                       echo '<option value="'.$user->user_login.'">'.$user->user_login.'</option>';
-               }
-?>
-       </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) {
-               //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
-                       ++ $this->j;
-                       $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 ($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($this->newauthornames[$this->j], $pass);
-                               }
-                       } else {
-                               return $user_id; // return pre-existing wp username if it exists
-                       }
-               } else {
-                       $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
-                       $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
-               }
-
-               return $user_id;
-       }
-
-       function get_mt_authors() {
-               $temp = array();
-               $authors = array();
-
-               $handle = $this->fopen($this->file, 'r');
-               if ( $handle == null )
-                       return false;
-
-               $in_comment = false;
-               while ( $line = $this->fgets($handle) ) {
-                       $line = trim($line);
-
-                       if ( 'COMMENT:' == $line )
-                               $in_comment = true;
-                       else if ( '-----' == $line )
-                               $in_comment = false;
-
-                       if ( $in_comment || 0 !== strpos($line,"AUTHOR:") )
-                               continue;
-
-                       $temp[] = trim( substr($line, strlen("AUTHOR:")) );
-               }
-
-               //we need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
-               $authors[0] = array_shift($temp);
-               $y = count($temp) + 1;
-               for ($x = 1; $x < $y; $x ++) {
-                       $next = array_shift($temp);
-                       if (!(in_array($next, $authors)))
-                               array_push($authors, "$next");
-               }
-
-               $this->fclose($handle);
-
-               return $authors;
-       }
-
-       function get_authors_from_post() {
-               $formnames = array ();
-               $selectnames = array ();
-
-               foreach ($_POST['user'] as $key => $line) {
-                       $newname = trim(stripslashes($line));
-                       if ($newname == '')
-                               $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
-                       array_push($formnames, "$newname");
-               } // $formnames is the array with the form entered names
-
-               foreach ($_POST['userselect'] as $user => $key) {
-                       $selected = trim(stripslashes($key));
-                       array_push($selectnames, "$selected");
-               }
-
-               $count = count($formnames);
-               for ($i = 0; $i < $count; $i ++) {
-                       if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form
-                               array_push($this->newauthornames, "$selectnames[$i]");
-                       } else {
-                               array_push($this->newauthornames, "$formnames[$i]");
-                       }
-               }
-       }
-
-       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&#8217;s entries.'); ?></p>
-<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <em>italics</em>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
-<p><?php _e('If a new user is created by WordPress, a password will be randomly generated. Manually change the user&#8217;s details if necessary.'); ?></p>
-       <?php
-
-
-               $authors = $this->get_mt_authors();
-               echo '<ol id="authors">';
-               echo '<form action="?import=mt&amp;step=2&amp;id=' . $this->id . '" method="post">';
-               wp_nonce_field('import-mt');
-               $j = -1;
-               foreach ($authors as $author) {
-                       ++ $j;
-                       echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'. esc_attr($author) .'" name="'.'user[]'.'" maxlength="30"> <br />');
-                       $this->users_form($j);
-                       echo '</label></li>';
-               }
-
-               echo '<p class="submit"><input type="submit" class="button" value="'.esc_attr__('Submit').'"></p>'.'<br />';
-               echo '</form>';
-               echo '</ol></div>';
-
-       }
-
-       function select_authors() {
-               if ( $_POST['upload_type'] === 'ftp' ) {
-                       $file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
-                       if ( !file_exists($file['file']) )
-                               $file['error'] = __('<code>mt-export.txt</code> does not exist');
-               } else {
-                       $file = wp_import_handle_upload();
-               }
-               if ( isset($file['error']) ) {
-                       $this->header();
-                       echo '<p>'.__('Sorry, there has been an error').'.</p>';
-                       echo '<p><strong>' . $file['error'] . '</strong></p>';
-                       $this->footer();
-                       return;
-               }
-               $this->file = $file['file'];
-               $this->id = (int) $file['id'];
-
-               $this->mt_authors_form();
-       }
-
-       function save_post(&$post, &$comments, &$pings) {
-               // Reset the counter
-               set_time_limit(30);
-               $post = get_object_vars($post);
-               $post = add_magic_quotes($post);
-               $post = (object) $post;
-
-               if ( $post_id = post_exists($post->post_title, '', $post->post_date) ) {
-                       echo '<li>';
-                       printf(__('Post <em>%s</em> already exists.'), stripslashes($post->post_title));
-               } else {
-                       echo '<li>';
-                       printf(__('Importing post <em>%s</em>...'), stripslashes($post->post_title));
-
-                       if ( '' != trim( $post->extended ) )
-                                       $post->post_content .= "\n<!--more-->\n$post->extended";
-
-                       $post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
-                       $post_id = wp_insert_post($post);
-                       if ( is_wp_error( $post_id ) )
-                               return $post_id;
-
-                       // Add categories.
-                       if ( 0 != count($post->categories) ) {
-                               wp_create_categories($post->categories, $post_id);
-                       }
-
-                        // Add tags or keywords
-                       if ( 1 < strlen($post->post_keywords) ) {
-                               // Keywords exist.
-                               printf(__('<br />Adding tags <i>%s</i>...'), stripslashes($post->post_keywords));
-                               wp_add_post_tags($post_id, $post->post_keywords);
-                       }
-               }
-
-               $num_comments = 0;
-               foreach ( $comments as $comment ) {
-                       $comment = get_object_vars($comment);
-                       $comment = add_magic_quotes($comment);
-
-                       if ( !comment_exists($comment['comment_author'], $comment['comment_date'])) {
-                               $comment['comment_post_ID'] = $post_id;
-                               $comment = wp_filter_comment($comment);
-                               wp_insert_comment($comment);
-                               $num_comments++;
-                       }
-               }
-
-               if ( $num_comments )
-                       printf(' '._n('(%s comment)', '(%s comments)', $num_comments), $num_comments);
-
-               $num_pings = 0;
-               foreach ( $pings as $ping ) {
-                       $ping = get_object_vars($ping);
-                       $ping = add_magic_quotes($ping);
-
-                       if ( !comment_exists($ping['comment_author'], $ping['comment_date'])) {
-                               $ping['comment_content'] = "<strong>{$ping['title']}</strong>\n\n{$ping['comment_content']}";
-                               $ping['comment_post_ID'] = $post_id;
-                               $ping = wp_filter_comment($ping);
-                               wp_insert_comment($ping);
-                               $num_pings++;
-                       }
-               }
-
-               if ( $num_pings )
-                       printf(' '._n('(%s ping)', '(%s pings)', $num_pings), $num_pings);
-
-               echo "</li>";
-               //ob_flush();flush();
-       }
-
-       function process_posts() {
-               global $wpdb;
-
-               $handle = $this->fopen($this->file, 'r');
-               if ( $handle == null )
-                       return false;
-
-               $context = '';
-               $post = new StdClass();
-               $comment = new StdClass();
-               $comments = array();
-               $ping = new StdClass();
-               $pings = array();
-
-               echo "<div class='wrap'><ol>";
-
-               while ( $line = $this->fgets($handle) ) {
-                       $line = trim($line);
-
-                       if ( '-----' == $line ) {
-                               // Finishing a multi-line field
-                               if ( 'comment' == $context ) {
-                                       $comments[] = $comment;
-                                       $comment = new StdClass();
-                               } else if ( 'ping' == $context ) {
-                                       $pings[] = $ping;
-                                       $ping = new StdClass();
-                               }
-                               $context = '';
-                       } else if ( '--------' == $line ) {
-                               // Finishing a post.
-                               $context = '';
-                               $result = $this->save_post($post, $comments, $pings);
-                               if ( is_wp_error( $result ) )
-                                       return $result;
-                               $post = new StdClass;
-                               $comment = new StdClass();
-                               $ping = new StdClass();
-                               $comments = array();
-                               $pings = array();
-                       } else if ( 'BODY:' == $line ) {
-                               $context = 'body';
-                       } else if ( 'EXTENDED BODY:' == $line ) {
-                               $context = 'extended';
-                       } else if ( 'EXCERPT:' == $line ) {
-                               $context = 'excerpt';
-                       } else if ( 'KEYWORDS:' == $line ) {
-                               $context = 'keywords';
-                       } else if ( 'COMMENT:' == $line ) {
-                               $context = 'comment';
-                       } else if ( 'PING:' == $line ) {
-                               $context = 'ping';
-                       } else if ( 0 === strpos($line, "AUTHOR:") ) {
-                               $author = trim( substr($line, strlen("AUTHOR:")) );
-                               if ( '' == $context )
-                                       $post->post_author = $author;
-                               else if ( 'comment' == $context )
-                                        $comment->comment_author = $author;
-                       } else if ( 0 === strpos($line, "TITLE:") ) {
-                               $title = trim( substr($line, strlen("TITLE:")) );
-                               if ( '' == $context )
-                                       $post->post_title = $title;
-                               else if ( 'ping' == $context )
-                                       $ping->title = $title;
-                       } else if ( 0 === strpos($line, "STATUS:") ) {
-                               $status = trim( strtolower( substr($line, strlen("STATUS:")) ) );
-                               if ( empty($status) )
-                                       $status = 'publish';
-                               $post->post_status = $status;
-                       } else if ( 0 === strpos($line, "ALLOW COMMENTS:") ) {
-                               $allow = trim( substr($line, strlen("ALLOW COMMENTS:")) );
-                               if ( $allow == 1 )
-                                       $post->comment_status = 'open';
-                               else
-                                       $post->comment_status = 'closed';
-                       } else if ( 0 === strpos($line, "ALLOW PINGS:") ) {
-                               $allow = trim( substr($line, strlen("ALLOW PINGS:")) );
-                               if ( $allow == 1 )
-                                       $post->ping_status = 'open';
-                               else
-                                       $post->ping_status = 'closed';
-                       } else if ( 0 === strpos($line, "CATEGORY:") ) {
-                               $category = trim( substr($line, strlen("CATEGORY:")) );
-                               if ( '' != $category )
-                                       $post->categories[] = $category;
-                       } else if ( 0 === strpos($line, "PRIMARY CATEGORY:") ) {
-                               $category = trim( substr($line, strlen("PRIMARY CATEGORY:")) );
-                               if ( '' != $category )
-                                       $post->categories[] = $category;
-                       } else if ( 0 === strpos($line, "DATE:") ) {
-                               $date = trim( substr($line, strlen("DATE:")) );
-                               $date = strtotime($date);
-                               $date = date('Y-m-d H:i:s', $date);
-                               $date_gmt = get_gmt_from_date($date);
-                               if ( '' == $context ) {
-                                       $post->post_modified = $date;
-                                       $post->post_modified_gmt = $date_gmt;
-                                       $post->post_date = $date;
-                                       $post->post_date_gmt = $date_gmt;
-                               } else if ( 'comment' == $context ) {
-                                       $comment->comment_date = $date;
-                               } else if ( 'ping' == $context ) {
-                                       $ping->comment_date = $date;
-                               }
-                       } else if ( 0 === strpos($line, "EMAIL:") ) {
-                               $email = trim( substr($line, strlen("EMAIL:")) );
-                               if ( 'comment' == $context )
-                                       $comment->comment_author_email = $email;
-                               else
-                                       $ping->comment_author_email = '';
-                       } else if ( 0 === strpos($line, "IP:") ) {
-                               $ip = trim( substr($line, strlen("IP:")) );
-                               if ( 'comment' == $context )
-                                       $comment->comment_author_IP = $ip;
-                               else
-                                       $ping->comment_author_IP = $ip;
-                       } else if ( 0 === strpos($line, "URL:") ) {
-                               $url = trim( substr($line, strlen("URL:")) );
-                               if ( 'comment' == $context )
-                                       $comment->comment_author_url = $url;
-                               else
-                                       $ping->comment_author_url = $url;
-                       } else if ( 0 === strpos($line, "BLOG NAME:") ) {
-                               $blog = trim( substr($line, strlen("BLOG NAME:")) );
-                               $ping->comment_author = $blog;
-                       } else {
-                               // Processing multi-line field, check context.
-
-                               if( !empty($line) )
-                                       $line .= "\n";
-
-                               if ( 'body' == $context ) {
-                                       $post->post_content .= $line;
-                               } else if ( 'extended' ==  $context ) {
-                                       $post->extended .= $line;
-                               } else if ( 'excerpt' == $context ) {
-                                       $post->post_excerpt .= $line;
-                               } else if ( 'keywords' == $context ) {
-                                       $post->post_keywords .= $line;
-                               } else if ( 'comment' == $context ) {
-                                       $comment->comment_content .= $line;
-                               } else if ( 'ping' == $context ) {
-                                       $ping->comment_content .= $line;
-                               }
-                       }
-               }
-
-               $this->fclose($handle);
-
-               echo '</ol>';
-
-               wp_import_cleanup($this->id);
-               do_action('import_done', 'mt');
-
-               echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3></div>';
-       }
-
-       function import() {
-               $this->id = (int) $_GET['id'];
-               if ( $this->id == 0 )
-                       $this->file = WP_CONTENT_DIR . '/mt-export.txt';
-               else
-                       $this->file = get_attached_file($this->id);
-               $this->get_authors_from_post();
-               $result = $this->process_posts();
-               if ( is_wp_error( $result ) )
-                       return $result;
-       }
-
-       function dispatch() {
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-
-               switch ($step) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               check_admin_referer('import-upload');
-                               $this->select_authors();
-                               break;
-                       case 2:
-                               check_admin_referer('import-mt');
-                               $result = $this->import();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-               }
-       }
-
-       function MT_Import() {
-               // Nothing.
-       }
-}
-
-$mt_import = new MT_Import();
-
-register_importer('mt', __('Movable Type and TypePad'), __('Import posts and comments from a Movable Type or TypePad blog.'), array ($mt_import, 'dispatch'));
-?>
diff --git a/wp-admin/import/opml.php b/wp-admin/import/opml.php
deleted file mode 100644 (file)
index 7f2e1dc..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?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');
-
-class OPML_Import {
-
-       function dispatch() {
-               global $wpdb, $user_ID;
-$step = $_POST['step'];
-if (!$step) $step = 0;
-?>
-<?php
-switch ($step) {
-       case 0: {
-               include_once('admin-header.php');
-               if ( !current_user_can('manage_links') )
-                       wp_die(__('Cheatin&#8217; uh?'));
-
-               $opmltype = 'blogrolling'; // default.
-?>
-
-<div class="wrap">
-<?php screen_icon(); ?>
-<h2><?php _e('Import your blogroll from another system') ?> </h2>
-<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>
-<div style="width: 70%; margin: auto; height: 8em;">
-<input type="hidden" name="step" value="1" />
-<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
-<div style="width: 48%;" class="alignleft">
-<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
-<input type="text" name="opml_url" id="opml_url" size="50" class="code" style="width: 90%;" value="http://" />
-</div>
-
-<div style="width: 48%;" class="alignleft">
-<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
-<input id="userfile" name="userfile" type="file" size="30" />
-</div>
-
-</div>
-
-<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
-<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
-<?php
-$categories = get_terms('link_category', 'get=all');
-foreach ($categories as $category) {
-?>
-<option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option>
-<?php
-} // end foreach
-?>
-</select></p>
-
-<p class="submit"><input type="submit" name="submit" value="<?php esc_attr_e('Import OPML File') ?>" /></p>
-</form>
-
-</div>
-<?php
-               break;
-       } // end case 0
-
-       case 1: {
-               check_admin_referer('import-bookmarks');
-
-               include_once('admin-header.php');
-               if ( !current_user_can('manage_links') )
-                       wp_die(__('Cheatin&#8217; uh?'));
-?>
-<div class="wrap">
-
-<h2><?php _e('Importing...') ?></h2>
-<?php
-               $cat_id = abs( (int) $_POST['cat_id'] );
-               if ( $cat_id < 1 )
-                       $cat_id  = 1;
-
-               $opml_url = $_POST['opml_url'];
-               if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
-                       $blogrolling = true;
-               } else { // try to get the upload file.
-                       $overrides = array('test_form' => false, 'test_type' => false);
-                       $_FILES['userfile']['name'] .= '.txt';
-                       $file = wp_handle_upload($_FILES['userfile'], $overrides);
-
-                       if ( isset($file['error']) )
-                               wp_die($file['error']);
-
-                       $url = $file['url'];
-                       $opml_url = $file['file'];
-                       $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);
-                       } else {
-                               $opml = file_get_contents($opml_url);
-                       }
-
-                       /** Load OPML Parser */
-                       include_once('link-parse-opml.php');
-
-                       $link_count = count($names);
-                       for ( $i = 0; $i < $link_count; $i++ ) {
-                               if ('Last' == substr($titles[$i], 0, 4))
-                                       $titles[$i] = '';
-                               if ( 'http' == substr($titles[$i], 0, 4) )
-                                       $titles[$i] = '';
-                               $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
-                               wp_insert_link($link);
-                               echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
-                       }
-?>
-
-<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
-
-<?php
-} // end if got url
-else
-{
-       echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
-} // end else
-
-if ( ! $blogrolling )
-       do_action( 'wp_delete_file', $opml_url);
-       @unlink($opml_url);
-?>
-</div>
-<?php
-               break;
-       } // end case 1
-} // end switch
-       }
-
-       function OPML_Import() {}
-}
-
-$opml_importer = new OPML_Import();
-
-register_importer('opml', __('Blogroll'), __('Import links in OPML format.'), array(&$opml_importer, 'dispatch'));
-
-?>
diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php
deleted file mode 100644 (file)
index 0e0928c..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-<?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 ();
-       var $file;
-
-       function header() {
-               echo '<div class="wrap">';
-               screen_icon();
-               echo '<h2>'.__('Import RSS').'</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function unhtmlentities($string) { // From php.net for < 4.3 compat
-               $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-               $trans_tbl = array_flip($trans_tbl);
-               return strtr($string, $trans_tbl);
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! This importer allows you to extract posts from an RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
-               wp_import_upload_form("admin.php?import=rss&amp;step=1");
-               echo '</div>';
-       }
-
-       function _normalize_tag( $matches ) {
-               return '<' . strtolower( $matches[1] );
-       }
-
-       function get_posts() {
-               global $wpdb;
-
-               set_magic_quotes_runtime(0);
-               $datalines = file($this->file); // Read the file into an array
-               $importdata = implode('', $datalines); // squish it
-               $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);
-
-               preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts);
-               $this->posts = $this->posts[1];
-               $index = 0;
-               foreach ($this->posts as $post) {
-                       preg_match('|<title>(.*?)</title>|is', $post, $post_title);
-                       $post_title = str_replace(array('<![CDATA[', ']]>'), '', $wpdb->escape( trim($post_title[1]) ));
-
-                       preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date_gmt);
-
-                       if ($post_date_gmt) {
-                               $post_date_gmt = strtotime($post_date_gmt[1]);
-                       } else {
-                               // if we don't already have something from pubDate
-                               preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date_gmt);
-                               $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]);
-                               $post_date_gmt = str_replace('T', ' ', $post_date_gmt);
-                               $post_date_gmt = strtotime($post_date_gmt);
-                       }
-
-                       $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
-                       $post_date = get_date_from_gmt( $post_date_gmt );
-
-                       preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
-                       $categories = $categories[1];
-
-                       if (!$categories) {
-                               preg_match_all('|<dc:subject>(.*?)</dc:subject>|is', $post, $categories);
-                               $categories = $categories[1];
-                       }
-
-                       $cat_index = 0;
-                       foreach ($categories as $category) {
-                               $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
-                               $cat_index++;
-                       }
-
-                       preg_match('|<guid.*?>(.*?)</guid>|is', $post, $guid);
-                       if ($guid)
-                               $guid = $wpdb->escape(trim($guid[1]));
-                       else
-                               $guid = '';
-
-                       preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $post_content);
-                       $post_content = str_replace(array ('<![CDATA[', ']]>'), '', $wpdb->escape(trim($post_content[1])));
-
-                       if (!$post_content) {
-                               // This is for feeds that put content in description
-                               preg_match('|<description>(.*?)</description>|is', $post, $post_content);
-                               $post_content = $wpdb->escape($this->unhtmlentities(trim($post_content[1])));
-                       }
-
-                       // Clean up content
-                       $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
-                       $post_content = str_replace('<br>', '<br />', $post_content);
-                       $post_content = str_replace('<hr>', '<hr />', $post_content);
-
-                       $post_author = 1;
-                       $post_status = 'publish';
-                       $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
-                       $index++;
-               }
-       }
-
-       function import_posts() {
-               echo '<ol>';
-
-               foreach ($this->posts as $post) {
-                       echo "<li>".__('Importing post...');
-
-                       extract($post);
-
-                       if ($post_id = post_exists($post_title, $post_content, $post_date)) {
-                               _e('Post already imported');
-                       } else {
-                               $post_id = wp_insert_post($post);
-                               if ( is_wp_error( $post_id ) )
-                                       return $post_id;
-                               if (!$post_id) {
-                                       _e('Couldn&#8217;t get post ID');
-                                       return;
-                               }
-
-                               if (0 != count($categories))
-                                       wp_create_categories($categories, $post_id);
-                               _e('Done !');
-                       }
-                       echo '</li>';
-               }
-
-               echo '</ol>';
-
-       }
-
-       function import() {
-               $file = wp_import_handle_upload();
-               if ( isset($file['error']) ) {
-                       echo $file['error'];
-                       return;
-               }
-
-               $this->file = $file['file'];
-               $this->get_posts();
-               $result = $this->import_posts();
-               if ( is_wp_error( $result ) )
-                       return $result;
-               wp_import_cleanup($file['id']);
-               do_action('import_done', 'rss');
-
-               echo '<h3>';
-               printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
-               echo '</h3>';
-       }
-
-       function dispatch() {
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-
-               $this->header();
-
-               switch ($step) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               check_admin_referer('import-upload');
-                               $result = $this->import();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-               }
-
-               $this->footer();
-       }
-
-       function RSS_Import() {
-               // Nothing.
-       }
-}
-
-$rss_import = new RSS_Import();
-
-register_importer('rss', __('RSS'), __('Import posts from an RSS feed.'), array ($rss_import, 'dispatch'));
-?>
diff --git a/wp-admin/import/stp.php b/wp-admin/import/stp.php
deleted file mode 100644 (file)
index 4568428..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?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">';
-               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>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! This imports tags from Simple Tagging 1.6.2 into WordPress tags.').'</p>';
-               echo '<p>'.__('This has not been tested on any other versions of Simple Tagging. Mileage may vary.').'</p>';
-               echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 4-step program to help you kick that nasty Simple Tagging 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=stp&amp;step=1" method="post">';
-               wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 1').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-       function dispatch () {
-               if ( empty( $_GET['step'] ) ) {
-                       $step = 0;
-               } else {
-                       $step = (int) $_GET['step'];
-               }
-               // load the header
-               $this->header();
-               switch ( $step ) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               check_admin_referer('import-stp');
-                               $this->import_posts();
-                               break;
-                       case 2:
-                               check_admin_referer('import-stp');
-                               $this->import_t2p();
-                               break;
-                       case 3:
-                               check_admin_referer('import-stp');
-                               $this->cleanup_import();
-                               break;
-               }
-               // load the footer
-               $this->footer();
-       }
-
-
-       function import_posts ( ) {
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Reading STP Post Tags&#8230;').'</h3></p>';
-
-               // read in all the STP tag -> post settings
-               $posts = $this->get_stp_posts();
-
-               // if we didn't get any tags back, that's all there is folks!
-               if ( !is_array($posts) ) {
-                       echo '<p>' . __('No posts were found to have tags!') . '</p>';
-                       return false;
-               }
-               else {
-                       // if there's an existing entry, delete it
-                       if ( get_option('stpimp_posts') ) {
-                               delete_option('stpimp_posts');
-                       }
-
-                       add_option('stpimp_posts', $posts);
-                       $count = count($posts);
-                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
-               }
-
-               echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
-               wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 2').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-
-       function import_t2p ( ) {
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
-
-               // run that funky magic!
-               $tags_added = $this->tag2post();
-
-               echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag was added!', 'Done! <strong>%s</strong> tags were added!', $tags_added), $tags_added ) . '<br /></p>';
-               echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
-               wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 3').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-       function get_stp_posts ( ) {
-               global $wpdb;
-               // read in all the posts from the STP post->tag table: should be wp_post2tag
-               $posts_query = "SELECT post_id, tag_name FROM " . $wpdb->prefix . "stp_tags";
-               $posts = $wpdb->get_results($posts_query);
-               return $posts;
-       }
-
-       function tag2post ( ) {
-               global $wpdb;
-
-               // get the tags and posts we imported in the last 2 steps
-               $posts = get_option('stpimp_posts');
-
-               // null out our results
-               $tags_added = 0;
-
-               // loop through each post and add its tags to the db
-               foreach ( $posts as $this_post ) {
-                       $the_post = (int) $this_post->post_id;
-                       $the_tag = $wpdb->escape($this_post->tag_name);
-                       // try to add the tag
-                       wp_add_post_tags($the_post, $the_tag);
-                       $tags_added++;
-               }
-
-               // that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
-               return $tags_added;
-       }
-
-       function cleanup_import ( ) {
-               delete_option('stpimp_posts');
-               $this->done();
-       }
-
-       function done ( ) {
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Import Complete!').'</h3></p>';
-               echo '<p>' . __('OK, so we lied about this being a 4-step program! You&#8217;re done!') . '</p>';
-               echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';
-               echo '</div>';
-       }
-
-       function STP_Import ( ) {
-               // Nothing.
-       }
-}
-
-// create the import object
-$stp_import = new STP_Import();
-
-// add it to the import page!
-register_importer('stp', 'Simple Tagging', __('Import Simple Tagging tags into WordPress tags.'), array($stp_import, 'dispatch'));
-?>
diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php
deleted file mode 100644 (file)
index fb47213..0000000
+++ /dev/null
@@ -1,691 +0,0 @@
-<?php
-/**
- * TextPattern Importer
- *
- * @package WordPress
- * @subpackage Importer
- */
-
-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;
-               return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
-       }
-}
-
-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;
-               return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
-       }
-}
-
-/**
- * TextPattern Importer Class
- *
- * @since unknown
- */
-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>';
-       }
-
-       function footer()
-       {
-               echo '</div>';
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! This imports categories, users, posts, comments, and links from any Textpattern 4.0.2+ into this blog.').'</p>';
-               echo '<p>'.__('This has not been tested on previous versions of Textpattern.  Mileage may vary.').'</p>';
-               echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
-               echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
-               wp_nonce_field('import-textpattern');
-               $this->db_form();
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-       function get_txp_cats()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
-               set_magic_quotes_runtime(0);
-               $prefix = get_option('tpre');
-
-               // Get Categories
-               return $txpdb->get_results('SELECT
-                       id,
-                       name,
-                       title
-                       FROM '.$prefix.'txp_category
-                       WHERE type = "article"',
-                       ARRAY_A);
-       }
-
-       function get_txp_users()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
-               set_magic_quotes_runtime(0);
-               $prefix = get_option('tpre');
-
-               // Get Users
-
-               return $txpdb->get_results('SELECT
-                       user_id,
-                       name,
-                       RealName,
-                       email,
-                       privs
-                       FROM '.$prefix.'txp_users', ARRAY_A);
-       }
-
-       function get_txp_posts()
-       {
-               // General Housekeeping
-               $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
-               set_magic_quotes_runtime(0);
-               $prefix = get_option('tpre');
-
-               // Get Posts
-               return $txpdb->get_results('SELECT
-                       ID,
-                       Posted,
-                       AuthorID,
-                       LastMod,
-                       Title,
-                       Body,
-                       Excerpt,
-                       Category1,
-                       Category2,
-                       Status,
-                       Keywords,
-                       url_title,
-                       comments_count
-                       FROM '.$prefix.'textpattern
-                       ', ARRAY_A);
-       }
-
-       function get_txp_comments()
-       {
-               global $wpdb;
-               // General Housekeeping
-               $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
-               set_magic_quotes_runtime(0);
-               $prefix = get_option('tpre');
-
-               // Get Comments
-               return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
-       }
-
-               function get_txp_links()
-       {
-               //General Housekeeping
-               $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
-               set_magic_quotes_runtime(0);
-               $prefix = get_option('tpre');
-
-               return $txpdb->get_results('SELECT
-                       id,
-                       date,
-                       category,
-                       url,
-                       linkname,
-                       description
-                       FROM '.$prefix.'txp_link',
-                       ARRAY_A);
-       }
-
-       function cat2wp($categories='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $txpcat2wpcat = array();
-               // Do the Magic
-               if(is_array($categories))
-               {
-                       echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
-                       foreach ($categories as $category)
-                       {
-                               $count++;
-                               extract($category);
-
-
-                               // Make Nice Variables
-                               $name = $wpdb->escape($name);
-                               $title = $wpdb->escape($title);
-
-                               if($cinfo = category_exists($name))
-                               {
-                                       $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title));
-                               }
-                               $txpcat2wpcat[$id] = $ret_id;
-                       }
-
-                       // Store category translation for future use
-                       add_option('txpcat2wpcat',$txpcat2wpcat);
-                       echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Categories to Import!');
-               return false;
-       }
-
-       function users2wp($users='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $txpid2wpid = array();
-
-               // Midnight Mojo
-               if(is_array($users))
-               {
-                       echo '<p>'.__('Importing Users...').'<br /><br /></p>';
-                       foreach($users as $user)
-                       {
-                               $count++;
-                               extract($user);
-
-                               // Make Nice Variables
-                               $name = $wpdb->escape($name);
-                               $RealName = $wpdb->escape($RealName);
-
-                               if($uinfo = get_userdatabylogin($name))
-                               {
-
-                                       $ret_id = wp_insert_user(array(
-                                                               'ID'                    => $uinfo->ID,
-                                                               'user_login'    => $name,
-                                                               'user_nicename' => $RealName,
-                                                               'user_email'    => $email,
-                                                               'user_url'              => 'http://',
-                                                               'display_name'  => $name)
-                                                               );
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_user(array(
-                                                               'user_login'    => $name,
-                                                               'user_nicename' => $RealName,
-                                                               'user_email'    => $email,
-                                                               'user_url'              => 'http://',
-                                                               'display_name'  => $name)
-                                                               );
-                               }
-                               $txpid2wpid[$user_id] = $ret_id;
-
-                               // Set Textpattern-to-WordPress permissions translation
-                               $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
-
-                               // Update Usermeta Data
-                               $user = new WP_User($ret_id);
-                               if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
-                               if('9'  == $transperms[$privs]) { $user->set_role('editor'); }
-                               if('5'  == $transperms[$privs]) { $user->set_role('editor'); }
-                               if('4'  == $transperms[$privs]) { $user->set_role('author'); }
-                               if('3'  == $transperms[$privs]) { $user->set_role('contributor'); }
-                               if('2'  == $transperms[$privs]) { $user->set_role('contributor'); }
-                               if('0'  == $transperms[$privs]) { $user->set_role('subscriber'); }
-
-                               update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
-                               update_usermeta( $ret_id, 'rich_editing', 'false');
-                       }// End foreach($users as $user)
-
-                       // Store id translation array for future use
-                       add_option('txpid2wpid',$txpid2wpid);
-
-
-                       echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
-                       return true;
-               }// End if(is_array($users)
-
-               echo __('No Users to Import!');
-               return false;
-
-       }// End function user2wp()
-
-       function posts2wp($posts='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $txpposts2wpposts = array();
-               $cats = array();
-
-               // Do the Magic
-               if(is_array($posts))
-               {
-                       echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
-                       foreach($posts as $post)
-                       {
-                               $count++;
-                               extract($post);
-
-                               // Set Textpattern-to-WordPress status translation
-                               $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
-
-                               //Can we do this more efficiently?
-                               $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
-                               $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
-
-                               $Title = $wpdb->escape($Title);
-                               $Body = $wpdb->escape($Body);
-                               $Excerpt = $wpdb->escape($Excerpt);
-                               $post_status = $stattrans[$Status];
-
-                               // Import Post data into WordPress
-
-                               if($pinfo = post_exists($Title,$Body))
-                               {
-                                       $ret_id = wp_insert_post(array(
-                                               'ID'                            => $pinfo,
-                                               'post_date'                     => $Posted,
-                                               'post_date_gmt'         => $post_date_gmt,
-                                               'post_author'           => $authorid,
-                                               'post_modified'         => $LastMod,
-                                               'post_modified_gmt' => $post_modified_gmt,
-                                               'post_title'            => $Title,
-                                               'post_content'          => $Body,
-                                               'post_excerpt'          => $Excerpt,
-                                               'post_status'           => $post_status,
-                                               'post_name'                     => $url_title,
-                                               'comment_count'         => $comments_count)
-                                               );
-                                       if ( is_wp_error( $ret_id ) )
-                                               return $ret_id;
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_post(array(
-                                               'post_date'                     => $Posted,
-                                               'post_date_gmt'         => $post_date_gmt,
-                                               'post_author'           => $authorid,
-                                               'post_modified'         => $LastMod,
-                                               'post_modified_gmt' => $post_modified_gmt,
-                                               'post_title'            => $Title,
-                                               'post_content'          => $Body,
-                                               'post_excerpt'          => $Excerpt,
-                                               'post_status'           => $post_status,
-                                               'post_name'                     => $url_title,
-                                               'comment_count'         => $comments_count)
-                                               );
-                                       if ( is_wp_error( $ret_id ) )
-                                               return $ret_id;
-                               }
-                               $txpposts2wpposts[$ID] = $ret_id;
-
-                               // Make Post-to-Category associations
-                               $cats = array();
-                               $category1 = get_category_by_slug($Category1);
-                               $category1 = $category1->term_id;
-                               $category2 = get_category_by_slug($Category2);
-                               $category2 = $category2->term_id;
-                               if($cat1 = $category1) { $cats[1] = $cat1; }
-                               if($cat2 = $category2) { $cats[2] = $cat2; }
-
-                               if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
-                       }
-               }
-               // Store ID translation for later use
-               add_option('txpposts2wpposts',$txpposts2wpposts);
-
-               echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
-               return true;
-       }
-
-       function comments2wp($comments='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-               $txpcm2wpcm = array();
-               $postarr = get_option('txpposts2wpposts');
-
-               // Magic Mojo
-               if(is_array($comments))
-               {
-                       echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
-                       foreach($comments as $comment)
-                       {
-                               $count++;
-                               extract($comment);
-
-                               // WordPressify Data
-                               $comment_ID = ltrim($discussid, '0');
-                               $comment_post_ID = $postarr[$parentid];
-                               $comment_approved = (1 == $visible) ? 1 : 0;
-                               $name = $wpdb->escape($name);
-                               $email = $wpdb->escape($email);
-                               $web = $wpdb->escape($web);
-                               $message = $wpdb->escape($message);
-
-                               $comment = array(
-                                                       'comment_post_ID'       => $comment_post_ID,
-                                                       'comment_author'        => $name,
-                                                       'comment_author_IP'     => $ip,
-                                                       'comment_author_email'  => $email,
-                                                       'comment_author_url'    => $web,
-                                                       'comment_date'          => $posted,
-                                                       'comment_content'       => $message,
-                                                       'comment_approved'      => $comment_approved);
-                               $comment = wp_filter_comment($comment);
-
-                               if ( $cinfo = comment_exists($name, $posted) ) {
-                                       // Update comments
-                                       $comment['comment_ID'] = $cinfo;
-                                       $ret_id = wp_update_comment($comment);
-                               } else {
-                                       // Insert comments
-                                       $ret_id = wp_insert_comment($comment);
-                               }
-                               $txpcm2wpcm[$comment_ID] = $ret_id;
-                       }
-                       // Store Comment ID translation for future use
-                       add_option('txpcm2wpcm', $txpcm2wpcm);
-
-                       // Associate newly formed categories with posts
-                       get_comment_count($ret_id);
-
-
-                       echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Comments to Import!');
-               return false;
-       }
-
-       function links2wp($links='')
-       {
-               // General Housekeeping
-               global $wpdb;
-               $count = 0;
-
-               // Deal with the links
-               if(is_array($links))
-               {
-                       echo '<p>'.__('Importing Links...').'<br /><br /></p>';
-                       foreach($links as $link)
-                       {
-                               $count++;
-                               extract($link);
-
-                               // Make nice vars
-                               $category = $wpdb->escape($category);
-                               $linkname = $wpdb->escape($linkname);
-                               $description = $wpdb->escape($description);
-
-                               if($linfo = link_exists($linkname))
-                               {
-                                       $ret_id = wp_insert_link(array(
-                                                               'link_id'                       => $linfo,
-                                                               'link_url'                      => $url,
-                                                               'link_name'                     => $linkname,
-                                                               'link_category'         => $category,
-                                                               'link_description'      => $description,
-                                                               'link_updated'          => $date)
-                                                               );
-                               }
-                               else
-                               {
-                                       $ret_id = wp_insert_link(array(
-                                                               'link_url'                      => $url,
-                                                               'link_name'                     => $linkname,
-                                                               'link_category'         => $category,
-                                                               'link_description'      => $description,
-                                                               'link_updated'          => $date)
-                                                               );
-                               }
-                               $txplinks2wplinks[$link_id] = $ret_id;
-                       }
-                       add_option('txplinks2wplinks',$txplinks2wplinks);
-                       echo '<p>';
-                       printf(_n('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
-                       echo '<br /><br /></p>';
-                       return true;
-               }
-               echo __('No Links to Import!');
-               return false;
-       }
-
-       function import_categories()
-       {
-               // Category Import
-               $cats = $this->get_txp_cats();
-               $this->cat2wp($cats);
-               add_option('txp_cats', $cats);
-
-
-
-               echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
-               wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
-               echo '</form>';
-
-       }
-
-       function import_users()
-       {
-               // User Import
-               $users = $this->get_txp_users();
-               $this->users2wp($users);
-
-               echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
-               wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
-               echo '</form>';
-       }
-
-       function import_posts()
-       {
-               // Post Import
-               $posts = $this->get_txp_posts();
-               $result = $this->posts2wp($posts);
-               if ( is_wp_error( $result ) )
-                       return $result;
-
-               echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
-               wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
-               echo '</form>';
-       }
-
-       function import_comments()
-       {
-               // Comment Import
-               $comments = $this->get_txp_comments();
-               $this->comments2wp($comments);
-
-               echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
-               wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
-               echo '</form>';
-       }
-
-       function import_links()
-       {
-               //Link Import
-               $links = $this->get_txp_links();
-               $this->links2wp($links);
-               add_option('txp_links', $links);
-
-               echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
-               wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
-               echo '</form>';
-       }
-
-       function cleanup_txpimport()
-       {
-               delete_option('tpre');
-               delete_option('txp_cats');
-               delete_option('txpid2wpid');
-               delete_option('txpcat2wpcat');
-               delete_option('txpposts2wpposts');
-               delete_option('txpcm2wpcm');
-               delete_option('txplinks2wplinks');
-               delete_option('txpuser');
-               delete_option('txppass');
-               delete_option('txpname');
-               delete_option('txphost');
-               do_action('import_done', 'textpattern');
-               $this->tips();
-       }
-
-       function tips()
-       {
-               echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Textpattern, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
-               echo '<h3>'.__('Users').'</h3>';
-               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;t have that login in Textpattern, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">log in</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
-               echo '<h3>'.__('Preserving Authors').'</h3>';
-               echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
-               echo '<h3>'.__('Textile').'</h3>';
-               echo '<p>'.__('Also, since you&#8217;re coming from Textpattern, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You&#8217;ll want it.').'</p>';
-               echo '<h3>'.__('WordPress Resources').'</h3>';
-               echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
-               echo '<ul>';
-               echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
-               echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
-               echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
-               echo '</ul>';
-               echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">log in</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
-       }
-
-       function db_form()
-       {
-               echo '<table class="form-table">';
-               printf('<tr><th scope="row"><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('Textpattern Database User:'));
-               printf('<tr><th scope="row"><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('Textpattern Database Password:'));
-               printf('<tr><th scope="row"><label for="dbname">%s</label></th><td><input type="text" id="dbname" name="dbname" /></td></tr>', __('Textpattern Database Name:'));
-               printf('<tr><th scope="row"><label for="dbhost">%s</label></th><td><input type="text" id="dbhost" name="dbhost" value="localhost" /></td></tr>', __('Textpattern Database Host:'));
-               printf('<tr><th scope="row"><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix"  /></td></tr>', __('Textpattern Table prefix (if any):'));
-               echo '</table>';
-       }
-
-       function dispatch()
-       {
-
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-               $this->header();
-
-               if ( $step > 0 )
-               {
-                       check_admin_referer('import-textpattern');
-
-                       if($_POST['dbuser'])
-                       {
-                               if(get_option('txpuser'))
-                                       delete_option('txpuser');
-                               add_option('txpuser', sanitize_user($_POST['dbuser'], true));
-                       }
-                       if($_POST['dbpass'])
-                       {
-                               if(get_option('txppass'))
-                                       delete_option('txppass');
-                               add_option('txppass',  sanitize_user($_POST['dbpass'], true));
-                       }
-
-                       if($_POST['dbname'])
-                       {
-                               if(get_option('txpname'))
-                                       delete_option('txpname');
-                               add_option('txpname',  sanitize_user($_POST['dbname'], true));
-                       }
-                       if($_POST['dbhost'])
-                       {
-                               if(get_option('txphost'))
-                                       delete_option('txphost');
-                               add_option('txphost',  sanitize_user($_POST['dbhost'], true));
-                       }
-                       if($_POST['dbprefix'])
-                       {
-                               if(get_option('tpre'))
-                                       delete_option('tpre');
-                               add_option('tpre',  sanitize_user($_POST['dbprefix']));
-                       }
-
-
-               }
-
-               switch ($step)
-               {
-                       default:
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               $this->import_categories();
-                               break;
-                       case 2 :
-                               $this->import_users();
-                               break;
-                       case 3 :
-                               $result = $this->import_posts();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-                       case 4 :
-                               $this->import_comments();
-                               break;
-                       case 5 :
-                               $this->import_links();
-                               break;
-                       case 6 :
-                               $this->cleanup_txpimport();
-                               break;
-               }
-
-               $this->footer();
-       }
-
-       function Textpattern_Import()
-       {
-               // Nothing.
-       }
-}
-
-$txp_import = new Textpattern_Import();
-
-register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));
-
-?>
diff --git a/wp-admin/import/utw.php b/wp-admin/import/utw.php
deleted file mode 100644 (file)
index 3add5b6..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-<?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">';
-               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>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! This imports tags from Ultimate Tag Warrior 3 into WordPress tags.').'</p>';
-               echo '<p>'.__('This has not been tested on any other versions of Ultimate Tag Warrior. Mileage may vary.').'</p>';
-               echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
-               echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
-               echo '<form action="admin.php?import=utw&amp;step=1" method="post">';
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 1').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-
-       function dispatch () {
-               if ( empty( $_GET['step'] ) ) {
-                       $step = 0;
-               } else {
-                       $step = (int) $_GET['step'];
-               }
-
-               if ( $step > 1 )
-                       check_admin_referer('import-utw');
-
-               // load the header
-               $this->header();
-
-               switch ( $step ) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               $this->import_tags();
-                               break;
-                       case 2 :
-                               $this->import_posts();
-                               break;
-                       case 3:
-                               $this->import_t2p();
-                               break;
-                       case 4:
-                               $this->cleanup_import();
-                               break;
-               }
-
-               // load the footer
-               $this->footer();
-       }
-
-
-       function import_tags ( ) {
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Reading UTW Tags&#8230;').'</h3></p>';
-
-               $tags = $this->get_utw_tags();
-
-               // if we didn't get any tags back, that's all there is folks!
-               if ( !is_array($tags) ) {
-                       echo '<p>' . __('No Tags Found!') . '</p>';
-                       return false;
-               }
-               else {
-
-                       // if there's an existing entry, delete it
-                       if ( get_option('utwimp_tags') ) {
-                               delete_option('utwimp_tags');
-                       }
-
-                       add_option('utwimp_tags', $tags);
-
-
-                       $count = count($tags);
-
-                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
-                       echo '<p>' . __('The following tags were found:') . '</p>';
-
-                       echo '<ul>';
-
-                       foreach ( $tags as $tag_id => $tag_name ) {
-
-                               echo '<li>' . $tag_name . '</li>';
-
-                       }
-
-                       echo '</ul>';
-
-                       echo '<br />';
-
-                       echo '<p>' . __('If you don&#8217;t want to import any of these tags, you should delete them from the UTW tag management page and then re-run this import.') . '</p>';
-
-
-               }
-
-               echo '<form action="admin.php?import=utw&amp;step=2" method="post">';
-               wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 2').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-       }
-
-
-       function import_posts ( ) {
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Reading UTW Post Tags&#8230;').'</h3></p>';
-
-               // read in all the UTW tag -> post settings
-               $posts = $this->get_utw_posts();
-
-               // if we didn't get any tags back, that's all there is folks!
-               if ( !is_array($posts) ) {
-                       echo '<p>' . __('No posts were found to have tags!') . '</p>';
-                       return false;
-               }
-               else {
-
-                       // if there's an existing entry, delete it
-                       if ( get_option('utwimp_posts') ) {
-                               delete_option('utwimp_posts');
-                       }
-
-                       add_option('utwimp_posts', $posts);
-
-
-                       $count = count($posts);
-
-                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
-
-               }
-
-               echo '<form action="admin.php?import=utw&amp;step=3" method="post">';
-               wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 3').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-
-       }
-
-
-       function import_t2p ( ) {
-
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
-
-               // run that funky magic!
-               $tags_added = $this->tag2post();
-
-               echo '<p>' . sprintf( _n( 'Done! <strong>%s</strong> tag were added!', 'Done! <strong>%s</strong> tags were added!', $tags_added ), $tags_added ) . '<br /></p>';
-
-               echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
-               wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 4').'" /></p>';
-               echo '</form>';
-               echo '</div>';
-
-       }
-
-
-       function get_utw_tags ( ) {
-
-               global $wpdb;
-
-               // read in all the tags from the UTW tags table: should be wp_tags
-               $tags_query = "SELECT tag_id, tag FROM " . $wpdb->prefix . "tags";
-
-               $tags = $wpdb->get_results($tags_query);
-
-               // rearrange these tags into something we can actually use
-               foreach ( $tags as $tag ) {
-
-                       $new_tags[$tag->tag_id] = $tag->tag;
-
-               }
-
-               return $new_tags;
-
-       }
-
-       function get_utw_posts ( ) {
-
-               global $wpdb;
-
-               // read in all the posts from the UTW post->tag table: should be wp_post2tag
-               $posts_query = "SELECT tag_id, post_id FROM " . $wpdb->prefix . "post2tag";
-
-               $posts = $wpdb->get_results($posts_query);
-
-               return $posts;
-
-       }
-
-
-       function tag2post ( ) {
-
-               // get the tags and posts we imported in the last 2 steps
-               $tags = get_option('utwimp_tags');
-               $posts = get_option('utwimp_posts');
-
-               // null out our results
-               $tags_added = 0;
-
-               // loop through each post and add its tags to the db
-               foreach ( $posts as $this_post ) {
-
-                       $the_post = (int) $this_post->post_id;
-                       $the_tag = (int) $this_post->tag_id;
-
-                       // what's the tag name for that id?
-                       $the_tag = $tags[$the_tag];
-
-                       // screw it, just try to add the tag
-                       wp_add_post_tags($the_post, $the_tag);
-
-                       $tags_added++;
-
-               }
-
-               // that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
-               return $tags_added;
-
-
-       }
-
-
-       function cleanup_import ( ) {
-
-               delete_option('utwimp_tags');
-               delete_option('utwimp_posts');
-
-               $this->done();
-
-       }
-
-
-       function done ( ) {
-
-               echo '<div class="narrow">';
-               echo '<p><h3>'.__('Import Complete!').'</h3></p>';
-
-               echo '<p>' . __('OK, so we lied about this being a 5-step program! You&#8217;re done!') . '</p>';
-
-               echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';
-
-               echo '</div>';
-
-       }
-
-
-       function UTW_Import ( ) {
-
-               // Nothing.
-
-       }
-
-}
-
-
-// create the import object
-$utw_import = new UTW_Import();
-
-// add it to the import page!
-register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into WordPress tags.'), array($utw_import, 'dispatch'));
-
-?>
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
deleted file mode 100644 (file)
index 83c90ac..0000000
+++ /dev/null
@@ -1,869 +0,0 @@
-<?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 ();
-       var $orphans = array ();
-       var $file;
-       var $id;
-       var $mtnames = array ();
-       var $newauthornames = array ();
-       var $allauthornames = array ();
-
-       var $author_ids = array ();
-       var $tags = array ();
-       var $categories = array ();
-       var $terms = array ();
-
-       var $j = -1;
-       var $fetch_attachments = false;
-       var $url_remap = array ();
-
-       function header() {
-               echo '<div class="wrap">';
-               screen_icon();
-               echo '<h2>'.__('Import WordPress').'</h2>';
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function unhtmlentities($string) { // From php.net for < 4.3 compat
-               $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-               $trans_tbl = array_flip($trans_tbl);
-               return strtr($string, $trans_tbl);
-       }
-
-       function greet() {
-               echo '<div class="narrow">';
-               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>';
-       }
-
-       function get_tag( $string, $tag ) {
-               global $wpdb;
-               preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
-               $return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
-               $return = $wpdb->escape( trim( $return ) );
-               return $return;
-       }
-
-       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 get_entries($process_post_func=NULL) {
-               set_magic_quotes_runtime(0);
-
-               $doing_entry = false;
-               $is_wxr_file = false;
-
-               $fp = $this->fopen($this->file, 'r');
-               if ($fp) {
-                       while ( !$this->feof($fp) ) {
-                               $importline = rtrim($this->fgets($fp));
-
-                               // this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether
-                               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];
-                                       continue;
-                               }
-                               if ( false !== strpos($importline, '<wp:tag>') ) {
-                                       preg_match('|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag);
-                                       $this->tags[] = $tag[1];
-                                       continue;
-                               }
-                               if ( false !== strpos($importline, '<wp:term>') ) {
-                                       preg_match('|<wp:term>(.*?)</wp:term>|is', $importline, $term);
-                                       $this->terms[] = $term[1];
-                                       continue;
-                               }
-                               if ( false !== strpos($importline, '<item>') ) {
-                                       $this->post = '';
-                                       $doing_entry = true;
-                                       continue;
-                               }
-                               if ( false !== strpos($importline, '</item>') ) {
-                                       $doing_entry = false;
-                                       if ($process_post_func)
-                                               call_user_func($process_post_func, $this->post);
-                                       continue;
-                               }
-                               if ( $doing_entry ) {
-                                       $this->post .= $importline . "\n";
-                               }
-                       }
-
-                       $this->fclose($fp);
-               }
-
-               return $is_wxr_file;
-
-       }
-
-       function get_wp_authors() {
-               // We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
-               $temp = $this->allauthornames;
-               $authors[0] = array_shift($temp);
-               $y = count($temp) + 1;
-               for ($x = 1; $x < $y; $x ++) {
-                       $next = array_shift($temp);
-                       if (!(in_array($next, $authors)))
-                               array_push($authors, "$next");
-               }
-
-               return $authors;
-       }
-
-       function get_authors_from_post() {
-               global $current_user;
-
-               // this will populate $this->author_ids with a list of author_names => user_ids
-
-               foreach ( $_POST['author_in'] as $i => $in_author_name ) {
-
-                       if ( !empty($_POST['user_select'][$i]) ) {
-                               // an existing user was selected in the dropdown list
-                               $user = get_userdata( intval($_POST['user_select'][$i]) );
-                               if ( isset($user->ID) )
-                                       $this->author_ids[$in_author_name] = $user->ID;
-                       }
-                       elseif ( $this->allow_create_users() ) {
-                               // nothing was selected in the dropdown list, so we'll use the name in the text field
-
-                               $new_author_name = trim($_POST['user_create'][$i]);
-                               // if the user didn't enter a name, assume they want to use the same name as in the import file
-                               if ( empty($new_author_name) )
-                                       $new_author_name = $in_author_name;
-
-                               $user_id = username_exists($new_author_name);
-                               if ( !$user_id ) {
-                                       $user_id = wp_create_user($new_author_name, wp_generate_password());
-                               }
-
-                               $this->author_ids[$in_author_name] = $user_id;
-                       }
-
-                       // failsafe: if the user_id was invalid, default to the current user
-                       if ( empty($this->author_ids[$in_author_name]) ) {
-                               $this->author_ids[$in_author_name] = intval($current_user->ID);
-                       }
-               }
-
-       }
-
-       function wp_authors_form() {
-?>
-<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
-       if ( $this->allow_create_users() ) {
-               echo '<p>'.__('If a new user is created by WordPress, a password will be randomly generated. Manually change the user&#8217;s details if necessary.')."</p>\n";
-       }
-
-
-               $authors = $this->get_wp_authors();
-               echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
-               wp_nonce_field('import-wordpress');
-?>
-<ol id="authors">
-<?php
-               $j = -1;
-               foreach ($authors as $author) {
-                       ++ $j;
-                       echo '<li>'.__('Import author:').' <strong>'.$author.'</strong><br />';
-                       $this->users_form($j, $author);
-                       echo '</li>';
-               }
-
-               if ( $this->allow_fetch_attachments() ) {
-?>
-</ol>
-<h2><?php _e('Import Attachments'); ?></h2>
-<p>
-       <input type="checkbox" value="1" name="attachments" id="import-attachments" />
-       <label for="import-attachments"><?php _e('Download and import file attachments') ?></label>
-</p>
-
-<?php
-               }
-
-               echo '<p class="submit">';
-               echo '<input type="submit" class="button" value="'. esc_attr__('Submit') .'" />'.'<br />';
-               echo '</p>';
-               echo '</form>';
-
-       }
-
-       function users_form($n, $author) {
-
-               if ( $this->allow_create_users() ) {
-                       printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'. esc_attr($author) .'" name="'.'user_create['.intval($n).']'.'" maxlength="30" /></label> <br />');
-               }
-               else {
-                       echo __('Map to existing').'<br />';
-               }
-
-               // keep track of $n => $author name
-               echo '<input type="hidden" name="author_in['.intval($n).']" value="' . esc_attr($author).'" />';
-
-               $users = get_users_of_blog();
-?><select name="user_select[<?php echo $n; ?>]">
-       <option value="0"><?php _e('- Select -'); ?></option>
-       <?php
-               foreach ($users as $user) {
-                       echo '<option value="'.$user->user_id.'">'.$user->user_login.'</option>';
-               }
-?>
-       </select>
-       <?php
-       }
-
-       function select_authors() {
-               $is_wxr_file = $this->get_entries(array(&$this, 'process_author'));
-               if ( $is_wxr_file ) {
-                       $this->wp_authors_form();
-               }
-               else {
-                       echo '<h2>'.__('Invalid file').'</h2>';
-                       echo '<p>'.__('Please upload a valid WXR (WordPress eXtended RSS) export file.').'</p>';
-               }
-       }
-
-       // fetch the user ID for a given author name, respecting the mapping preferences
-       function checkauthor($author) {
-               global $current_user;
-
-               if ( !empty($this->author_ids[$author]) )
-                       return $this->author_ids[$author];
-
-               // failsafe: map to the current user
-               return $current_user->ID;
-       }
-
-
-
-       function process_categories() {
-               global $wpdb;
-
-               $cat_names = (array) get_terms('category', 'fields=names');
-
-               while ( $c = array_shift($this->categories) ) {
-                       $cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));
-
-                       // If the category exists we leave it alone
-                       if ( in_array($cat_name, $cat_names) )
-                               continue;
-
-                       $category_nicename      = $this->get_tag( $c, 'wp:category_nicename' );
-                       $category_description = $this->get_tag( $c, 'wp:category_description' );
-                       $posts_private          = (int) $this->get_tag( $c, 'wp:posts_private' );
-                       $links_private          = (int) $this->get_tag( $c, 'wp:links_private' );
-
-                       $parent = $this->get_tag( $c, 'wp:category_parent' );
-
-                       if ( empty($parent) )
-                               $category_parent = '0';
-                       else
-                               $category_parent = category_exists($parent);
-
-                       $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name', 'category_description');
-
-                       $cat_ID = wp_insert_category($catarr);
-               }
-       }
-
-       function process_tags() {
-               global $wpdb;
-
-               $tag_names = (array) get_terms('post_tag', 'fields=names');
-
-               while ( $c = array_shift($this->tags) ) {
-                       $tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));
-
-                       // If the category exists we leave it alone
-                       if ( in_array($tag_name, $tag_names) )
-                               continue;
-
-                       $slug = $this->get_tag( $c, 'wp:tag_slug' );
-                       $description = $this->get_tag( $c, 'wp:tag_description' );
-
-                       $tagarr = compact('slug', 'description');
-
-                       $tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr);
-               }
-       }
-       
-       function process_terms() {
-               global $wpdb, $wp_taxonomies;
-               
-               $custom_taxonomies = $wp_taxonomies;
-               // get rid of the standard taxonomies
-               unset( $custom_taxonomies['category'] );
-               unset( $custom_taxonomies['post_tag'] );
-               unset( $custom_taxonomies['link_category'] );
-               
-               $custom_taxonomies = array_keys( $custom_taxonomies );
-               $current_terms = (array) get_terms( $custom_taxonomies, 'get=all' );
-               $taxonomies = array();
-               foreach ( $current_terms as $term ) {
-                       if ( isset( $_terms[$term->taxonomy] ) ) {
-                               $taxonomies[$term->taxonomy] = array_merge( $taxonomies[$term->taxonomy], array($term->name) );
-                       } else {
-                               $taxonomies[$term->taxonomy] = array($term->name);
-                       }
-               }
-
-               while ( $c = array_shift($this->terms) ) {
-                       $term_name = trim($this->get_tag( $c, 'wp:term_name' ));
-                       $term_taxonomy = trim($this->get_tag( $c, 'wp:term_taxonomy' ));
-
-                       // If the term exists in the taxonomy we leave it alone
-                       if ( isset($taxonomies[$term_taxonomy] ) && in_array( $term_name, $taxonomies[$term_taxonomy] ) )
-                               continue;
-
-                       $slug = $this->get_tag( $c, 'wp:term_slug' );
-                       $description = $this->get_tag( $c, 'wp:term_description' );
-
-                       $termarr = compact('slug', 'description');
-
-                       $term_ID = wp_insert_term($term_name, $this->get_tag( $c, 'wp:term_taxonomy' ), $termarr);
-               }
-       }
-
-       function process_author($post) {
-               $author = $this->get_tag( $post, 'dc:creator' );
-               if ($author)
-                       $this->allauthornames[] = $author;
-       }
-
-       function process_posts() {
-               echo '<ol>';
-
-               $this->get_entries(array(&$this, 'process_post'));
-
-               echo '</ol>';
-
-               wp_import_cleanup($this->id);
-               do_action('import_done', 'wordpress');
-
-               echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
-       }
-
-       function _normalize_tag( $matches ) {
-               return '<' . strtolower( $matches[1] );
-       }
-
-       function process_post($post) {
-               global $wpdb;
-
-               $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
-               $post_title     = $this->get_tag( $post, 'title' );
-               $post_date      = $this->get_tag( $post, 'wp:post_date' );
-               $post_date_gmt  = $this->get_tag( $post, 'wp:post_date_gmt' );
-               $comment_status = $this->get_tag( $post, 'wp:comment_status' );
-               $ping_status    = $this->get_tag( $post, 'wp:ping_status' );
-               $post_status    = $this->get_tag( $post, 'wp:status' );
-               $post_name      = $this->get_tag( $post, 'wp:post_name' );
-               $post_parent    = $this->get_tag( $post, 'wp:post_parent' );
-               $menu_order     = $this->get_tag( $post, 'wp:menu_order' );
-               $post_type      = $this->get_tag( $post, 'wp:post_type' );
-               $post_password  = $this->get_tag( $post, 'wp:post_password' );
-               $is_sticky              = $this->get_tag( $post, 'wp:is_sticky' );
-               $guid           = $this->get_tag( $post, 'guid' );
-               $post_author    = $this->get_tag( $post, 'dc:creator' );
-
-               $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
-               $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $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_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
-               $post_content = str_replace('<br>', '<br />', $post_content);
-               $post_content = str_replace('<hr>', '<hr />', $post_content);
-
-               preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags);
-               $tags = $tags[1];
-
-               $tag_index = 0;
-               foreach ($tags as $tag) {
-                       $tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));
-                       $tag_index++;
-               }
-
-               preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
-               $categories = $categories[1];
-
-               $cat_index = 0;
-               foreach ($categories as $category) {
-                       $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
-                       $cat_index++;
-               }
-
-               $post_exists = post_exists($post_title, '', $post_date);
-
-               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.
-                       $post_parent = (int) $post_parent;
-                       if ($post_parent) {
-                               // if we already know the parent, map it to the local ID
-                               if ( $parent = $this->post_ids_processed[$post_parent] ) {
-                                       $post_parent = $parent;  // new ID of the parent
-                               }
-                               else {
-                                       // record the parent for later
-                                       $this->orphans[intval($post_ID)] = $post_parent;
-                               }
-                       }
-
-                       echo '<li>';
-
-                       $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 )
-                                       $remote_url = $guid;
-
-                               $comment_post_ID = $post_id = $this->process_attachment($postdata, $remote_url);
-                               if ( !$post_id or is_wp_error($post_id) )
-                                       return $post_id;
-                       }
-                       else {
-                               printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
-                               $comment_post_ID = $post_id = wp_insert_post($postdata);
-                               if ( $post_id && $is_sticky == 1 )
-                                       stick_post( $post_id );
-
-                       }
-
-                       if ( is_wp_error( $post_id ) )
-                               return $post_id;
-
-                       // Memorize old and new ID.
-                       if ( $post_id && $post_ID ) {
-                               $this->post_ids_processed[intval($post_ID)] = intval($post_id);
-                       }
-
-                       // Add categories.
-                       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;
-                                       if ( ! empty($cat) )
-                                               $cat_ID = $cat->term_id;
-                                       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;
-                               }
-                               wp_set_post_categories($post_id, $post_cats);
-                       }
-
-                       // Add tags.
-                       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;
-                                       if ( ! empty($tag_obj) )
-                                               $tag_id = $tag_obj->term_id;
-                                       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);
-                               }
-                               wp_set_post_tags($post_id, $post_tags);
-                       }
-               }
-
-               // Now for comments
-               preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
-               $comments = $comments[1];
-               $num_comments = 0;
-               $inserted_comments = array();
-               if ( $comments) { 
-                       foreach ($comments as $comment) {
-                               $comment_id     = $this->get_tag( $comment, 'wp:comment_id');
-                               $newcomments[$comment_id]['comment_post_ID']      = $comment_post_ID;
-                               $newcomments[$comment_id]['comment_author']       = $this->get_tag( $comment, 'wp:comment_author');
-                               $newcomments[$comment_id]['comment_author_email'] = $this->get_tag( $comment, 'wp:comment_author_email');
-                               $newcomments[$comment_id]['comment_author_IP']    = $this->get_tag( $comment, 'wp:comment_author_IP');
-                               $newcomments[$comment_id]['comment_author_url']   = $this->get_tag( $comment, 'wp:comment_author_url');
-                               $newcomments[$comment_id]['comment_date']         = $this->get_tag( $comment, 'wp:comment_date');
-                               $newcomments[$comment_id]['comment_date_gmt']     = $this->get_tag( $comment, 'wp:comment_date_gmt');
-                               $newcomments[$comment_id]['comment_content']      = $this->get_tag( $comment, 'wp:comment_content');
-                               $newcomments[$comment_id]['comment_approved']     = $this->get_tag( $comment, 'wp:comment_approved');
-                               $newcomments[$comment_id]['comment_type']         = $this->get_tag( $comment, 'wp:comment_type');
-                               $newcomments[$comment_id]['comment_parent']       = $this->get_tag( $comment, 'wp:comment_parent');
-                       }
-                       // Sort by comment ID, to make sure comment parents exist (if there at all)
-                       ksort($newcomments);
-                       foreach ($newcomments as $key => $comment) {
-                               // if this is a new post we can skip the comment_exists() check
-                               if ( !$post_exists || !comment_exists($comment['comment_author'], $comment['comment_date']) ) {
-                                       if (isset($inserted_comments[$comment['comment_parent']]))
-                                               $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
-                                       $comment = wp_filter_comment($comment);
-                                       $inserted_comments[$key] = wp_insert_comment($comment);
-                                       $num_comments++;
-                               }
-                       }
-               }
-
-               if ( $num_comments )
-                       printf(' '._n('(%s comment)', '(%s comments)', $num_comments), $num_comments);
-
-               // Now for post meta
-               preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
-               $postmeta = $postmeta[1];
-               if ( $postmeta) { foreach ($postmeta as $p) {
-                       $key   = $this->get_tag( $p, 'wp:meta_key' );
-                       $value = $this->get_tag( $p, 'wp:meta_value' );
-                       $value = stripslashes($value); // add_post_meta() will escape.
-
-                       $this->process_post_meta($post_id, $key, $value);
-
-               } }
-
-               do_action('import_post_added', $post_id);
-               print "</li>\n";
-       }
-
-       function process_post_meta($post_id, $key, $value) {
-               // the filter can return false to skip a particular metadata key
-               $_key = apply_filters('import_post_meta_key', $key);
-               if ( $_key ) {
-                       add_post_meta( $post_id, $_key, $value );
-                       do_action('import_post_meta', $post_id, $_key, $value);
-               }
-       }
-
-       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()) );
-                               return $upload;
-                       }
-                       else {
-                               print '('.size_format(filesize($upload['file'])).')';
-                       }
-
-                       if ( $info = wp_check_filetype($upload['file']) ) {
-                               $postdata['post_mime_type'] = $info['type'];
-                       }
-                       else {
-                               print __('Invalid file type');
-                               return;
-                       }
-
-                       $postdata['guid'] = $upload['url'];
-
-                       // as per wp-admin/includes/upload.php
-                       $post_id = wp_insert_attachment($postdata, $upload['file']);
-                       wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
-
-                       // remap the thumbnail url.  this isn't perfect because we're just guessing the original url.
-                       if ( preg_match('@^image/@', $info['type']) && $thumb_url = wp_get_attachment_thumb_url($post_id) ) {
-                               $parts = pathinfo($remote_url);
-                               $ext = $parts['extension'];
-                               $name = basename($parts['basename'], ".{$ext}");
-                               $this->url_remap[$parts['dirname'] . '/' . $name . '.thumbnail.' . $ext] = $thumb_url;
-                       }
-
-                       return $post_id;
-               }
-               else {
-                       printf( __('Skipping attachment <em>%s</em>'), htmlspecialchars($remote_url) );
-               }
-       }
-
-       function fetch_remote_file($post, $url) {
-               $upload = wp_upload_dir($post['post_date']);
-
-               // extract the file name and extension from the url
-               $file_name = basename($url);
-
-               // get placeholder file in the upload dir with a unique sanitized filename
-               $upload = wp_upload_bits( $file_name, 0, '', $post['post_date']);
-               if ( $upload['error'] ) {
-                       echo $upload['error'];
-                       return new WP_Error( 'upload_dir_error', $upload['error'] );
-               }
-
-               // 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']);
-                       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']);
-                       return new WP_Error( 'import_file_error', __('Remote file is incorrect size') );
-               }
-
-               $max_size = $this->max_attachment_size();
-               if ( !empty($max_size) and filesize($upload['file']) > $max_size ) {
-                       @unlink($upload['file']);
-                       return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', size_format($max_size))) );
-               }
-
-               // keep track of the old and new urls so we can substitute them later
-               $this->url_remap[$url] = $upload['url'];
-               // if the remote url is redirected somewhere else, keep track of the destination too
-               if ( $headers['x-final-location'] != $url )
-                       $this->url_remap[$headers['x-final-location']] = $upload['url'];
-
-               return $upload;
-
-       }
-
-       // sort by strlen, longest string first
-       function cmpr_strlen($a, $b) {
-               return strlen($b) - strlen($a);
-       }
-
-       // update url references in post bodies to point to the new local files
-       function backfill_attachment_urls() {
-
-               // make sure we do the longest urls first, in case one is a substring of another
-               uksort($this->url_remap, array(&$this, 'cmpr_strlen'));
-
-               global $wpdb;
-               foreach ($this->url_remap as $from_url => $to_url) {
-                       // remap urls in post_content
-                       $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, '%s', '%s')", $from_url, $to_url) );
-                       // remap enclosure urls
-                       $result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, '%s', '%s') WHERE meta_key='enclosure'", $from_url, $to_url) );
-               }
-       }
-
-       // update the post_parent of orphans now that we know the local id's of all parents
-       function backfill_parents() {
-               global $wpdb;
-
-               foreach ($this->orphans as $child_id => $parent_id) {
-                       $local_child_id = $this->post_ids_processed[$child_id];
-                       $local_parent_id = $this->post_ids_processed[$parent_id];
-                       if ($local_child_id and $local_parent_id) {
-                               $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $local_parent_id, $local_child_id));
-                       }
-               }
-       }
-
-       function is_valid_meta_key($key) {
-               // skip attachment metadata since we'll regenerate it from scratch
-               if ( $key == '_wp_attached_file' || $key == '_wp_attachment_metadata' )
-                       return false;
-               return $key;
-       }
-
-       // give the user the option of creating new users to represent authors in the import file?
-       function allow_create_users() {
-               return apply_filters('import_allow_create_users', true);
-       }
-
-       // give the user the option of downloading and importing attached files
-       function allow_fetch_attachments() {
-               return apply_filters('import_allow_fetch_attachments', true);
-       }
-
-       function max_attachment_size() {
-               // can be overridden with a filter - 0 means no limit
-               return apply_filters('import_attachment_size_limit', 0);
-       }
-
-       function import_start() {
-               wp_defer_term_counting(true);
-               wp_defer_comment_counting(true);
-               do_action('import_start');
-       }
-
-       function import_end() {
-               do_action('import_end');
-
-               // clear the caches after backfilling
-               foreach ($this->post_ids_processed as $post_id)
-                       clean_post_cache($post_id);
-
-               wp_defer_term_counting(false);
-               wp_defer_comment_counting(false);
-       }
-
-       function import($id, $fetch_attachments = false) {
-               $this->id = (int) $id;
-               $this->fetch_attachments = ($this->allow_fetch_attachments() && (bool) $fetch_attachments);
-
-               add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
-               $file = get_attached_file($this->id);
-               $this->import_file($file);
-       }
-
-       function import_file($file) {
-               $this->file = $file;
-
-               $this->import_start();
-               $this->get_authors_from_post();
-               wp_suspend_cache_invalidation(true);
-               $this->get_entries();
-               $this->process_categories();
-               $this->process_tags();
-               $this->process_terms();
-               $result = $this->process_posts();
-               wp_suspend_cache_invalidation(false);
-               $this->backfill_parents();
-               $this->backfill_attachment_urls();
-               $this->import_end();
-
-               if ( is_wp_error( $result ) )
-                       return $result;
-       }
-
-       function handle_upload() {
-               $file = wp_import_handle_upload();
-               if ( isset($file['error']) ) {
-                       echo '<p>'.__('Sorry, there has been an error.').'</p>';
-                       echo '<p><strong>' . $file['error'] . '</strong></p>';
-                       return false;
-               }
-               $this->file = $file['file'];
-               $this->id = (int) $file['id'];
-               return true;
-       }
-
-       function dispatch() {
-               if (empty ($_GET['step']))
-                       $step = 0;
-               else
-                       $step = (int) $_GET['step'];
-
-               $this->header();
-               switch ($step) {
-                       case 0 :
-                               $this->greet();
-                               break;
-                       case 1 :
-                               check_admin_referer('import-upload');
-                               if ( $this->handle_upload() )
-                                       $this->select_authors();
-                               break;
-                       case 2:
-                               check_admin_referer('import-wordpress');
-                               $result = $this->import( $_GET['id'], $_POST['attachments'] );
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
-                               break;
-               }
-               $this->footer();
-       }
-
-       function WP_Import() {
-               // Nothing.
-       }
-}
-
-/**
- * Register WordPress Importer
- *
- * @since unknown
- * @var WP_Import
- * @name $wp_import
- */
-$wp_import = new WP_Import();
-
-register_importer('wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.'), array ($wp_import, 'dispatch'));
-
-?>
diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php
deleted file mode 100644 (file)
index b4312b6..0000000
+++ /dev/null
@@ -1,472 +0,0 @@
-<?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();
-       var $tags_to_convert = array();
-       var $all_tags = array();
-       var $hybrids_ids = array();
-
-       function header() {
-               echo '<div class="wrap">';
-               if ( ! current_user_can('manage_categories') ) {
-                       echo '<div class="narrow">';
-                       echo '<p>' . __('Cheatin&#8217; uh?') . '</p>';
-                       echo '</div>';
-               } else { ?>
-                       <div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag"><?php _e( "Categories to Tags" ); ?></a>
-                       <a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&amp;step=3"><?php _e( "Tags to Categories" ); ?></a></p></div>
-<?php  }
-       }
-
-       function footer() {
-               echo '</div>';
-       }
-
-       function populate_cats() {
-
-               $categories = get_categories('get=all');
-               foreach ( $categories as $category ) {
-                       $this->all_categories[] = $category;
-                       if ( is_term( $category->slug, 'post_tag' ) )
-                               $this->hybrids_ids[] = $category->term_id;
-               }
-       }
-
-       function populate_tags() {
-
-               $tags = get_terms( array('post_tag'), 'get=all' );
-               foreach ( $tags as $tag ) {
-                       $this->all_tags[] = $tag;
-                       if ( is_term( $tag->slug, 'category' ) )
-                               $this->hybrids_ids[] = $tag->term_id;
-               }
-       }
-
-       function categories_tab() {
-               $this->populate_cats();
-               $cat_num = count($this->all_categories);
-
-               echo '<br class="clear" />';
-
-               if ( $cat_num > 0 ) {
-                       screen_icon();
-                       echo '<h2>' . sprintf( _n( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
-                       echo '<div class="narrow">';
-                       echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
-                       echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
-
-                       $this->categories_form();
-               } else {
-                       echo '<p>'.__('You have no categories to convert!').'</p>';
-               }
-       }
-
-       function categories_form() { ?>
-
-<script type="text/javascript">
-/* <![CDATA[ */
-var checkflag = "false";
-function check_all_rows() {
-       field = document.catlist;
-       if ( 'false' == checkflag ) {
-               for ( i = 0; i < field.length; i++ ) {
-                       if ( 'cats_to_convert[]' == field[i].name )
-                               field[i].checked = true;
-               }
-               checkflag = 'true';
-               return '<?php _e('Uncheck All') ?>';
-       } else {
-               for ( i = 0; i < field.length; i++ ) {
-                       if ( 'cats_to_convert[]' == field[i].name )
-                               field[i].checked = false;
-               }
-               checkflag = 'false';
-               return '<?php _e('Check All') ?>';
-       }
-}
-/* ]]> */
-</script>
-
-<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
-<p><input type="button" class="button-secondary" value="<?php esc_attr_e('Check All'); ?>" onclick="this.value=check_all_rows()" />
-<?php wp_nonce_field('import-cat2tag'); ?></p>
-<ul style="list-style:none">
-
-<?php  $hier = _get_term_hierarchy('category');
-
-               foreach ($this->all_categories as $category) {
-                       $category = sanitize_term( $category, 'category', 'display' );
-
-                       if ( (int) $category->parent == 0 ) { ?>
-
-       <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
-
-                                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          }
-               } ?>
-</ul>
-
-<?php  if ( ! empty($this->hybrids_ids) )
-                       echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
-
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Convert Categories to Tags'); ?>" /></p>
-</form>
-
-<?php }
-
-       function tags_tab() {
-               $this->populate_tags();
-               $tags_num = count($this->all_tags);
-
-               echo '<br class="clear" />';
-
-               if ( $tags_num > 0 ) {
-                       screen_icon();
-                       echo '<h2>' . sprintf( _n( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
-                       echo '<div class="narrow">';
-                       echo '<p>' . __('Here you can selectively convert existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
-                       echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
-
-                       $this->tags_form();
-               } else {
-                       echo '<p>'.__('You have no tags to convert!').'</p>';
-               }
-       }
-
-       function tags_form() { ?>
-
-<script type="text/javascript">
-/* <![CDATA[ */
-var checktags = "false";
-function check_all_tagrows() {
-       field = document.taglist;
-       if ( 'false' == checktags ) {
-               for ( i = 0; i < field.length; i++ ) {
-                       if ( 'tags_to_convert[]' == field[i].name )
-                               field[i].checked = true;
-               }
-               checktags = 'true';
-               return '<?php _e('Uncheck All') ?>';
-       } else {
-               for ( i = 0; i < field.length; i++ ) {
-                       if ( 'tags_to_convert[]' == field[i].name )
-                               field[i].checked = false;
-               }
-               checktags = 'false';
-               return '<?php _e('Check All') ?>';
-       }
-}
-/* ]]> */
-</script>
-
-<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
-<p><input type="button" class="button-secondary" value="<?php esc_attr_e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
-<?php wp_nonce_field('import-cat2tag'); ?></p>
-<ul style="list-style:none">
-
-<?php  foreach ( $this->all_tags as $tag ) { ?>
-       <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo esc_attr($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
-
-<?php  } ?>
-</ul>
-
-<?php  if ( ! empty($this->hybrids_ids) )
-                       echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
-
-<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php esc_attr_e('Convert Tags to Categories'); ?>" /></p>
-</form>
-
-<?php }
-
-       function _category_children($parent, $hier) { ?>
-
-               <ul style="list-style:none">
-<?php  foreach ($hier[$parent->term_id] as $child_id) {
-                       $child =& get_category($child_id); ?>
-               <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label><?php
-
-                       if ( in_array( intval($child->term_id), $this->hybrids_ids ) )
-                               echo ' <a href="#note"> * </a>';
-
-                       if ( isset($hier[$child->term_id]) )
-                               $this->_category_children($child, $hier); ?></li>
-<?php  } ?>
-               </ul><?php
-       }
-
-       function _category_exists($cat_id) {
-               $cat_id = (int) $cat_id;
-
-               $maybe_exists = category_exists($cat_id);
-
-               if ( $maybe_exists ) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
-       function convert_categories() {
-               global $wpdb;
-
-               if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { ?>
-                       <div class="narrow">
-                       <p><?php printf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p>
-                       </div>
-<?php          return;
-               }
-
-               if ( empty($this->categories_to_convert) )
-                       $this->categories_to_convert = $_POST['cats_to_convert'];
-
-               $hier = _get_term_hierarchy('category');
-               $hybrid_cats = $clear_parents = $parents = false;
-               $clean_term_cache = $clean_cat_cache = array();
-               $default_cat = get_option('default_category');
-
-               echo '<ul>';
-
-               foreach ( (array) $this->categories_to_convert as $cat_id) {
-                       $cat_id = (int) $cat_id;
-
-                       if ( ! $this->_category_exists($cat_id) ) {
-                               echo '<li>' . sprintf( __('Category %s doesn&#8217;t exist!'),  $cat_id ) . "</li>\n";
-                       } else {
-                               $category =& get_category($cat_id);
-                               echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);
-
-                               // If the category is the default, leave category in place and create tag.
-                               if ( $default_cat == $category->term_id ) {
-
-                                       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;
-
-                                       foreach ( $posts as $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)");
-
-                                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );
-                                       }
-
-                                       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');
-                                       $tag_ttid = (int) $tag_ttid;
-                                       $term_order = 0;
-
-                                       foreach ( $objects_ids as $object_id )
-                                               $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tag_ttid, $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)");
-
-                                               $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) );
-                                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );
-                                       }
-                                       echo __('Tag added to all posts in this category.') . " *</li>\n";
-
-                                       $hybrid_cats = true;
-                                       $clean_term_cache[] = $category->term_id;
-                                       $clean_cat_cache[] = $category->term_id;
-
-                                       continue;
-                               }
-
-                               $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
-                               if ( $tt_ids ) {
-                                       $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
-                                       foreach ( (array) $posts as $post )
-                                               clean_post_cache($post);
-                               }
-
-                               // Change the category to a tag.
-                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
-
-                               // Set all parents to 0 (root-level) if their parent was the converted tag
-                               $parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
-
-                               if ( $parents ) $clear_parents = true;
-                               $clean_cat_cache[] = $category->term_id;
-                               echo __('Converted successfully.') . "</li>\n";
-                       }
-               }
-               echo '</ul>';
-
-               if ( ! empty($clean_term_cache) ) {
-                       $clean_term_cache = array_unique(array_values($clean_term_cache));
-                       clean_term_cache($clean_term_cache, 'post_tag');
-               }
-
-               if ( ! empty($clean_cat_cache) ) {
-                       $clean_cat_cache = array_unique(array_values($clean_cat_cache));
-                       clean_term_cache($clean_cat_cache, 'category');
-               }
-
-               if ( $clear_parents ) delete_option('category_children');
-
-               if ( $hybrid_cats )
-                       echo '<p>' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the <a href="%s">Manage Categories</a> page.'), 'categories.php') . '</p>';
-               echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
-       }
-
-       function convert_tags() {
-               global $wpdb;
-
-               if ( (!isset($_POST['tags_to_convert']) || !is_array($_POST['tags_to_convert'])) && empty($this->tags_to_convert)) {
-                       echo '<div class="narrow">';
-                       echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3') . '</p>';
-                       echo '</div>';
-                       return;
-               }
-
-               if ( empty($this->tags_to_convert) )
-                       $this->tags_to_convert = $_POST['tags_to_convert'];
-
-               $hybrid_tags = $clear_parents = false;
-               $clean_cat_cache = $clean_term_cache = array();
-               $default_cat = get_option('default_category');
-               echo '<ul>';
-
-               foreach ( (array) $this->tags_to_convert as $tag_id) {
-                       $tag_id = (int) $tag_id;
-
-                       if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
-                               printf('<li>' . __('Converting tag <strong>%s</strong> ... '),  $tag->name);
-
-                               if ( $cat_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $tag->term_id) ) ) {
-                                       $objects_ids = get_objects_in_term($tag->term_id, 'post_tag');
-                                       $cat_ttid = (int) $cat_ttid;
-                                       $term_order = 0;
-
-                                       foreach ( $objects_ids as $object_id ) {
-                                               $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $cat_ttid, $term_order);
-                                               clean_post_cache($object_id);
-                                       }
-
-                                       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 ( $default_cat != $tag->term_id ) {
-                                                       $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) );
-                                                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );
-                                               }
-                                       }
-
-                                       $hybrid_tags = true;
-                                       $clean_term_cache[] = $tag->term_id;
-                                       $clean_cat_cache[] = $tag->term_id;
-                                       echo __('All posts were added to the category with the same name.') . " *</li>\n";
-
-                                       continue;
-                               }
-
-                               // Change the tag to a category.
-                               $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
-                               if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) {
-                                       $reset_parent = '';
-                                       $clear_parents = true;
-                               } else
-                                       $reset_parent = ", parent = '0'";
-
-                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
-
-                               $clean_term_cache[] = $tag->term_id;
-                               $clean_cat_cache[] = $cat['term_id'];
-                               echo __('Converted successfully.') . "</li>\n";
-
-                       } else {
-                               printf( '<li>' . __('Tag #%s doesn&#8217;t exist!') . "</li>\n",  $tag_id );
-                       }
-               }
-
-               if ( ! empty($clean_term_cache) ) {
-                       $clean_term_cache = array_unique(array_values($clean_term_cache));
-                       clean_term_cache($clean_term_cache, 'post_tag');
-               }
-
-               if ( ! empty($clean_cat_cache) ) {
-                       $clean_cat_cache = array_unique(array_values($clean_cat_cache));
-                       clean_term_cache($clean_term_cache, 'category');
-               }
-
-               if ( $clear_parents ) delete_option('category_children');
-
-               echo '</ul>';
-               if ( $hybrid_tags )
-                       echo '<p>' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the <a href="%s">Manage Tags</a> page.'), 'edit-tags.php') . '</p>';
-               echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3' ) . '</p>';
-       }
-
-       function init() {
-
-               $step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
-
-               $this->header();
-
-               if ( current_user_can('manage_categories') ) {
-
-                       switch ($step) {
-                               case 1 :
-                                       $this->categories_tab();
-                               break;
-
-                               case 2 :
-                                       check_admin_referer('import-cat2tag');
-                                       $this->convert_categories();
-                               break;
-
-                               case 3 :
-                                       $this->tags_tab();
-                               break;
-
-                               case 4 :
-                                       check_admin_referer('import-cat2tag');
-                                       $this->convert_tags();
-                               break;
-                       }
-               }
-
-               $this->footer();
-       }
-
-       function WP_Categories_to_Tags() {
-               // Do nothing.
-       }
-}
-
-$wp_cat2tag_importer = new WP_Categories_to_Tags();
-
-register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));
-
-?>
index a75a19934d22aa4721e6f0b93495b31ea6642b06..23c9ee2b7c712fa8c5b5fd496c7ffae1a9e54ea1 100644 (file)
@@ -51,4 +51,13 @@ require_once(ABSPATH . 'wp-admin/includes/update.php');
 /** WordPress Registration API */
 require_once(ABSPATH . WPINC . '/registration.php');
 
-?>
\ No newline at end of file
+/** WordPress Deprecated Administration API */
+require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
+
+/** WordPress Multi-Site support API */
+if ( is_multisite() ) {
+       require_once(ABSPATH . 'wp-admin/includes/ms.php');
+       require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php');
+}
+
+?>
index 64621fdc6677166a8e383caf196d72e68b4ec8fe..7dd8baf65130804c4507a3732abbe1748f9b2809 100644 (file)
@@ -102,7 +102,7 @@ function wp_delete_link( $link_id ) {
  */
 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', array('fields' => 'ids') );
 
        return array_unique( $cats );
 }
@@ -186,19 +186,14 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
        }
 
        if ( $update ) {
-               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
-                       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 ( false === $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_rating', 'link_rel', 'link_notes', 'link_rss'), compact('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 {
-               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 ( false === $wpdb->insert( $wpdb->links, compact('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
@@ -251,7 +246,7 @@ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
 function wp_update_link( $linkdata ) {
        $link_id = (int) $linkdata['link_id'];
 
-       $link = get_link( $link_id, ARRAY_A );
+       $link = get_bookmark( $link_id, ARRAY_A );
 
        // Escape data pulled from DB.
        $link = add_magic_quotes( $link );
index 80703a9552ce44b4eb43889e4a17d9e63df3b5f6..1e35e745317a2452e815ff2b9f50830f16c92c6a 100644 (file)
@@ -495,7 +495,7 @@ class ftp_base {
                $this->_features=array();
                foreach($f as $k=>$v) {
                        $v=explode(" ", trim($v));
-                       $this->_features[array_shift($v)]=$v;;
+                       $this->_features[array_shift($v)]=$v;
                }
                return true;
        }
index 6b0d09816975f3eef5023c9f4d3399df72cbe19b..0aaadeba4a6fc9172780e23401cf2184cf064c97 100644 (file)
@@ -13,7 +13,7 @@
  */
 class WP_Filesystem_Base {
        /**
-        * Whether to display debug data for the connection or not.
+        * Whether to display debug data for the connection.
         *
         * @since 2.5
         * @access public
@@ -142,6 +142,7 @@ class WP_Filesystem_Base {
                                if ( defined($constant) && $folder === $dir )
                                        return trailingslashit(constant($constant));
                } elseif ( 'direct' == $this->method ) {
+                       $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
                        return trailingslashit($folder);
                }
 
@@ -156,7 +157,7 @@ class WP_Filesystem_Base {
                        $this->cache[ $folder ] = $folder;
                        return $folder;
                }
-               if( $return = $this->search_for_folder($folder) )
+               if ( $return = $this->search_for_folder($folder) )
                        $this->cache[ $folder ] = $return;
                return $return;
        }
@@ -288,8 +289,8 @@ class WP_Filesystem_Base {
                $legal =  array('', 'w', 'r', 'x', '-');
                $attarray = preg_split('//', $mode);
 
-               for($i=0; $i < count($attarray); $i++)
-                  if($key = array_search($attarray[$i], $legal))
+               for ($i=0; $i < count($attarray); $i++)
+                  if ($key = array_search($attarray[$i], $legal))
                           $realmode .= $legal[$key];
 
                $mode = str_pad($realmode, 9, '-');
index 88e4a902a5982eb92b7d35a8a0e65f9c08b15d6e..538a683e8261c688ea94d29d859c3d1b0e4d05c0 100644 (file)
@@ -54,14 +54,13 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        /**
         * Write a string to a file
         *
-        * @param $file string Path to the file where to write the data.
+        * @param $file string Remote path to the file where to write the data.
         * @param $contents string The data to write.
         * @param $mode int (optional) The file permissions as octal number, usually 0644.
-        * @param $type string (optional) Specifies additional type of access you require to the file.
         * @return bool False upon failure.
         */
-       function put_contents($file, $contents, $mode = false, $type = '') {
-               if ( ! ($fp = @fopen($file, 'w' . $type)) )
+       function put_contents($file, $contents, $mode = false ) {
+               if ( ! ($fp = @fopen($file, 'w')) )
                        return false;
                @fwrite($fp, $contents);
                @fclose($fp);
@@ -117,9 +116,6 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
         * @return bool Returns true on success or false on failure.
         */
        function chmod($file, $mode = false, $recursive = false) {
-               if ( ! $this->exists($file) )
-                       return false;
-
                if ( ! $mode ) {
                        if ( $this->is_file($file) )
                                $mode = FS_CHMOD_FILE;
@@ -129,14 +125,12 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
                                return false;
                }
 
-               if ( ! $recursive )
-                       return @chmod($file, $mode);
-               if ( ! $this->is_dir($file) )
+               if ( ! $recursive || ! $this->is_dir($file) )
                        return @chmod($file, $mode);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
-               foreach ($filelist as $filename)
+               foreach ( (array)$filelist as $filename => $filemeta)
                        $this->chmod($file . $filename, $mode, $recursive);
 
                return true;
@@ -202,11 +196,18 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        function copy($source, $destination, $overwrite = false) {
                if ( ! $overwrite && $this->exists($destination) )
                        return false;
+
                return copy($source, $destination);
        }
 
        function move($source, $destination, $overwrite = false) {
-               //Possible to use rename()?
+               if ( ! $overwrite && $this->exists($destination) )
+                       return false;
+
+               // try using rename first.  if that fails (for example, source is read only) try copy
+               if ( @rename($source, $destination) )
+                       return true;
+
                if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
                        $this->delete($source);
                        return true;
@@ -280,6 +281,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        }
 
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
+               // safe mode fails with a trailing slash under certain PHP versions.
+               $path = untrailingslashit($path);
+               if ( empty($path) )
+                       $path = '/';
+
                if ( ! $chmod )
                        $chmod = FS_CHMOD_DIR;
 
@@ -294,17 +300,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        }
 
        function rmdir($path, $recursive = false) {
-               //Currently unused and untested, Use delete() instead.
-               if ( ! $recursive )
-                       return @rmdir($path);
-               //recursive:
-               $filelist = $this->dirlist($path);
-               foreach ($filelist as $filename => $det) {
-                       if ( '/' == substr($filename, -1, 1) )
-                               $this->rmdir($path . '/' . $filename, $recursive);
-                       @rmdir($filename);
-               }
-               return @rmdir($path);
+               return $this->delete($path, $recursive);
        }
 
        function dirlist($path, $include_hidden = true, $recursive = false) {
index b8d5c9ae6bd34a7dd8e8881baff8cb829c488a51..df4ce0ad502507acf86461687012d9731e693f3a 100644 (file)
@@ -45,7 +45,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                else
                        $this->options['hostname'] = $opt['hostname'];
 
-               if ( isset($opt['base']) && ! empty($opt['base']) )
+               if ( ! empty($opt['base']) )
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
@@ -92,7 +92,9 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                if ( empty($type) )
                        $type = FTP_BINARY;
 
-               $temp = tmpfile();
+               $tempfile = wp_tempnam($file);
+               $temp = fopen($tempfile, 'w+');
+
                if ( ! $temp )
                        return false;
 
@@ -106,25 +108,30 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $contents .= fread($temp, 8192);
 
                fclose($temp);
+               unlink($tempfile);
                return $contents;
        }
        function get_contents_array($file) {
                return explode("\n", $this->get_contents($file));
        }
-       function put_contents($file, $contents, $type = '' ) {
-               if ( empty($type) )
-                       $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
 
-               $temp = tmpfile();
+       function put_contents($file, $contents, $mode = false ) {
+               $tempfile = wp_tempnam($file);
+               $temp = fopen($tempfile, 'w+');
                if ( ! $temp )
                        return false;
 
                fwrite($temp, $contents);
                fseek($temp, 0); //Skip back to the start of the file being written to
 
+               $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
                $ret = @ftp_fput($this->link, $file, $temp, $type);
 
                fclose($temp);
+               unlink($tempfile);
+
+               $this->chmod($file, $mode);
+
                return $ret;
        }
        function cwd() {
@@ -140,9 +147,6 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return false;
        }
        function chmod($file, $mode = false, $recursive = false) {
-               if ( ! $this->exists($file) && ! $this->is_dir($file) )
-                       return false;
-
                if ( ! $mode ) {
                        if ( $this->is_file($file) )
                                $mode = FS_CHMOD_FILE;
@@ -152,17 +156,17 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                                return false;
                }
 
-               if ( ! $recursive || ! $this->is_dir($file) ) {
-                       if ( ! function_exists('ftp_chmod') )
-                               return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
-                       return @ftp_chmod($this->link, $mode, $file);
-               }
-               //Is a directory, and we want recursive
-               $filelist = $this->dirlist($file);
-               foreach ( $filelist as $filename ) {
-                       $this->chmod($file . '/' . $filename, $mode, $recursive);
+               // chmod any sub-objects if recursive.
+               if ( $recursive && $this->is_dir($file) ) {
+                       $filelist = $this->dirlist($file);
+                       foreach ( (array)$filelist as $filename => $filemeta )
+                               $this->chmod($file . '/' . $filename, $mode, $recursive);
                }
-               return true;
+
+               // chmod the file or directory
+               if ( ! function_exists('ftp_chmod') )
+                       return (bool)@ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
+               return (bool)@ftp_chmod($this->link, $mode, $file);
        }
        function chown($file, $owner, $recursive = false ) {
                return false;
@@ -243,10 +247,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return false;
        }
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
-               if  ( !ftp_mkdir($this->link, $path) )
+               if ( !@ftp_mkdir($this->link, $path) )
                        return false;
-               if ( ! $chmod )
-                       $chmod = FS_CHMOD_DIR;
                $this->chmod($path, $chmod);
                if ( $chown )
                        $this->chown($path, $chown);
@@ -261,12 +263,15 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        function parselisting($line) {
                static $is_windows;
                if ( is_null($is_windows) )
-                       $is_windows = strpos( strtolower(ftp_systype($this->link)), 'win') !== false;
+                       $is_windows = stripos( ftp_systype($this->link), 'win') !== false;
 
-               if ( $is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer) ) {
+               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 ( $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
@@ -277,16 +282,17 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $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['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)) {
+               } elseif ( !$is_windows && $lucifer = preg_split('/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY)) {
                        //echo $line."\n";
-                       $lcount=count($lucifer);
-                       if ($lcount<8) return '';
+                       $lcount = count($lucifer);
+                       if ( $lcount < 8 )
+                               return '';
                        $b = array();
-                       $b['isdir'] = $lucifer[0]{0} === "d";
-                       $b['islink'] = $lucifer[0]{0} === "l";
+                       $b['isdir'] = $lucifer[0]{0} === 'd';
+                       $b['islink'] = $lucifer[0]{0} === 'l';
                        if ( $b['isdir'] )
                                $b['type'] = 'd';
                        elseif ( $b['islink'] )
@@ -298,15 +304,15 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $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']);
+                       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)) {
+                               if ( preg_match('/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2) ) {
                                        $b['year'] = date("Y");
                                        $b['hour'] = $l2[1];
                                        $b['minute'] = $l2[2];
@@ -315,7 +321,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                                        $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['time'] = strtotime( sprintf('%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute']) );
                                $b['name'] = $lucifer[8];
                        }
                }
@@ -331,9 +337,13 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $limit_file = false;
                }
 
-               $list = @ftp_rawlist($this->link, '-a ' . $path, false);
+               $pwd = @ftp_pwd($this->link);
+               if ( ! @ftp_chdir($this->link, $path) ) // Cant change to folder = folder doesnt exist
+                       return false;
+               $list = @ftp_rawlist($this->link, '-a', false);
+               @ftp_chdir($this->link, $pwd);
 
-               if ( $list === false )
+               if ( empty($list) ) // Empty array = non-existent folder (real folder will show . at least)
                        return false;
 
                $dirlist = array();
@@ -354,9 +364,6 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $dirlist[ $entry['name'] ] = $entry;
                }
 
-               if ( ! $dirlist )
-                       return false;
-
                $ret = array();
                foreach ( (array)$dirlist as $struc ) {
                        if ( 'd' == $struc['type'] ) {
index a72abaa766a7ed0c627fa4cfb80f5fa51516679b..efd19d1f6fc2e13dfe0ea78e36553fd7a26f2585 100644 (file)
@@ -39,7 +39,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                else
                        $this->options['hostname'] = $opt['hostname'];
 
-               if ( isset($opt['base']) && ! empty($opt['base']) )
+               if ( ! empty($opt['base']) )
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
@@ -115,14 +115,9 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                return explode("\n", $this->get_contents($file) );
        }
 
-       function put_contents($file, $contents, $type = '' ) {
-               if ( empty($type) )
-                       $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
-
-               $this->ftp->SetType($type);
-
+       function put_contents($file, $contents, $mode = false ) {
                $temp = wp_tempnam( $file );
-               if ( ! $temphandle = fopen($temp, 'w+') ) {
+               if ( ! $temphandle = @fopen($temp, 'w+') ) {
                        unlink($temp);
                        return false;
                }
@@ -130,10 +125,16 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                fwrite($temphandle, $contents);
                fseek($temphandle, 0); //Skip back to the start of the file being written to
 
+               $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
+               $this->ftp->SetType($type);
+
                $ret = $this->ftp->fput($file, $temphandle);
 
                fclose($temphandle);
                unlink($temp);
+
+               $this->chmod($file, $mode);
+
                return $ret;
        }
 
@@ -153,7 +154,6 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        }
 
        function chmod($file, $mode = false, $recursive = false ) {
-
                if ( ! $mode ) {
                        if ( $this->is_file($file) )
                                $mode = FS_CHMOD_FILE;
@@ -163,16 +163,15 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                                return false;
                }
 
-               if ( ! $recursive || ! $this->is_dir($file) ) {
-                       return $this->ftp->chmod($file, $mode);
+               // chmod any sub-objects if recursive.
+               if ( $recursive && $this->is_dir($file) ) {
+                       $filelist = $this->dirlist($file);
+                       foreach ( (array)$filelist as $filename => $filemeta )
+                               $this->chmod($file . '/' . $filename, $mode, $recursive);
                }
 
-               //Is a directory, and we want recursive
-               $filelist = $this->dirlist($file);
-               foreach ( $filelist as $filename )
-                       $this->chmod($file . '/' . $filename, $mode, $recursive);
-
-               return true;
+               // chmod the file or directory
+               return $this->ftp->chmod($file, $mode);
        }
 
        function chown($file, $owner, $recursive = false ) {
@@ -225,7 +224,11 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        }
 
        function is_file($file) {
-               return $this->is_dir($file) ? false : true;
+               if ( $this->is_dir($file) )
+                       return false;
+               if ( $this->exists($file) )
+                       return true;
+               return false;
        }
 
        function is_dir($path) {
@@ -277,10 +280,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        }
 
        function rmdir($path, $recursive = false ) {
-               if ( ! $recursive )
-                       return $this->ftp->rmdir($path);
-
-               return $this->ftp->mdel($path);
+               $this->delete($path, $recursive);
        }
 
        function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
@@ -292,7 +292,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                }
 
                $list = $this->ftp->dirlist($path);
-               if ( ! $list )
+               if ( empty($list) && !$this->exists($path) )
                        return false;
 
                $ret = array();
index 0337658c9dca1ae8aaea252968d32ef522422037..f5a64021cd6375b15e25eaf6b06933071078ff37 100644 (file)
@@ -73,7 +73,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                else
                        $this->options['hostname'] = $opt['hostname'];
 
-               if ( isset($opt['base']) && ! empty($opt['base']) )
+               if ( ! empty($opt['base']) )
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
@@ -160,14 +160,18 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
-       function put_contents($file, $contents, $type = '' ) {
+       function put_contents($file, $contents, $mode = false ) {
                $file = ltrim($file, '/');
-               return false !== file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
+               $ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
+
+               $this->chmod($file, $mode);
+
+               return false !== $ret;
        }
 
        function cwd() {
                $cwd = $this->run_command('pwd');
-               if( $cwd )
+               if ( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
        }
@@ -235,10 +239,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function copy($source, $destination, $overwrite = false ) {
-               if( ! $overwrite && $this->exists($destination) )
+               if ( ! $overwrite && $this->exists($destination) )
                        return false;
                $content = $this->get_contents($source);
-               if( false === $content)
+               if ( false === $content)
                        return false;
                return $this->put_contents($destination, $content);
        }
diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php
new file mode 100644 (file)
index 0000000..5a7f0e4
--- /dev/null
@@ -0,0 +1,310 @@
+<?php
+/**
+ * WP_Importer base class
+ */
+class WP_Importer {
+       /**
+        * Class Constructor
+        *
+        * @return void
+        */
+       function __construct() {}
+
+       function WP_Importer() {
+               $this->__construct();
+       }
+
+       /**
+        * Returns array with imported permalinks from WordPress database
+        *
+        * @param string $bid
+        * @return array
+        */
+       function get_imported_posts( $importer_name, $bid ) {
+               global $wpdb;
+
+               $hashtable = array();
+
+               $limit = 100;
+               $offset = 0;
+
+               // Grab all posts in chunks
+               do {
+                       $meta_key = $importer_name . '_' . $bid . '_permalink';
+                       $sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit );
+                       $results = $wpdb->get_results( $sql );
+
+                       // Increment offset
+                       $offset = ( $limit + $offset );
+
+                       if ( !empty( $results ) ) {
+                               foreach ( $results as $r ) {
+                                       // Set permalinks into array
+                                       $hashtable[$r->meta_value] = intval( $r->post_id );
+                               }
+                       }
+               } while ( count( $results ) == $limit );
+
+               // unset to save memory
+               unset( $results, $r );
+
+               return $hashtable;
+       }
+
+       /**
+        * Return count of imported permalinks from WordPress database
+        *
+        * @param string $bid
+        * @return int
+        */
+       function count_imported_posts( $importer_name, $bid ) {
+               global $wpdb;
+
+               $count = 0;
+
+               // Get count of permalinks
+               $meta_key = $importer_name . '_' . $bid . '_permalink';
+               $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key );
+
+               $result = $wpdb->get_results( $sql );
+
+               if ( !empty( $result ) )
+                       $count = intval( $result[0]->cnt );
+
+               // unset to save memory
+               unset( $results );
+
+               return $count;
+       }
+
+       /**
+        * Set array with imported comments from WordPress database
+        *
+        * @param string $bid
+        * @return array
+        */
+       function get_imported_comments( $bid ) {
+               global $wpdb;
+
+               $hashtable = array();
+
+               $limit = 100;
+               $offset = 0;
+
+               // Grab all comments in chunks
+               do {
+                       $sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
+                       $results = $wpdb->get_results( $sql );
+
+                       // Increment offset
+                       $offset = ( $limit + $offset );
+
+                       if ( !empty( $results ) ) {
+                               foreach ( $results as $r ) {
+                                       // Explode comment_agent key
+                                       list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
+                                       $source_comment_id = intval( $source_comment_id );
+
+                                       // Check if this comment came from this blog
+                                       if ( $bid == $ca_bid ) {
+                                               $hashtable[$source_comment_id] = intval( $r->comment_ID );
+                                       }
+                               }
+                       }
+               } while ( count( $results ) == $limit );
+
+               // unset to save memory
+               unset( $results, $r );
+
+               return $hashtable;
+       }
+
+       function set_blog( $blog_id ) {
+               if ( is_numeric( $blog_id ) ) {
+                       $blog_id = (int) $blog_id;
+               } else {
+                       $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id );
+                       if ( ( !$parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) {
+                               fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
+                               exit();
+                       }
+                       if ( empty( $parsed['path'] ) )
+                               $parsed['path'] = '/';
+                       if ( !$blog = get_blog_info( $parsed['host'], $parsed['path'] ) ) {
+                               fwrite( STDERR, "Error: Could not find blog\n" );
+                               exit();
+                       }
+                       $blog_id = (int) $blog->blog_id;
+                       // Restore global $current_blog
+                       global $current_blog;
+                       $current_blog = $blog;
+               }
+
+               if ( function_exists( 'is_multisite' ) ) {
+                       if ( is_multisite() )
+                               switch_to_blog( $blog_id );
+               }
+
+               return $blog_id;
+       }
+
+       function set_user( $user_id ) {
+               if ( is_numeric( $user_id ) ) {
+                       $user_id = (int) $user_id;
+               } else {
+                       $user_id = (int) username_exists( $user_id );
+               }
+
+               if ( !$user_id || !wp_set_current_user( $user_id ) ) {
+                       fwrite( STDERR, "Error: can not find user\n" );
+                       exit();
+               }
+
+               return $user_id;
+       }
+
+       /**
+        * Sort by strlen, longest string first
+        *
+        * @param string $a
+        * @param string $b
+        * @return int
+        */
+       function cmpr_strlen( $a, $b ) {
+               return strlen( $b ) - strlen( $a );
+       }
+
+       /**
+        * GET URL
+        *
+        * @param string $url
+        * @param string $username
+        * @param string $password
+        * @param bool $head
+        * @return array
+        */
+       function get_page( $url, $username = '', $password = '', $head = false ) {
+               // Increase the timeout
+               add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
+
+               $headers = array();
+               $args = array();
+               if ( true === $head )
+                       $args['method'] = 'HEAD';
+               if ( !empty( $username ) && !empty( $password ) )
+                       $headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
+
+               $args['headers'] = $headers;
+
+               return wp_remote_request( $url, $args );
+       }
+
+       /**
+        * Bump up the request timeout for http requests
+        *
+        * @param int $val
+        * @return int
+        */
+       function bump_request_timeout( $val ) {
+               return 60;
+       }
+
+       /**
+        * Check if user has exceeded disk quota
+        *
+        * @return bool
+        */
+       function is_user_over_quota() {
+               global $current_user, $current_blog;
+
+               if ( function_exists( 'upload_is_user_over_quota' ) ) {
+                       if ( upload_is_user_over_quota( 1 ) ) {
+                               echo "Sorry, you have used your upload quota.\n";
+                               return true;
+                       }
+               }
+
+               return false;
+       }
+
+       /**
+        * Replace newlines, tabs, and multiple spaces with a single space
+        *
+        * @param string $string
+        * @return string
+        */
+       function min_whitespace( $string ) {
+               return preg_replace( '|[\r\n\t ]+|', ' ', $string );
+       }
+
+       /**
+        * Reset global variables that grow out of control during imports
+        *
+        * @return void
+        */
+       function stop_the_insanity() {
+               global $wpdb, $wp_actions;
+               // Or define( 'WP_IMPORTING', true );
+               $wpdb->queries = array();
+               // Reset $wp_actions to keep it from growing out of control
+               $wp_actions = array();
+       }
+}
+
+/**
+ * Returns value of command line params.
+ * Exits when a required param is not set.
+ *
+ * @param string $param
+ * @param bool $required
+ * @return mixed
+ */
+function get_cli_args( $param, $required = false ) {
+       $args = $_SERVER['argv'];
+
+       $out = array();
+
+       $last_arg = null;
+       $return = null;
+
+       $il = sizeof( $args );
+
+       for ( $i = 1, $il; $i < $il; $i++ ) {
+               if ( (bool) preg_match( "/^--(.+)/", $args[$i], $match ) ) {
+                       $parts = explode( "=", $match[1] );
+                       $key = preg_replace( "/[^a-z0-9]+/", "", $parts[0] );
+
+                       if ( isset( $parts[1] ) ) {
+                               $out[$key] = $parts[1];
+                       } else {
+                               $out[$key] = true;
+                       }
+
+                       $last_arg = $key;
+               } else if ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) {
+                       for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) {
+                               $key = $match[1]{$j};
+                               $out[$key] = true;
+                       }
+
+                       $last_arg = $key;
+               } else if ( $last_arg !== null ) {
+                       $out[$last_arg] = $args[$i];
+               }
+       }
+
+       // Check array for specified param
+       if ( isset( $out[$param] ) ) {
+               // Set return value
+               $return = $out[$param];
+       }
+
+       // Check for missing required param
+       if ( !isset( $out[$param] ) && $required ) {
+               // Display message and exit
+               echo "\"$param\" parameter is required but was not specified\n";
+               exit();
+       }
+
+       return $return;
+}
index 2be38f758e96c1cc411570582494c6b920dc9db6..0c8577e80333115b85a59b026fa9c97bf56ba494 100644 (file)
@@ -43,21 +43,22 @@ class WP_Upgrader {
        function generic_strings() {
                $this->strings['bad_request'] = __('Invalid Data provided.');
                $this->strings['fs_unavailable'] = __('Could not access filesystem.');
-               $this->strings['fs_error'] = __('Filesystem error');
+               $this->strings['fs_error'] = __('Filesystem error.');
                $this->strings['fs_no_root_dir'] = __('Unable to locate WordPress Root directory.');
                $this->strings['fs_no_content_dir'] = __('Unable to locate WordPress Content directory (wp-content).');
                $this->strings['fs_no_plugins_dir'] = __('Unable to locate WordPress Plugin directory.');
                $this->strings['fs_no_themes_dir'] = __('Unable to locate WordPress Theme directory.');
+               /* translators: %s: directory name */
                $this->strings['fs_no_folder'] = __('Unable to locate needed folder (%s).');
 
                $this->strings['download_failed'] = __('Download failed.');
-               $this->strings['installing_package'] = __('Installing the latest version.');
+               $this->strings['installing_package'] = __('Installing the latest version&#8230;');
                $this->strings['folder_exists'] = __('Destination folder already exists.');
                $this->strings['mkdir_failed'] = __('Could not create directory.');
-               $this->strings['bad_package'] = __('Incompatible Archive');
+               $this->strings['bad_package'] = __('Incompatible Archive.');
 
-               $this->strings['maintenance_start'] = __('Enabling Maintenance mode.');
-               $this->strings['maintenance_end'] = __('Disabling Maintenance mode.');
+               $this->strings['maintenance_start'] = __('Enabling Maintenance mode&#8230;');
+               $this->strings['maintenance_end'] = __('Disabling Maintenance mode&#8230;');
        }
 
        function fs_connect( $directories = array() ) {
@@ -297,6 +298,7 @@ class WP_Upgrader {
                $download = $this->download_package( $package );
                if ( is_wp_error($download) ) {
                        $this->skin->error($download);
+                       $this->skin->after();
                        return $download;
                }
 
@@ -304,6 +306,7 @@ class WP_Upgrader {
                $working_dir = $this->unpack_package( $download );
                if ( is_wp_error($working_dir) ) {
                        $this->skin->error($working_dir);
+                       $this->skin->after();
                        return $working_dir;
                }
 
@@ -366,22 +369,22 @@ class Plugin_Upgrader extends WP_Upgrader {
        function upgrade_strings() {
                $this->strings['up_to_date'] = __('The plugin is at the latest version.');
                $this->strings['no_package'] = __('Upgrade package not available.');
-               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
-               $this->strings['unpack_package'] = __('Unpacking the update.');
-               $this->strings['deactivate_plugin'] = __('Deactivating the plugin.');
-               $this->strings['remove_old'] = __('Removing the old version of the plugin.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
+               $this->strings['unpack_package'] = __('Unpacking the update&#8230;');
+               $this->strings['deactivate_plugin'] = __('Deactivating the plugin&#8230;');
+               $this->strings['remove_old'] = __('Removing the old version of the plugin&#8230;');
                $this->strings['remove_old_failed'] = __('Could not remove the old plugin.');
-               $this->strings['process_failed'] = __('Plugin upgrade Failed.');
+               $this->strings['process_failed'] = __('Plugin upgrade failed.');
                $this->strings['process_success'] = __('Plugin upgraded successfully.');
        }
 
        function install_strings() {
                $this->strings['no_package'] = __('Install package not available.');
-               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>.');
-               $this->strings['unpack_package'] = __('Unpacking the package.');
-               $this->strings['installing_package'] = __('Installing the plugin.');
-               $this->strings['process_failed'] = __('Plugin Install Failed.');
-               $this->strings['process_success'] = __('Plugin Installed successfully.');
+               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
+               $this->strings['unpack_package'] = __('Unpacking the package&#8230;');
+               $this->strings['installing_package'] = __('Installing the plugin&#8230;');
+               $this->strings['process_failed'] = __('Plugin install failed.');
+               $this->strings['process_success'] = __('Plugin installed successfully.');
        }
 
        function install($package) {
@@ -398,7 +401,7 @@ class Plugin_Upgrader extends WP_Upgrader {
                                        ));
 
                // Force refresh of plugin update information
-               delete_transient('update_plugins');
+               delete_site_transient('update_plugins');
 
        }
 
@@ -407,8 +410,9 @@ class Plugin_Upgrader extends WP_Upgrader {
                $this->init();
                $this->upgrade_strings();
 
-               $current = get_transient( 'update_plugins' );
+               $current = get_site_transient( 'update_plugins' );
                if ( !isset( $current->response[ $plugin ] ) ) {
+                       $this->skin->before();
                        $this->skin->set_result(false);
                        $this->skin->error('up_to_date');
                        $this->skin->after();
@@ -440,7 +444,7 @@ class Plugin_Upgrader extends WP_Upgrader {
                        return $this->result;
 
                // Force refresh of plugin update information
-               delete_transient('update_plugins');
+               delete_site_transient('update_plugins');
        }
 
        function bulk_upgrade($plugins) {
@@ -449,7 +453,7 @@ class Plugin_Upgrader extends WP_Upgrader {
                $this->bulk = true;
                $this->upgrade_strings();
 
-               $current = get_transient( 'update_plugins' );
+               $current = get_site_transient( 'update_plugins' );
 
                add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
 
@@ -462,17 +466,21 @@ class Plugin_Upgrader extends WP_Upgrader {
                        return false;
                }
 
+               $this->skin->bulk_header();
+
                $this->maintenance_mode(true);
 
-               $all = count($plugins);
-               $i = 1;
-               foreach ( $plugins as $plugin ) {
+               $results = array();
 
-                       $this->show_before = sprintf( '<h4>' . __('Updating plugin %1$d of %2$d...') . '</h4>', $i, $all );
-                       $i++;
+               $this->update_count = count($plugins);
+               $this->update_current = 0;
+               foreach ( $plugins as $plugin ) {
+                       $this->update_current++;
+                       $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true);
 
                        if ( !isset( $current->response[ $plugin ] ) ) {
                                $this->skin->set_result(false);
+                               $this->skin->before();
                                $this->skin->error('up_to_date');
                                $this->skin->after();
                                $results[$plugin] = false;
@@ -500,15 +508,19 @@ class Plugin_Upgrader extends WP_Upgrader {
                        // Prevent credentials auth screen from displaying multiple times
                        if ( false === $result )
                                break;
-               }
+               } //end foreach $plugins
+
                $this->maintenance_mode(false);
+
+               $this->skin->bulk_footer();
+
                $this->skin->footer();
 
                // Cleanup our hooks, incase something else does a upgrade on this connection.
                remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
 
                // Force refresh of plugin update information
-               delete_transient('update_plugins');
+               delete_site_transient('update_plugins');
 
                return $results;
        }
@@ -592,21 +604,21 @@ class Theme_Upgrader extends WP_Upgrader {
        function upgrade_strings() {
                $this->strings['up_to_date'] = __('The theme is at the latest version.');
                $this->strings['no_package'] = __('Upgrade package not available.');
-               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
-               $this->strings['unpack_package'] = __('Unpacking the update.');
-               $this->strings['remove_old'] = __('Removing the old version of the theme.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
+               $this->strings['unpack_package'] = __('Unpacking the update&#8230;');
+               $this->strings['remove_old'] = __('Removing the old version of the theme&#8230;');
                $this->strings['remove_old_failed'] = __('Could not remove the old theme.');
-               $this->strings['process_failed'] = __('Theme upgrade Failed.');
+               $this->strings['process_failed'] = __('Theme upgrade failed.');
                $this->strings['process_success'] = __('Theme upgraded successfully.');
        }
 
        function install_strings() {
                $this->strings['no_package'] = __('Install package not available.');
-               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>.');
-               $this->strings['unpack_package'] = __('Unpacking the package.');
-               $this->strings['installing_package'] = __('Installing the theme.');
-               $this->strings['process_failed'] = __('Theme Install Failed.');
-               $this->strings['process_success'] = __('Theme Installed successfully.');
+               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
+               $this->strings['unpack_package'] = __('Unpacking the package&#8230;');
+               $this->strings['installing_package'] = __('Installing the theme&#8230;');
+               $this->strings['process_failed'] = __('Theme install failed.');
+               $this->strings['process_success'] = __('Theme installed successfully.');
        }
 
        function install($package) {
@@ -627,7 +639,7 @@ class Theme_Upgrader extends WP_Upgrader {
                        return $this->result;
 
                // Force refresh of theme update information
-               delete_transient('update_themes');
+               delete_site_transient('update_themes');
 
                if ( empty($result['destination_name']) )
                        return false;
@@ -641,8 +653,9 @@ class Theme_Upgrader extends WP_Upgrader {
                $this->upgrade_strings();
 
                // Is an update available?
-               $current = get_transient( 'update_themes' );
+               $current = get_site_transient( 'update_themes' );
                if ( !isset( $current->response[ $theme ] ) ) {
+                       $this->skin->before();
                        $this->skin->set_result(false);
                        $this->skin->error('up_to_date');
                        $this->skin->after();
@@ -671,11 +684,93 @@ class Theme_Upgrader extends WP_Upgrader {
                        return $this->result;
 
                // Force refresh of theme update information
-               delete_transient('update_themes');
+               delete_site_transient('update_themes');
 
                return true;
        }
 
+       function bulk_upgrade($themes) {
+
+               $this->init();
+               $this->bulk = true;
+               $this->upgrade_strings();
+
+               $current = get_site_transient( 'update_themes' );
+
+               add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
+               add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
+               add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
+
+               $this->skin->header();
+
+               // Connect to the Filesystem first.
+               $res = $this->fs_connect( array(WP_CONTENT_DIR) );
+               if ( ! $res ) {
+                       $this->skin->footer();
+                       return false;
+               }
+
+               $this->skin->bulk_header();
+
+               $this->maintenance_mode(true);
+
+               $results = array();
+
+               $this->update_count = count($themes);
+               $this->update_current = 0;
+               foreach ( $themes as $theme ) {
+                       $this->update_current++;
+
+                       if ( !isset( $current->response[ $theme ] ) ) {
+                               $this->skin->set_result(false);
+                               $this->skin->before();
+                               $this->skin->error('up_to_date');
+                               $this->skin->after();
+                               $results[$theme] = false;
+                               continue;
+                       }
+
+                       $this->skin->theme_info = $this->theme_info($theme);
+
+                       // Get the URL to the zip file
+                       $r = $current->response[ $theme ];
+
+                       $options = array(
+                                                       'package' => $r['package'],
+                                                       'destination' => WP_CONTENT_DIR . '/themes',
+                                                       'clear_destination' => true,
+                                                       'clear_working' => true,
+                                                       'hook_extra' => array(
+                                                                                               'theme' => $theme
+                                                                                               )
+                                                       );
+
+                       $result = $this->run($options);
+
+                       $results[$theme] = $this->result;
+
+                       // Prevent credentials auth screen from displaying multiple times
+                       if ( false === $result )
+                               break;
+               } //end foreach $plugins
+
+               $this->maintenance_mode(false);
+
+               $this->skin->bulk_footer();
+
+               $this->skin->footer();
+
+               // Cleanup our hooks, incase something else does a upgrade on this connection.
+               remove_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
+               remove_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
+               remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
+
+               // Force refresh of theme update information
+               delete_site_transient('update_themes');
+
+               return $results;
+       }
+
        function current_before($return, $theme) {
 
                if ( is_wp_error($return) )
@@ -686,7 +781,8 @@ class Theme_Upgrader extends WP_Upgrader {
                if ( $theme != get_stylesheet() ) //If not current
                        return $return;
                //Change to maintainence mode now.
-               $this->maintenance_mode(true);
+               if ( ! $this->bulk )
+                       $this->maintenance_mode(true);
 
                return $return;
        }
@@ -708,7 +804,8 @@ class Theme_Upgrader extends WP_Upgrader {
                }
 
                //Time to remove maintainence mode
-               $this->maintenance_mode(false);
+               if ( ! $this->bulk )
+                       $this->maintenance_mode(false);
                return $return;
        }
 
@@ -727,10 +824,15 @@ class Theme_Upgrader extends WP_Upgrader {
                return true;
        }
 
-       function theme_info() {
-               if ( empty($this->result['destination_name']) )
-                       return false;
-               return get_theme_data(WP_CONTENT_DIR . '/themes/' . $this->result['destination_name'] . '/style.css');
+       function theme_info($theme = null) {
+
+               if ( empty($theme) ) {
+                       if ( !empty($this->result['destination_name']) )
+                               $theme = $this->result['destination_name'];
+                       else
+                               return false;
+               }
+               return get_theme_data(WP_CONTENT_DIR . '/themes/' . $theme . '/style.css');
        }
 
 }
@@ -749,8 +851,8 @@ class Core_Upgrader extends WP_Upgrader {
        function upgrade_strings() {
                $this->strings['up_to_date'] = __('WordPress is at the latest version.');
                $this->strings['no_package'] = __('Upgrade package not available.');
-               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
-               $this->strings['unpack_package'] = __('Unpacking the update.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
+               $this->strings['unpack_package'] = __('Unpacking the update&#8230;');
                $this->strings['copy_failed'] = __('Could not copy files.');
        }
 
@@ -808,6 +910,7 @@ class WP_Upgrader_Skin {
 
        var $upgrader;
        var $done_header = false;
+       var $result = false;
 
        function WP_Upgrader_Skin($args = array()) {
                return $this->__construct($args);
@@ -820,7 +923,12 @@ class WP_Upgrader_Skin {
        function set_upgrader(&$upgrader) {
                if ( is_object($upgrader) )
                        $this->upgrader =& $upgrader;
+               $this->add_strings();
        }
+
+       function add_strings() {
+       }
+
        function set_result($result) {
                $this->result = $result;
        }
@@ -891,6 +999,7 @@ class WP_Upgrader_Skin {
 class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
        var $plugin = '';
        var $plugin_active = false;
+       var $plugin_network_active = false;
 
        function Plugin_Upgrader_Skin($args = array()) {
                return $this->__construct($args);
@@ -902,19 +1011,17 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
 
                $this->plugin = $args['plugin'];
 
-               $this->plugin_active = is_plugin_active($this->plugin);
+               $this->plugin_active = is_plugin_active( $this->plugin );
+               $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
 
                parent::__construct($args);
        }
 
        function after() {
-               if ( $this->upgrader->bulk )
-                       return;
-
                $this->plugin = $this->upgrader->plugin_info();
-               if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
-                       show_message(__('Attempting reactivation of the plugin'));
-                       echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
+               if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
+                       show_message(__('Reactivating the plugin&#8230;'));
+                       echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
                }
 
                $update_actions =  array(
@@ -939,6 +1046,185 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
        }
 }
 
+/**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.0.0
+ */
+class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
+       var $in_loop = false;
+       var $error = false;
+
+       function Bulk_Upgrader_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+
+       function __construct($args = array()) {
+               $defaults = array( 'url' => '', 'nonce' => '' );
+               $args = wp_parse_args($args, $defaults);
+
+               parent::__construct($args);
+       }
+
+       function add_strings() {
+               $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take awhile on some hosts, so please be patient.');
+               $this->upgrader->strings['skin_update_failed_error'] = __('An error occured while updating %1$s: <strong>%2$s</strong>.');
+               $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
+               $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' <a onclick="%2$s" href="#" class="hide-if-no-js"><span>'.__('Show Details').'</span><span class="hidden">'.__('Hide Details').'</span>.</a>';
+               $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
+       }
+
+       function feedback($string) {
+               if ( isset( $this->upgrader->strings[$string] ) )
+                       $string = $this->upgrader->strings[$string];
+
+               if ( strpos($string, '%') !== false ) {
+                       $args = func_get_args();
+                       $args = array_splice($args, 1);
+                       if ( !empty($args) )
+                               $string = vsprintf($string, $args);
+               }
+               if ( empty($string) )
+                       return;
+               if ( $this->in_loop )
+                       echo "$string<br />\n";
+               else
+                       echo "<p>$string</p>\n";
+       }
+
+       function header() {
+               // Nothing, This will be displayed within a iframe.
+       }
+
+       function footer() {
+               // Nothing, This will be displayed within a iframe.
+       }
+       function error($error) {
+               if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
+                       $this->error = $this->upgrader->strings[$error];
+
+               if ( is_wp_error($error) ) {
+                       foreach ( $error->get_error_messages() as $emessage ) {
+                               if ( $error->get_error_data() )
+                                       $messages[] = $emessage . ' ' . $error->get_error_data();
+                               else
+                                       $messages[] = $emessage;
+                       }
+                       $this->error = implode(', ', $messages);
+               }
+               echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
+       }
+
+       function bulk_header() {
+               $this->feedback('skin_upgrade_start');
+       }
+
+       function bulk_footer() {
+               $this->feedback('skin_upgrade_end');
+       }
+
+       function before($title = '') {
+               $this->in_loop = true;
+               printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . ' <img alt="" src="' . admin_url( 'images/wpspin_light.gif' ) . '" class="hidden waiting-' . $this->upgrader->update_current . '" style="vertical-align:middle;"></h4>',  $title, $this->upgrader->update_current, $this->upgrader->update_count);
+               echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
+               echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
+               $this->flush_output();
+       }
+
+       function after($title = '') {
+               echo '</p></div>';
+               if ( $this->error || ! $this->result ) {
+                       if ( $this->error )
+                               echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '</p></div>';
+                       else
+                               echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '</p></div>';
+
+                       echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
+               }
+               if ( !empty($this->result) && !is_wp_error($this->result) ) {
+                       echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
+                       echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
+               }
+
+               $this->reset();
+               $this->flush_output();
+       }
+
+       function reset() {
+               $this->in_loop = false;
+               $this->error = false;
+       }
+
+       function flush_output() {
+               wp_ob_end_flush_all();
+               flush();
+       }
+}
+
+class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
+       var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
+       function Plugin_Upgrader_Skin($args = array()) {
+               parent::__construct($args);
+       }
+
+       function add_strings() {
+               parent::add_strings();
+               $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
+       }
+
+       function before() {
+               parent::before($this->plugin_info['Title']);
+       }
+
+       function after() {
+               parent::after($this->plugin_info['Title']);
+       }
+       function bulk_footer() {
+               parent::bulk_footer();
+               $update_actions =  array(
+                       'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>',
+                       'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+               );
+
+               $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
+               if ( ! empty($update_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
+       }
+}
+
+class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
+       var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
+       function Theme_Upgrader_Skin($args = array()) {
+               parent::__construct($args);
+       }
+
+       function add_strings() {
+               parent::add_strings();
+               $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
+       }
+
+       function before() {
+               parent::before($this->theme_info['Name']);
+       }
+
+       function after() {
+               parent::after($this->theme_info['Name']);
+       }
+       function bulk_footer() {
+               parent::bulk_footer();
+               $update_actions =  array(
+                       'themes_page' => '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Goto themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>',
+                       'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+               );
+
+               $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
+               if ( ! empty($update_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
+       }
+}
+
 /**
  * Plugin Installer Skin for WordPress Plugin Installer.
  *
@@ -975,19 +1261,30 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
 
                $plugin_file = $this->upgrader->plugin_info();
 
-               $install_actions = array(
-                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
-                                                       );
+               $install_actions = array();
 
-               if ( $this->type == 'web' )
+               $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';
+
+               if ( 'import' == $from )
+                       $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin &amp; Run Importer') . '</a>';
+               else
+                       $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
+
+               if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
+                       $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
+
+               if ( 'import' == $from )
+                       $install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
+               else if ( $this->type == 'web' )
                        $install_actions['plugins_page'] = '<a href="' . admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
                else
                        $install_actions['plugins_page'] = '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
 
 
-               if ( ! $this->result || is_wp_error($this->result) )
+               if ( ! $this->result || is_wp_error($this->result) ) {
                        unset( $install_actions['activate_plugin'] );
-
+                       unset( $install_actions['network_activate'] );
+               }
                $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
                if ( ! empty($install_actions) )
                        $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
@@ -1088,6 +1385,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
 
        function after() {
 
+               $update_actions = array();
                if ( !empty($this->upgrader->result['destination_name']) &&
                        ($theme_info = $this->upgrader->theme_info()) &&
                        !empty($theme_info) ) {
@@ -1099,10 +1397,9 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
                        $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
                        $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
 
-                       $update_actions =  array(
-                               'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
-                               'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>',
-                       );
+                       $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
+                       $update_actions['activate'] = '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
+
                        if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() )
                                unset($update_actions['preview'], $update_actions['activate']);
                }
index 26f25564a184a1707adb807035ed81a26bcf8bbd..185251a0cd5be889d6cae7437aebdc0de81b8329 100644 (file)
@@ -96,36 +96,45 @@ function get_comment_to_edit( $id ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get the number of pending comments on a post or posts
  *
  * @since unknown
  * @uses $wpdb
  *
- * @param int $post_id Post ID
- * @return unknown
+ * @param int|array $post_id Either a single Post ID or an array of Post IDs
+ * @return int|array Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs
  */
 function get_pending_comments_num( $post_id ) {
        global $wpdb;
 
        $single = false;
        if ( !is_array($post_id) ) {
-               $post_id = (array) $post_id;
+               $post_id_array = (array) $post_id;
                $single = true;
+       } else {
+               $post_id_array = $post_id;
        }
-       $post_id = array_map('intval', $post_id);
-       $post_id = "'" . implode("', '", $post_id) . "'";
-
-       $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_N );
+       $post_id_array = array_map('intval', $post_id_array);
+       $post_id_in = "'" . implode("', '", $post_id_array) . "'";
 
-       if ( empty($pending) )
-               return 0;
+       $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A );
 
-       if ( $single )
-               return $pending[0][1];
+       if ( $single ) {
+               if ( empty($pending) )
+                       return 0;
+               else
+                       return absint($pending[0]['num_comments']);
+       }
 
        $pending_keyed = array();
-       foreach ( $pending as $pend )
-               $pending_keyed[$pend[0]] = $pend[1];
+
+       // Default to zero pending for all posts in request
+       foreach ( $post_id_array as $id )
+               $pending_keyed[$id] = 0;
+
+       if ( !empty($pending) )
+               foreach ( $pending as $pend )
+                       $pending_keyed[$pend['comment_post_ID']] = absint($pend['num_comments']);
 
        return $pending_keyed;
 }
@@ -133,7 +142,7 @@ function get_pending_comments_num( $post_id ) {
 /**
  * Add avatars to relevant places in admin, or try to.
  *
- * @since unknown
+ * @since 2.5.0
  * @uses $comment
  *
  * @param string $name User name.
@@ -141,16 +150,7 @@ function get_pending_comments_num( $post_id ) {
  */
 function floated_admin_avatar( $name ) {
        global $comment;
-
-       $id = $avatar = false;
-       if ( $comment->comment_author_email )
-               $id = $comment->comment_author_email;
-       if ( $comment->user_id )
-               $id = $comment->user_id;
-
-       if ( $id )
-               $avatar = get_avatar( $id, 32 );
-
+       $avatar = get_avatar( $comment, 32 );
        return "$avatar $name";
 }
 
index 6137a93c140e90d1f705fead7d2d6641bac1f314..9b84e9fe765049b53230fe1f982f2416e4cd09b9 100644 (file)
@@ -28,8 +28,14 @@ function wp_dashboard_setup() {
        wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
 
        // Recent Comments Widget
+       if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
+               $update = true;
+               $widget_options['dashboard_recent_comments'] = array(
+                       'items' => 5,
+               );
+       }
        $recent_comments_title = __( 'Recent Comments' );
-       wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );
+       wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
 
        // 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') ) {
@@ -46,7 +52,7 @@ function wp_dashboard_setup() {
        wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
 
        // WP Plugins Widget
-       if ( current_user_can( 'activate_plugins' ) )
+       if ( current_user_can( 'install_plugins' ) )
                wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
 
        // QuickPress Widget
@@ -63,11 +69,11 @@ function wp_dashboard_setup() {
                $widget_options['dashboard_primary'] = array(
                        'link' => apply_filters( 'dashboard_primary_link',  __( 'http://wordpress.org/development/' ) ),
                        'url' => apply_filters( 'dashboard_primary_feed',  __( 'http://wordpress.org/development/feed/' ) ),
-                       'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Development Blog' ) ),
+                       'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
                        'items' => 2,
                        'show_summary' => 1,
                        'show_author' => 0,
-                       'show_date' => 1
+                       'show_date' => 1,
                );
        }
        wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' );
@@ -79,7 +85,10 @@ 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' ) ),
-                       'items' => 5
+                       'items' => 5,
+                       'show_summary' => 0,
+                       'show_author' => 0,
+                       'show_date' => 0,
                );
        }
        wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
@@ -206,8 +215,8 @@ function wp_dashboard_right_now() {
 
        $num_comm = wp_count_comments( );
 
-       echo "\n\t".'<p class="sub">' . __('At a Glance') . '</p>';
-       echo "\n\t".'<div class="table">'."\n\t".'<table>';
+       echo "\n\t".'<div class="table table_content">';
+       echo "\n\t".'<p class="sub">' . __('Content') . '</p>'."\n\t".'<table>';
        echo "\n\t".'<tr class="first">';
 
        // Posts
@@ -219,6 +228,8 @@ function wp_dashboard_right_now() {
        }
        echo '<td class="first b b-posts">' . $num . '</td>';
        echo '<td class="t posts">' . $text . '</td>';
+
+       echo '</tr><tr>';
        /* 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( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
@@ -236,31 +247,64 @@ function wp_dashboard_right_now() {
        }
        */
 
+       // Pages
+       $num = number_format_i18n( $num_pages->publish );
+       $text = _n( 'Page', 'Pages', $num_pages->publish );
+       if ( current_user_can( 'edit_pages' ) ) {
+               $num = "<a href='edit.php?post_type=page'>$num</a>";
+               $text = "<a href='edit.php?post_type=page'>$text</a>";
+       }
+       echo '<td class="first b b_pages">' . $num . '</td>';
+       echo '<td class="t pages">' . $text . '</td>';
+
+       echo '</tr><tr>';
+
+       // Categories
+       $num = number_format_i18n( $num_cats );
+       $text = _n( 'Category', 'Categories', $num_cats );
+       if ( current_user_can( 'manage_categories' ) ) {
+               $num = "<a href='edit-tags.php?taxonomy=category'>$num</a>";
+               $text = "<a href='edit-tags.php?taxonomy=category'>$text</a>";
+       }
+       echo '<td class="first b b-cats">' . $num . '</td>';
+       echo '<td class="t cats">' . $text . '</td>';
+
+       echo '</tr><tr>';
+
+       // Tags
+       $num = number_format_i18n( $num_tags );
+       $text = _n( 'Tag', 'Tags', $num_tags );
+       if ( current_user_can( 'manage_categories' ) ) {
+               $num = "<a href='edit-tags.php'>$num</a>";
+               $text = "<a href='edit-tags.php'>$text</a>";
+       }
+       echo '<td class="first b b-tags">' . $num . '</td>';
+       echo '<td class="t tags">' . $text . '</td>';
+
+       echo "</tr>";
+       do_action('right_now_content_table_end');
+       echo "\n\t</table>\n\t</div>";
+
+
+       echo "\n\t".'<div class="table table_discussion">';
+       echo "\n\t".'<p class="sub">' . __('Discussion') . '</p>'."\n\t".'<table>';
+       echo "\n\t".'<tr class="first">';
+
        // Total Comments
        $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
        $text = _n( 'Comment', 'Comments', $num_comm->total_comments );
        if ( current_user_can( 'moderate_comments' ) ) {
-               $num = "<a href='edit-comments.php'>$num</a>";
-               $text = "<a href='edit-comments.php'>$text</a>";
+               $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>';
 
        echo '</tr><tr>';
 
-       // Pages
-       $num = number_format_i18n( $num_pages->publish );
-       $text = _n( 'Page', 'Pages', $num_pages->publish );
-       if ( current_user_can( 'edit_pages' ) ) {
-               $num = "<a href='edit-pages.php'>$num</a>";
-               $text = "<a href='edit-pages.php'>$text</a>";
-       }
-       echo '<td class="first b b_pages">' . $num . '</td>';
-       echo '<td class="t pages">' . $text . '</td>';
-
        // Approved Comments
        $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
-       $text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved );
+       $text = _nx( 'Approved', 'Approved', $num_comm->approved, 'Right Now' );
        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>";
@@ -270,16 +314,6 @@ function wp_dashboard_right_now() {
 
        echo "</tr>\n\t<tr>";
 
-       // Categories
-       $num = number_format_i18n( $num_cats );
-       $text = _n( 'Category', 'Categories', $num_cats );
-       if ( current_user_can( 'manage_categories' ) ) {
-               $num = "<a href='categories.php'>$num</a>";
-               $text = "<a href='categories.php'>$text</a>";
-       }
-       echo '<td class="first b b-cats">' . $num . '</td>';
-       echo '<td class="t cats">' . $text . '</td>';
-
        // Pending Comments
        $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
        $text = _n( 'Pending', 'Pending', $num_comm->moderated );
@@ -292,19 +326,9 @@ function wp_dashboard_right_now() {
 
        echo "</tr>\n\t<tr>";
 
-       // Tags
-       $num = number_format_i18n( $num_tags );
-       $text = _n( 'Tag', 'Tags', $num_tags );
-       if ( current_user_can( 'manage_categories' ) ) {
-               $num = "<a href='edit-tags.php'>$num</a>";
-               $text = "<a href='edit-tags.php'>$text</a>";
-       }
-       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 = _n( 'Spam', 'Spam', $num_comm->spam );
+       $text = _nx( 'Spam', 'Spam', $num_comm->spam, 'comment' );
        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>";
@@ -314,6 +338,7 @@ function wp_dashboard_right_now() {
 
        echo "</tr>";
        do_action('right_now_table_end');
+       do_action('right_now_discussion_table_end');
        echo "\n\t</table>\n\t</div>";
 
        echo "\n\t".'<div class="versions">';
@@ -331,11 +356,15 @@ function wp_dashboard_right_now() {
                }
                $num = number_format_i18n( $num_widgets );
 
-               if ( current_user_can( 'switch_themes' ) ) {
+               $switch_themes = $ct->title;
+               if ( current_user_can( 'switch_themes') ) {
                        echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
-                       printf(_n('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
+                       $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
+               }
+               if ( current_user_can( 'edit_theme_options' ) ) {
+                       printf(_n('Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $switch_themes, $num);
                } else {
-                       printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
+                       printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $switch_themes, $num);
                }
        } else {
                if ( current_user_can( 'switch_themes' ) ) {
@@ -354,18 +383,20 @@ function wp_dashboard_right_now() {
        do_action( 'activity_box_end' );
 }
 
-function wp_dashboard_quick_press() {
+function wp_dashboard_quick_press_output() {
+       global $post_ID;
+
        $drafts = false;
        if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {
                $view = get_permalink( $_POST['post_ID'] );
                $edit = esc_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>', esc_url( $view ), $edit );
+                               printf( '<div class="updated"><p>' . __( 'Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_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>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
+                               printf( '<div class="updated"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
                } else {
-                       printf( '<div class="message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
+                       printf( '<div class="updated"><p>' . __( 'Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
                        $drafts_query = new WP_Query( array(
                                'post_type' => 'post',
                                'post_status' => 'draft',
@@ -378,11 +409,26 @@ function wp_dashboard_quick_press() {
                        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>' );
+               printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url( admin_url( 'tools.php' ) ) . '">' . __('Press This') . '</a>' );
                $_REQUEST = array(); // hack for get_default_post_to_edit()
        }
 
-       $post = get_default_post_to_edit();
+       /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
+       $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
+       if ( $last_post_id ) {
+               $post = get_post( $last_post_id );
+               if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
+                       $post = get_default_post_to_edit('post', true);
+                       update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
+               } else {
+                       $post->post_title = ''; // Remove the auto draft title
+               }
+       } else {
+               $post = get_default_post_to_edit('post', true);
+               update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
+       }
+
+       $post_ID = (int) $post->ID;
 ?>
 
        <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
@@ -411,15 +457,15 @@ function wp_dashboard_quick_press() {
 
                <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; ?>" />
+                       <input type="hidden" name="quickpress_post_ID" value="<?php echo $post_ID; ?>" />
+                       <input type="hidden" name="post_type" value="post" />
                        <?php wp_nonce_field('add-post'); ?>
                        <input type="submit" name="save" id="save-post" class="button" tabindex="4" value="<?php esc_attr_e('Save Draft'); ?>" />
                        <input type="reset" value="<?php esc_attr_e( 'Reset' ); ?>" class="button" />
-                       <?php if ( current_user_can('publish_posts') ) { ?>
-                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php esc_attr_e('Publish'); ?>" />
-                       <?php } else { ?>
-                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php esc_attr_e('Submit for Review'); ?>" />
-                       <?php } ?>
+                       <span id="publishing-action">
+                               <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php current_user_can('publish_posts') ? esc_attr_e('Publish') : esc_attr_e('Submit for Review'); ?>" />
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" />
+                       </span>
                        <br class="clear" />
                </p>
 
@@ -430,6 +476,10 @@ function wp_dashboard_quick_press() {
                wp_dashboard_recent_drafts( $drafts );
 }
 
+function wp_dashboard_quick_press() {
+       echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
+}
+
 function wp_dashboard_recent_drafts( $drafts = false ) {
        if ( !$drafts ) {
                $drafts_query = new WP_Query( array(
@@ -481,12 +531,18 @@ function wp_dashboard_recent_comments() {
        $comments = array();
        $start = 0;
 
+       $widgets = get_option( 'dashboard_widget_options' );
+       if ( isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] ) )
+               $total_items = (int) $widgets['dashboard_recent_comments']['items'];
+       else
+               $total_items = 5;
+
        while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
 
                foreach ( $possible as $comment ) {
-                       if ( count( $comments ) >= 5 )
+                       if ( count( $comments ) >= $total_items )
                                break;
-                       if ( in_array( $comment->comment_approved, $allowed_states ) )
+                       if ( in_array( $comment->comment_approved, $allowed_states ) && current_user_can( 'read_post', $comment->comment_post_ID ) )
                                $comments[] = $comment;
                }
 
@@ -582,7 +638,10 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
                        <?php echo get_avatar( $comment, 50 ); ?>
 
                        <div class="dashboard-comment-wrap">
-                       <h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link.' '.$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>
+                       <h4 class="comment-meta">
+                               <?php printf( /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */__( '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 :
@@ -611,6 +670,32 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
 <?php
 }
 
+/**
+ * The recent comments dashboard widget control.
+ *
+ * @since 3.0.0
+ */
+function wp_dashboard_recent_comments_control() {
+       if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+               $widget_options = array();
+
+       if ( !isset($widget_options['dashboard_recent_comments']) )
+               $widget_options['dashboard_recent_comments'] = array();
+
+       if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-recent-comments']) ) {
+               $number = (int) stripslashes($_POST['widget-recent-comments']['items']);
+               if ( $number < 1 || $number > 30 )
+                       $number = 5;
+               $widget_options['dashboard_recent_comments']['items'] = $number;
+               update_option( 'dashboard_widget_options', $widget_options );
+       }
+
+       $number = isset( $widget_options['dashboard_recent_comments']['items'] ) ? (int) $widget_options['dashboard_recent_comments']['items'] : '';
+
+       echo '<p><label for="comments-number">' . __('Number of comments to show:') . '</label>';
+       echo '<input id="comments-number" name="widget-recent-comments[items]" type="text" value="' . $number . '" size="3" /> <small>' . __( '(at most 30)' ) . '</small></p>';
+}
+
 function wp_dashboard_incoming_links() {
        echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 }
@@ -636,7 +721,7 @@ function wp_dashboard_incoming_links_output() {
 
        if ( !$rss->get_item_quantity() ) {
                echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
-               $rss->__destruct(); 
+               $rss->__destruct();
                unset($rss);
                return;
        }
@@ -691,7 +776,7 @@ function wp_dashboard_incoming_links_output() {
        }
 
        echo "</ul>\n";
-       $rss->__destruct(); 
+       $rss->__destruct();
        unset($rss);
 }
 
@@ -748,14 +833,14 @@ function wp_dashboard_secondary_output() {
                        echo '</p></div>';
                }
        } elseif ( !$rss->get_item_quantity() ) {
-               $rss->__destruct(); 
+               $rss->__destruct();
                unset($rss);
                return false;
        } else {
                echo '<div class="rss-widget">';
                wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
                echo '</div>';
-               $rss->__destruct(); 
+               $rss->__destruct();
                unset($rss);
        }
 }
@@ -839,7 +924,7 @@ function wp_dashboard_plugins_output() {
                echo "<h4>$label</h4>\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";
-               
+
                $$feed->__destruct();
                unset($$feed);
        }
@@ -938,9 +1023,9 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
                        if ( is_wp_error($rss) ) {
                                $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
                        } else {
-                               $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));     
+                               $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
                                $rss->__destruct();
-                               unset($rss);                            
+                               unset($rss);
                        }
                }
                update_option( 'dashboard_widget_options', $widget_options );
diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php
new file mode 100644 (file)
index 0000000..653cd65
--- /dev/null
@@ -0,0 +1,200 @@
+<?php
+/**
+ * Deprecated admin functions from past WordPress versions. You shouldn't use these
+ * functions and look for the alternatives instead. The functions will be removed
+ * in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+/**
+ * @since 2.1
+ * @deprecated 2.1
+ * @deprecated Use wp_tiny_mce().
+ * @see wp_tiny_mce()
+ */
+function tinymce_include() {
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_tiny_mce()' );
+
+       wp_tiny_mce();
+}
+
+/**
+ * Unused Admin function.
+ *
+ * @since 2.0
+ * @deprecated 2.5
+ *
+ */
+function documentation_link() {
+       _deprecated_function( __FUNCTION__, '2.5', '' );
+       return;
+}
+
+/**
+ * Calculates the new dimentions for a downsampled image.
+ *
+ * @since 2.0.0
+ * @deprecated 3.0.0
+ * @deprecated Use 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 ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
+       return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @deprecated unknown
+ * @deprecated Use wp_category_checklist()
+ * @see wp_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() ) {
+       _deprecated_function( __FUNCTION__, '0.0', 'wp_category_checklist()' );
+       global $post_ID;
+       wp_category_checklist( $post_ID );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @deprecated unknown
+ * @deprecated Use wp_link_category_checklist()
+ * @see wp_link_category_checklist()
+ *
+ * @param unknown_type $default
+ */
+function dropdown_link_categories( $default = 0 ) {
+       _deprecated_function( __FUNCTION__, '0.0', 'wp_link_category_checklist()' );
+       global $link_id;
+       wp_link_category_checklist( $link_id );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @deprecated 3.0.0
+ * @deprecated Use wp_dropdown_categories()
+ * @see wp_dropdown_categories()
+ *
+ * @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 ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
+       if (!$categories )
+               $categories = get_categories( array('hide_empty' => 0) );
+
+       if ( $categories ) {
+               foreach ( $categories as $category ) {
+                       if ( $currentcat != $category->term_id && $parent == $category->parent) {
+                               $pad = str_repeat( '&#8211; ', $level );
+                               $category->name = esc_html( $category->name );
+                               echo "\n\t<option value='$category->term_id'";
+                               if ( $currentparent == $category->term_id )
+                                       echo " selected='selected'";
+                               echo ">$pad$category->name</option>";
+                               wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
+                       }
+               }
+       } else {
+               return false;
+       }
+}
+
+/**
+ * Register a setting and its sanitization callback
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use register_setting()
+ * @see register_setting()
+ *
+ * @param string $option_group A settings group name.  Should correspond to a whitelisted option key name.
+ *     Default whitelisted option key names include "general," "discussion," and "reading," among others.
+ * @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 add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
+       return register_setting( $option_group, $option_name, $sanitize_callback );
+}
+
+/**
+ * Unregister a setting
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use unregister_setting()
+ * @see unregister_setting()
+ *
+ * @param unknown_type $option_group
+ * @param unknown_type $option_name
+ * @param unknown_type $sanitize_callback
+ * @return unknown
+ */
+function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
+       return unregister_setting( $option_group, $option_name, $sanitize_callback );
+}
+
+/**
+ * Determines the language to use for CodePress syntax highlighting.
+ *
+ * @since 2.8.0
+ * @deprecated 3.0.0
+ *
+ * @param string $filename
+**/
+function codepress_get_lang( $filename ) {
+       _deprecated_function( __FUNCTION__, '3.0' );
+       return;
+}
+
+/**
+ * Adds Javascript required to make CodePress work on the theme/plugin editors.
+ *
+ * @since 2.8.0
+ * @deprecated 3.0.0
+**/
+function codepress_footer_js() {
+       _deprecated_function( __FUNCTION__, '3.0' );
+       return;
+}
+
+/**
+ * Determine whether to use CodePress.
+ *
+ * @since 2.8
+ * @deprecated 3.0.0
+**/
+function use_codepress() {
+       _deprecated_function( __FUNCTION__, '3.0' );
+       return;
+}
+
+?>
\ No newline at end of file
index 921a2377d972628eaf3c47482a4a399d3c7b7f0e..345eed2056d5b515be8911eba3aad3d9c2279c44 100644 (file)
@@ -21,235 +21,260 @@ define('WXR_VERSION', '1.0');
  *
  * @since unknown
  *
- * @param unknown_type $author
+ * @param unknown_type $args
  */
-function export_wp($author='') {
-global $wpdb, $post_ids, $post, $wp_taxonomies;
+function export_wp( $args = array() ) {
+       global $wpdb, $post_ids, $post, $wp_taxonomies;
 
-do_action('export_wp');
+       if ( ! is_array( $args ) )
+               $args = array( 'author' => $args );
 
-$filename = 'wordpress.' . date('Y-m-d') . '.xml';
+       $defaults = array( 'author' => null, 'taxonomy' => null, 'post_type' => null, 'post_status' => null, 'start_date' => null, 'end_date' => null );
+       $args = wp_parse_args( $args, $defaults );
 
-header('Content-Description: File Transfer');
-header("Content-Disposition: attachment; filename=$filename");
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+       extract($args);
 
-$where = '';
-if ( $author and $author != 'all' ) {
-       $author_id = (int) $author;
-       $where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
-}
-
-// grab a snapshot of post IDs, just in case it changes during the export
-$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
-
-$categories = (array) get_categories('get=all');
-$tags = (array) get_tags('get=all');
-
-$custom_taxonomies = $wp_taxonomies;
-unset($custom_taxonomies['category']);
-unset($custom_taxonomies['post_tag']);
-unset($custom_taxonomies['link_category']);
-$custom_taxonomies = array_keys($custom_taxonomies);
-$terms = (array) get_terms($custom_taxonomies, '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();
-
-       foreach ( $categories as $category )
-               $parents[$category->term_id] = $category->parent;
-
-       $parents = array_unique(array_diff($parents, array_keys($parents)));
+       do_action('export_wp');
 
-       if ( $zero = array_search('0', $parents) )
-               unset($parents[$zero]);
+       if( strlen( $start_date ) > 4 && strlen( $end_date ) > 4 )
+               $filename = 'wordpress.' . $start_date . '.' . $end_date . '.xml';
+       else
+               $filename = 'wordpress.' . date( 'Y-m-d' ) . '.xml';
 
-       return $parents;
-}
+       header( 'Content-Description: File Transfer' );
+       header( 'Content-Disposition: attachment; filename=' . $filename );
+       header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
 
-while ( $parents = wxr_missing_parents($categories) ) {
-       $found_parents = get_categories("include=" . join(', ', $parents));
-       if ( is_array($found_parents) && count($found_parents) )
-               $categories = array_merge($categories, $found_parents);
+       if ( $post_type && $post_type != 'all' )
+               $where = $wpdb->prepare("WHERE post_type = %s ", $post_type);
        else
-               break;
-}
+               $where = "WHERE post_type != 'revision' ";
 
-// Put them in order to be inserted with no child going before its parent
-$pass = 0;
-$passes = 1000 + count($categories);
-while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
-       if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
-               $cats[$cat->term_id] = $cat;
-       } else {
-               $categories[] = $cat;
+       if ( $author && $author != 'all' ) {
+               $author_id = (int) $author;
+               $where .= $wpdb->prepare( "AND post_author = %d ", $author_id );
        }
-}
-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);
+       if ( $start_date && $start_date != 'all' )
+               $where .= $wpdb->prepare( "AND post_date >= %s ", $start_date );
 
-       // $str = ent2ncr(esc_html($str));
+       if ( $end_date && $end_date != 'all' )
+               $where .= $wpdb->prepare( "AND post_date < %s ", $end_date );
 
-       $str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
+       if ( $taxonomy && is_array( $taxonomy ) ) {
+               foreach ( $taxonomy as $term_id ) {
+                       if ( $term_id != 'all' )
+                               $where .= $wpdb->prepare( "AND ID IN (SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d) ", $term_id );
+               }
+       }
 
-       return $str;
-}
+       if ( $post_status && $post_status != 'all' )
+               $where .= $wpdb->prepare( "AND post_status = %s", $status );
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return string Site URL.
- */
-function wxr_site_url() {
-       global $current_site;
+       // grab a snapshot of post IDs, just in case it changes during the export
+       $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" );
 
-       // mu: the base url
-       if ( isset($current_site->domain) ) {
-               return 'http://'.$current_site->domain.$current_site->path;
-       }
-       // wp: the blog url
-       else {
-               return get_bloginfo_rss('url');
-       }
-}
+       $categories = (array) get_categories( array( 'get' => 'all' ) );
+       $tags = (array) get_tags( array( 'get' => 'all' ) );
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $c Category Object
- */
-function wxr_cat_name($c) {
-       if ( empty($c->name) )
-               return;
+       $custom_taxonomies = $wp_taxonomies;
+       unset( $custom_taxonomies['category'] );
+       unset( $custom_taxonomies['post_tag'] );
+       unset( $custom_taxonomies['link_category'] );
+       $custom_taxonomies = array_keys( $custom_taxonomies );
+       $terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
 
-       echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
-}
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param unknown_type $categories
+        */
+       function wxr_missing_parents( $categories ) {
+               if ( ! is_array( $categories ) || empty( $categories ) )
+                       return array();
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $c Category Object
- */
-function wxr_category_description($c) {
-       if ( empty($c->description) )
-               return;
+               foreach ( $categories as $category ){
+                       $parents[$category->term_id] = $category->parent;
+               }
 
-       echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
-}
+               $parents = array_unique( array_diff( $parents, array_keys( $parents ) ) );
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $t Tag Object
- */
-function wxr_tag_name($t) {
-       if ( empty($t->name) )
-               return;
+               if ( $zero = array_search( '0', $parents ) )
+                       unset( $parents[$zero] );
 
-       echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
-}
+               return $parents;
+       }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $t Tag Object
- */
-function wxr_tag_description($t) {
-       if ( empty($t->description) )
-               return;
+       while ( $parents = wxr_missing_parents( $categories ) ) {
+               $found_parents = get_categories( array( 'include' => join( ', ', $parents) ) );
+               if ( is_array( $found_parents ) && count( $found_parents ) )
+                       $categories = array_merge( $categories, $found_parents );
+               else
+                       break;
+       }
 
-       echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
-}
+       // Put them in order to be inserted with no child going before its parent
+       $pass = 0;
+       $passes = 1000 + count( $categories );
+       while ( ( $cat = array_shift( $categories ) ) && ++$pass < $passes ) {
+               if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
+                       $cats[$cat->term_id] = $cat;
+               else
+                       $categories[] = $cat;
+       }
+       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 );
+
+               // $str = ent2ncr(esc_html($str));
+               $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '') . "]]>";
+
+               return $str;
+       }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $t Term Object
- */
-function wxr_term_name($t) {
-       if ( empty($t->name) )
-               return;
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @return string Site URL.
+        */
+       function wxr_site_url() {
+               global $current_site;
+
+               // mu: the base url
+               if ( isset( $current_site->domain ) )
+                       return network_home_url();
+               // wp: the blog url
+               else
+                       return get_bloginfo_rss( 'url' );
+       }
 
-       echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
-}
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $c Category Object
+        */
+       function wxr_cat_name( $c ) {
+               if ( empty( $c->name ) )
+                       return;
+
+               echo '<wp:cat_name>' . wxr_cdata( $c->name ) . '</wp:cat_name>';
+       }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param object $t Term Object
- */
-function wxr_term_description($t) {
-       if ( empty($t->description) )
-               return;
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $c Category Object
+        */
+       function wxr_category_description( $c ) {
+               if ( empty( $c->description ) )
+                       return;
+
+               echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
+       }
 
-       echo '<wp:term_description>' . wxr_cdata($t->description) . '</wp:term_description>';
-}
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $t Tag Object
+        */
+       function wxr_tag_name( $t ) {
+               if ( empty( $t->name ) )
+                       return;
+
+               echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
+       }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- */
-function wxr_post_taxonomy() {
-       $categories = get_the_category();
-       $tags = get_the_tags();
-       $the_list = '';
-       $filter = 'rss';
-
-       if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
-               $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
-               // for backwards compatibility
-               $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
-               // forwards compatibility: use a unique identifier for each cat to avoid clashes
-               // http://trac.wordpress.org/ticket/5447
-               $the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n";
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $t Tag Object
+        */
+       function wxr_tag_description( $t ) {
+               if ( empty( $t->description ) )
+                       return;
+
+               echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
        }
 
-       if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
-               $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
-               $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
-               // forwards compatibility as above
-               $the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $t Term Object
+        */
+       function wxr_term_name( $t ) {
+               if ( empty( $t->name ) )
+                       return;
+
+               echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
        }
 
-       echo $the_list;
-}
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        *
+        * @param object $t Term Object
+        */
+       function wxr_term_description( $t ) {
+               if ( empty( $t->description ) )
+                       return;
+
+               echo '<wp:term_description>' . wxr_cdata($t->description) . '</wp:term_description>';
+       }
 
-echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * @since unknown
+        */
+       function wxr_post_taxonomy() {
+               global $post;
+
+               $the_list = '';
+               $filter = 'rss';
+
+               $taxonomies = get_object_taxonomies( 'post' );
+               $terms = wp_get_post_terms( $post->ID, $taxonomies );
+               foreach ( (array) $terms as $term ) {
+                       $domain = ( 'post_tag' == $term->taxonomy ) ? 'tag' : $term->taxonomy;
+                       $term_name = sanitize_term_field( 'name', $term->name, $term->term_id, $term->taxonomy, $filter );
+                       // Back compat.
+                       if ( 'category' == $term->taxonomy )
+                               $the_list .= "\n\t\t<category><![CDATA[$term_name]]></category>\n";
+                       elseif ( 'post_tag' == $term->taxonomy )
+                               $the_list .= "\n\t\t<category domain=\"$domain\"><![CDATA[$term_name]]></category>\n";
+                       // forwards compatibility as above
+                       $the_list .= "\n\t\t<category domain=\"$domain\" nicename=\"{$term->slug}\"><![CDATA[$term_name]]></category>\n";
+               }
+               echo $the_list;
+       }
 
-?>
+       echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
+
+       ?>
 <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
 <!-- It contains information about your blog's posts, comments, and categories. -->
 <!-- You may use this file to transfer that content from one site to another. -->
@@ -266,7 +291,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
 <!-- 6. WordPress will then import each of the posts, comments, and categories -->
 <!--    contained in this file into your blog -->
 
-<?php the_generator('export');?>
+<?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/"
@@ -276,101 +301,106 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
 >
 
 <channel>
-       <title><?php bloginfo_rss('name'); ?></title>
-       <link><?php bloginfo_rss('url') ?></link>
-       <description><?php bloginfo_rss("description") ?></description>
-       <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
-       <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
-       <language><?php echo get_option('rss_language'); ?></language>
+       <title><?php bloginfo_rss( 'name' ); ?></title>
+       <link><?php bloginfo_rss( 'url' ) ?></link>
+       <description><?php bloginfo_rss( 'description' ) ?></description>
+       <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ); ?></pubDate>
+       <generator>http://wordpress.org/?v=<?php bloginfo_rss( 'version' ); ?></generator>
+       <language><?php echo get_option( 'rss_language' ); ?></language>
        <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
        <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
-       <wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
-<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
-       <wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
-<?php endforeach; endif; ?>
-<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
-       <wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
-<?php endforeach; endif; ?>
-<?php if ( $terms ) : foreach ( $terms as $t ) : ?>
-       <wp:term><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $custom_taxonomies[$t->parent]->name : ''; ?></wp:term_parent><?php wxr_term_name($t); ?><?php wxr_term_description($t); ?></wp:term>
-<?php endforeach; endif; ?>
-       <?php do_action('rss2_head'); ?>
-       <?php if ($post_ids) {
-               global $wp_query;
-               $wp_query->in_the_loop = true;  // Fake being in the loop.
-               // fetch 20 posts at a time rather than loading the entire table into memory
-               while ( $next_posts = array_splice($post_ids, 0, 20) ) {
-                       $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);
-
-                       $is_sticky = 0;
-                       if ( is_sticky( $post->ID ) )
-                               $is_sticky = 1;
-
-?>
-<item>
-<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
-<link><?php the_permalink_rss() ?></link>
-<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
-<dc:creator><?php echo wxr_cdata(get_the_author()); ?></dc:creator>
-<?php wxr_post_taxonomy() ?>
-
-<guid isPermaLink="false"><?php the_guid(); ?></guid>
-<description></description>
-<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
-<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
-<wp:post_id><?php echo $post->ID; ?></wp:post_id>
-<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
-<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
-<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
-<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
-<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
-<wp:status><?php echo $post->post_status; ?></wp:status>
-<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
-<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
-<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
-<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
-<wp:is_sticky><?php echo $is_sticky; ?></wp:is_sticky>
-<?php
-if ($post->post_type == 'attachment') { ?>
-<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
-<?php } ?>
-<?php
-$postmeta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID) );
-if ( $postmeta ) {
-?>
-<?php foreach( $postmeta as $meta ) { ?>
-<wp:postmeta>
-<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
-<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
-</wp:postmeta>
-<?php } ?>
-<?php } ?>
-<?php
-$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID) );
-if ( $comments ) { foreach ( $comments as $c ) { ?>
-<wp:comment>
-<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
-<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
-<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
-<wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
-<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
-<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
-<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
-<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
-<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
-<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
-<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
-<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
-</wp:comment>
-<?php } } ?>
+       <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
+       <?php if ( $cats ) : foreach ( $cats as $c ) : ?>
+       <wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category>
+       <?php endforeach; endif; ?>
+       <?php if ( $tags ) : foreach ( $tags as $t ) : ?>
+       <wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name( $t ); ?><?php wxr_tag_description( $t ); ?></wp:tag>
+       <?php endforeach; endif; ?>
+       <?php if ( $terms ) : foreach ( $terms as $t ) : ?>
+       <wp:term><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $custom_taxonomies[$t->parent]->name : ''; ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
+       <?php endforeach; endif; ?>
+
+       <?php do_action( 'rss2_head' ); ?>
+
+       <?php if ( $post_ids ) {
+       global $wp_query;
+       $wp_query->in_the_loop = true;  // Fake being in the loop.
+
+       // fetch 20 posts at a time rather than loading the entire table into memory
+       while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
+       $where = "WHERE ID IN (" . join( ',', $next_posts ) . ")";
+       $posts = $wpdb->get_results( "SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" );
+
+       // Begin Loop
+       foreach ($posts as $post) {
+       setup_postdata( $post );
+
+       $is_sticky = 0;
+       if ( is_sticky( $post->ID ) )
+               $is_sticky = 1;
+
+       ?>
+       <item>
+               <title><?php echo apply_filters( 'the_title_rss', $post->post_title ); ?></title>
+               <link><?php the_permalink_rss() ?></link>
+               <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
+               <dc:creator><?php echo wxr_cdata( get_the_author() ); ?></dc:creator>
+               <?php wxr_post_taxonomy() ?>
+
+               <guid isPermaLink="false"><?php esc_url( the_guid() ); ?></guid>
+               <description></description>
+               <content:encoded><?php echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); ?></content:encoded>
+               <excerpt:encoded><?php echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); ?></excerpt:encoded>
+               <wp:post_id><?php echo $post->ID; ?></wp:post_id>
+               <wp:post_date><?php echo $post->post_date; ?></wp:post_date>
+               <wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
+               <wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
+               <wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
+               <wp:post_name><?php echo $post->post_name; ?></wp:post_name>
+               <wp:status><?php echo $post->post_status; ?></wp:status>
+               <wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
+               <wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
+               <wp:post_type><?php echo $post->post_type; ?></wp:post_type>
+               <wp:post_password><?php echo $post->post_password; ?></wp:post_password>
+               <wp:is_sticky><?php echo $is_sticky; ?></wp:is_sticky>
+               <?php
+               if ( $post->post_type == 'attachment' ) { ?>
+               <wp:attachment_url><?php echo wp_get_attachment_url( $post->ID ); ?></wp:attachment_url>
+               <?php } ?>
+               <?php
+               $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
+               if ( $postmeta ) {
+               ?>
+               <?php foreach( $postmeta as $meta ) { ?>
+               <wp:postmeta>
+               <wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
+               <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
+               </wp:postmeta>
+               <?php } ?>
+               <?php } ?>
+               <?php
+               $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID ) );
+               if ( $comments ) { foreach ( $comments as $c ) { ?>
+               <wp:comment>
+               <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
+               <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
+               <wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
+               <wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
+               <wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
+               <wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
+               <wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
+               <wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content>
+               <wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
+               <wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
+               <wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
+               <wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
+               </wp:comment>
+               <?php } } ?>
        </item>
-<?php } } } ?>
+       <?php
+       }
+       }
+} ?>
 </channel>
 </rss>
 <?php
index 8d83f96295ebbc705a1919d2de7bb26560357411..6994a35faaad8f7d28db0f6729addaeca6d5463a 100644 (file)
@@ -10,6 +10,7 @@
 $wp_file_descriptions = array (
        'index.php' => __( 'Main Index Template' ),
        'style.css' => __( 'Stylesheet' ),
+       'editor-style.css' => __( 'Visual Editor Stylesheet' ),
        'rtl.css' => __( 'RTL Stylesheet' ),
        'comments.php' => __( 'Comments' ),
        'comments-popup.php' => __( 'Popup Comments' ),
@@ -17,6 +18,8 @@ $wp_file_descriptions = array (
        'header.php' => __( 'Header' ),
        'sidebar.php' => __( 'Sidebar' ),
        'archive.php' => __( 'Archives' ),
+       'author.php' => __( 'Author Template' ),
+       'tag.php' => __( 'Tag Template' ),
        'category.php' => __( 'Category Template' ),
        'page.php' => __( 'Page Template' ),
        'search.php' => __( 'Search Results' ),
@@ -49,8 +52,8 @@ function get_file_description( $file ) {
        if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
                return $wp_file_descriptions[basename( $file )];
        }
-       elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) {
-               $template_data = implode( '', file( WP_CONTENT_DIR . $file ) );
+       elseif ( file_exists( $file ) && is_file( $file ) ) {
+               $template_data = implode( '', file( $file ) );
                if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
                        return _cleanup_header_comment($name[1]) . ' Page Template';
        }
@@ -109,10 +112,10 @@ function get_real_file_to_edit( $file ) {
  * @return bool|array False on failure, Else array of files
  */
 function list_files( $folder = '', $levels = 100 ) {
-       if( empty($folder) )
+       if ( empty($folder) )
                return false;
 
-       if( ! $levels )
+       if ( ! $levels )
                return false;
 
        $files = array();
@@ -122,7 +125,7 @@ function list_files( $folder = '', $levels = 100 ) {
                                continue;
                        if ( is_dir( $folder . '/' . $file ) ) {
                                $files2 = list_files( $folder . '/' . $file, $levels - 1);
-                               if( $files2 )
+                               if ( $files2 )
                                        $files = array_merge($files, $files2 );
                                else
                                        $files[] = $folder . '/' . $file . '/';
@@ -146,17 +149,29 @@ function list_files( $folder = '', $levels = 100 ) {
  * @return string Writable temporary directory
  */
 function get_temp_dir() {
+       static $temp;
        if ( defined('WP_TEMP_DIR') )
                return trailingslashit(WP_TEMP_DIR);
 
+       if ( $temp )
+               return trailingslashit($temp);
+
        $temp = WP_CONTENT_DIR . '/';
-       if ( is_dir($temp) && is_writable($temp) )
+       if ( is_dir($temp) && @is_writable($temp) )
                return $temp;
 
-       if  ( function_exists('sys_get_temp_dir') )
-               return trailingslashit(sys_get_temp_dir());
+       if  ( function_exists('sys_get_temp_dir') ) {
+               $temp = sys_get_temp_dir();
+               if ( @is_writable($temp) )
+                       return trailingslashit($temp);
+       }
+
+       $temp = ini_get('upload_tmp_dir');
+       if ( is_dir($temp) && @is_writable($temp) )
+               return trailingslashit($temp);
 
-       return '/tmp/';
+       $temp = '/tmp/';
+       return $temp;
 }
 
 /**
@@ -172,7 +187,7 @@ function get_temp_dir() {
  * @param string $dir (optional) Directory to store the file in
  * @return string a writable filename
  */
-function wp_tempnam($filename = '', $dir = ''){
+function wp_tempnam($filename = '', $dir = '') {
        if ( empty($dir) )
                $dir = get_temp_dir();
        $filename = basename($filename);
@@ -223,7 +238,7 @@ function validate_file_to_edit( $file, $allowed_files = '' ) {
  */
 function wp_handle_upload( &$file, $overrides = false, $time = null ) {
        // The default error handler.
-       if (! function_exists( 'wp_handle_upload_error' ) ) {
+       if ( ! function_exists( 'wp_handle_upload_error' ) ) {
                function wp_handle_upload_error( &$file, $message ) {
                        return array( 'error'=>$message );
                }
@@ -258,6 +273,7 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
        // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
        $test_form = true;
        $test_size = true;
+       $test_upload = true;
 
        // If you override this, you must provide $ext and $type!!!!
        $test_type = true;
@@ -269,28 +285,37 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
 
        // A correct form post will pass this test.
        if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
-               return $upload_error_handler( $file, __( 'Invalid form submission.' ));
+               return call_user_func($upload_error_handler, $file, __( 'Invalid form submission.' ));
 
        // A successful upload will pass this test. It makes no sense to override this one.
        if ( $file['error'] > 0 )
-               return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
+               return call_user_func($upload_error_handler, $file, $upload_error_strings[$file['error']] );
 
        // A non-empty file will pass this test.
-       if ( $test_size && !($file['size'] > 0 ) )
-               return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' ));
+       if ( $test_size && !($file['size'] > 0 ) ) {
+               if ( is_multisite() )
+                       $error_msg = __( 'File is empty. Please upload something more substantial.' );
+               else
+                       $error_msg = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' );
+               return call_user_func($upload_error_handler, $file, $error_msg);
+       }
 
        // A properly uploaded file will pass this test. There should be no reason to override this one.
-       if (! @ is_uploaded_file( $file['tmp_name'] ) )
-               return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
+       if ( $test_upload && ! @ is_uploaded_file( $file['tmp_name'] ) )
+               return call_user_func($upload_error_handler, $file, __( 'Specified file failed upload test.' ));
 
        // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
        if ( $test_type ) {
-               $wp_filetype = wp_check_filetype( $file['name'], $mimes );
+               $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
 
                extract( $wp_filetype );
 
+               // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
+               if ( $proper_filename )
+                       $file['name'] = $proper_filename;
+
                if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
-                       return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
+                       return call_user_func($upload_error_handler, $file, __( 'File type does not meet security guidelines. Try another.' ));
 
                if ( !$ext )
                        $ext = ltrim(strrchr($file['name'], '.'), '.');
@@ -303,15 +328,14 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
 
        // A writable uploads dir will pass this test. Again, there's no point overriding this one.
        if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
-               return $upload_error_handler( $file, $uploads['error'] );
+               return call_user_func($upload_error_handler, $file, $uploads['error'] );
 
        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
 
        // Move the file to the uploads dir
        $new_file = $uploads['path'] . "/$filename";
-       if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
+       if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
                return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
-       }
 
        // Set correct file permissions
        $stat = stat( dirname( $new_file ));
@@ -321,7 +345,10 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
        // Compute the URL
        $url = $uploads['url'] . "/$filename";
 
-       return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
+       if ( is_multisite() )
+               delete_transient( 'dirsize_cache' );
+
+       return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
 }
 
 /**
@@ -380,7 +407,7 @@ function wp_handle_sideload( &$file, $overrides = false ) {
                return $upload_error_handler( $file, __( 'Invalid form submission.' ));
 
        // A successful upload will pass this test. It makes no sense to override this one.
-       if ( $file['error'] > 0 )
+       if ( ! empty( $file['error'] ) )
                return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
 
        // A non-empty file will pass this test.
@@ -393,10 +420,14 @@ function wp_handle_sideload( &$file, $overrides = false ) {
 
        // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
        if ( $test_type ) {
-               $wp_filetype = wp_check_filetype( $file['name'], $mimes );
+               $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
 
                extract( $wp_filetype );
 
+               // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
+               if ( $proper_filename )
+                       $file['name'] = $proper_filename;
+
                if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
                        return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
 
@@ -431,7 +462,7 @@ function wp_handle_sideload( &$file, $overrides = false ) {
        // Compute the URL
        $url = $uploads['url'] . "/$filename";
 
-       $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
+       $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' );
 
        return $return;
 }
@@ -448,15 +479,15 @@ function wp_handle_sideload( &$file, $overrides = false ) {
 function download_url( $url ) {
        //WARNING: The file is not automatically deleted, The script must unlink() the file.
        if ( ! $url )
-               return new WP_Error('http_no_url', __('Invalid URL Provided'));
+               return new WP_Error('http_no_url', __('Invalid URL Provided.'));
 
        $tmpfname = wp_tempnam($url);
        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, '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.'));
 
        $response = wp_remote_get($url, array('timeout' => 300));
 
@@ -480,7 +511,7 @@ function download_url( $url ) {
 
 /**
  * Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction.
- * Assumes that WP_Filesystem() has already been called and set up.
+ * Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present.
  *
  * Attempts to increase the PHP Memory limit to 256M before uncompressing,
  * However, The most memory required shouldn't be much larger than the Archive itself.
@@ -497,10 +528,140 @@ function unzip_file($file, $to) {
        if ( ! $wp_filesystem || !is_object($wp_filesystem) )
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
-       // Unzip uses a lot of memory, but not this much hopefully
+       // Unzip can use a lot of memory, but not this much hopefully
        @ini_set('memory_limit', '256M');
 
-       $fs =& $wp_filesystem;
+       $needed_dirs = array();
+       $to = trailingslashit($to);
+
+       // Determine any parent dir's needed (of the upgrade directory)
+       if ( ! $wp_filesystem->is_dir($to) ) { //Only do parents if no children exist
+               $path = preg_split('![/\\\]!', untrailingslashit($to));
+               for ( $i = count($path); $i >= 0; $i-- ) {
+                       if ( empty($path[$i]) )
+                               continue;
+
+                       $dir = implode('/', array_slice($path, 0, $i+1) );
+                       if ( preg_match('!^[a-z]:$!i', $dir) ) // Skip it if it looks like a Windows Drive letter.
+                               continue;
+
+                       if ( ! $wp_filesystem->is_dir($dir) )
+                               $needed_dirs[] = $dir;
+                       else
+                               break; // A folder exists, therefor, we dont need the check the levels below this
+               }
+       }
+
+       if ( class_exists('ZipArchive') && apply_filters('unzip_file_use_ziparchive', true ) ) {
+               $result = _unzip_file_ziparchive($file, $to, $needed_dirs);
+               if ( true === $result ) {
+                       return $result;
+               } elseif ( is_wp_error($result) ) {
+                       if ( 'incompatible_archive' != $result->get_error_code() )
+                               return $result;
+               }
+       }
+       // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file.
+       return _unzip_file_pclzip($file, $to, $needed_dirs);
+}
+
+/**
+ * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the ZipArchive class.
+ * Assumes that WP_Filesystem() has already been called and set up.
+ *
+ * @since 3.0.0
+ * @see unzip_file
+ * @access private
+ *
+ * @param string $file Full path and filename of zip archive
+ * @param string $to Full path on the filesystem to extract archive to
+ * @param array $needed_dirs A partial list of required folders needed to be created.
+ * @return mixed WP_Error on failure, True on success
+ */
+function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
+       global $wp_filesystem;
+
+       $z = new ZipArchive();
+
+       // PHP4-compat - php4 classes can't contain constants
+       $zopen = $z->open($file, /* ZIPARCHIVE::CHECKCONS */ 4);
+       if ( true !== $zopen )
+               return new WP_Error('incompatible_archive', __('Incompatible Archive.'));
+
+       for ( $i = 0; $i < $z->numFiles; $i++ ) {
+               if ( ! $info = $z->statIndex($i) )
+                       return new WP_Error('stat_failed', __('Could not retrieve file from archive.'));
+
+               if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
+                       continue;
+
+               if ( '/' == substr($info['name'], -1) ) // directory
+                       $needed_dirs[] = $to . untrailingslashit($info['name']);
+               else
+                       $needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
+       }
+
+       $needed_dirs = array_unique($needed_dirs);
+       foreach ( $needed_dirs as $dir ) {
+               // Check the parent folders of the folders all exist within the creation array.
+               if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
+                       continue;
+               if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
+                       continue;
+
+               $parent_folder = dirname($dir);
+               while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
+                       $needed_dirs[] = $parent_folder;
+                       $parent_folder = dirname($parent_folder);
+               }
+       }
+       asort($needed_dirs);
+
+       // Create those directories if need be:
+       foreach ( $needed_dirs as $_dir ) {
+               if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the Dir exists upon creation failure. Less I/O this way.
+                       return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir);
+       }
+       unset($needed_dirs);
+
+       for ( $i = 0; $i < $z->numFiles; $i++ ) {
+               if ( ! $info = $z->statIndex($i) )
+                       return new WP_Error('stat_failed', __('Could not retrieve file from archive.'));
+
+               if ( '/' == substr($info['name'], -1) ) // directory
+                       continue;
+
+               if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
+                       continue;
+
+               $contents = $z->getFromIndex($i);
+               if ( false === $contents )
+                       return new WP_Error('extract_failed', __('Could not extract file from archive.'), $info['name']);
+
+               if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) )
+                       return new WP_Error('copy_failed', __('Could not copy file.'), $to . $info['filename']);
+       }
+
+       $z->close();
+
+       return true;
+}
+
+/**
+ * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the PclZip library.
+ * Assumes that WP_Filesystem() has already been called and set up.
+ *
+ * @since 3.0.0
+ * @see unzip_file
+ * @access private
+ *
+ * @param string $file Full path and filename of zip archive
+ * @param string $to Full path on the filesystem to extract archive to
+ * @param array $needed_dirs A partial list of required folders needed to be created.
+ * @return mixed WP_Error on failure, True on success
+ */
+function _unzip_file_pclzip($file, $to, $needed_dirs = array()) {
+       global $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
 
@@ -508,48 +669,52 @@ function unzip_file($file, $to) {
 
        // Is the archive valid?
        if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) )
-               return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true));
+               return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true));
 
        if ( 0 == count($archive_files) )
-               return new WP_Error('empty_archive', __('Empty archive'));
-
-       $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
-               }
+               return new WP_Error('empty_archive', __('Empty archive.'));
+
+       // Determine any children directories needed (From within the archive)
+       foreach ( $archive_files as $file ) {
+               if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory
+                       continue;
+
+               $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) );
        }
 
-       $to = trailingslashit($to);
-       foreach ($archive_files as $file) {
-               $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
-                       }
+       $needed_dirs = array_unique($needed_dirs);
+       foreach ( $needed_dirs as $dir ) {
+               // Check the parent folders of the folders all exist within the creation array.
+               if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
+                       continue;
+               if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
+                       continue;
+
+               $parent_folder = dirname($dir);
+               while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
+                       $needed_dirs[] = $parent_folder;
+                       $parent_folder = dirname($parent_folder);
                }
+       }
+       asort($needed_dirs);
 
-               // We've made sure the folders are there, so let's extract the file now:
-               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']);
-                       $fs->chmod($to . $file['filename'], FS_CHMOD_FILE);
-               }
+       // Create those directories if need be:
+       foreach ( $needed_dirs as $_dir ) {
+               if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the dir exists upon creation failure. Less I/O this way.
+                       return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir);
+       }
+       unset($needed_dirs);
+
+       // Extract the files from the zip
+       foreach ( $archive_files as $file ) {
+               if ( $file['folder'] )
+                       continue;
+
+               if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
+                       continue;
+
+               if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
+                       return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']);
        }
        return true;
 }
@@ -578,13 +743,13 @@ function copy_dir($from, $to) {
                                // 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);
+                                       return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename);
                        }
                        $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE);
                } elseif ( 'd' == $fileinfo['type'] ) {
                        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);
+                                       return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);
                        }
                        $result = copy_dir($from . $filename, $to . $filename);
                        if ( is_wp_error($result) )
@@ -618,7 +783,7 @@ function WP_Filesystem( $args = false, $context = false ) {
 
        if ( ! class_exists("WP_Filesystem_$method") ) {
                $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
-               if( ! file_exists($abstraction_file) )
+               if ( ! file_exists($abstraction_file) )
                        return;
 
                require_once($abstraction_file);
@@ -667,7 +832,7 @@ function WP_Filesystem( $args = false, $context = false ) {
 function get_filesystem_method($args = array(), $context = false) {
        $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets'
 
-       if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
+       if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
                if ( !$context )
                        $context = WP_CONTENT_DIR;
                $context = trailingslashit($context);
@@ -701,10 +866,11 @@ function get_filesystem_method($args = array(), $context = false) {
  * @param string $type the chosen Filesystem method in use
  * @param boolean $error if the current request has failed to connect
  * @param string $context The directory which is needed access to, The write-test will be performed on  this directory by get_filesystem_method()
+ * @param string $extra_fields Extra POST fields which should be checked for to be included in the post.
  * @return boolean False on failure. True on success.
  */
-function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) {
-       $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context);
+function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null) {
+       $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields );
        if ( '' !== $req_cred )
                return $req_cred;
 
@@ -714,6 +880,9 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
        if ( 'direct' == $type )
                return true;
 
+       if ( is_null( $extra_fields ) )
+               $extra_fields = array( 'version', 'locale' );
+
        $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
 
        // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
@@ -799,22 +968,39 @@ jQuery(function($){
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php _e('Connection Information') ?></h2>
-<p><?php _e('To perform the requested action, connection information is required.') ?></p>
-
+<p><?php
+       $label_user = __('Username');
+       $label_pass = __('Password');
+       _e('To perform the requested action, WordPress needs to access to your web server.');
+       echo ' ';
+       if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) {
+               if ( isset( $types['ssh'] ) ) {
+                       _e('Please enter your FTP or SSH credentials to proceed.');
+                       $label_user = __('FTP/SSH Username');
+                       $label_pass = __('FTP/SSH Password');
+               } else {
+                       _e('Please enter your FTP credentials to proceed.');
+                       $label_user = __('FTP Username');
+                       $label_pass = __('FTP Password');
+               }
+               echo ' ';
+       }
+       _e('If you do not remember your credentials, you should contact your web host.');
+?></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 esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
+<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> 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 esc_attr($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
+<th scope="row"><label for="username"><?php echo $label_user; ?></label></th>
+<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> 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 '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
+<th scope="row"><label for="password"><?php echo $label_pass; ?></label></th>
+<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></td>
 </tr>
 
 <?php if ( isset($types['ssh']) ) : ?>
@@ -824,7 +1010,7 @@ jQuery(function($){
 <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 echo esc_attr($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
+<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> 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>
 <?php endif; ?>
@@ -834,12 +1020,10 @@ jQuery(function($){
 <td>
 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
 <?php
-
-       $disabled = (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH) ? ' disabled="disabled"' : '';
-
+       $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
        foreach ( $types as $name => $text ) : ?>
        <label for="<?php echo esc_attr($name) ?>">
-               <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>" <?php checked($name, $connection_type); echo $disabled; ?>/>
+               <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>"<?php checked($name, $connection_type); echo $disabled; ?> />
                <?php echo $text ?>
        </label>
        <?php endforeach; ?>
@@ -848,12 +1032,12 @@ jQuery(function($){
 </tr>
 </table>
 
-<?php if ( isset( $_POST['version'] ) ) : ?>
-<input type="hidden" name="version" value="<?php echo esc_attr(stripslashes($_POST['version'])) ?>" />
-<?php endif; ?>
-<?php if ( isset( $_POST['locale'] ) ) : ?>
-<input type="hidden" name="locale" value="<?php echo esc_attr(stripslashes($_POST['locale'])) ?>" />
-<?php endif; ?>
+<?php
+foreach ( (array) $extra_fields as $field ) {
+       if ( isset( $_POST[ $field ] ) )
+               echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( stripslashes( $_POST[ $field ] ) ) . '" />';
+}
+?>
 <p class="submit">
 <input id="upgrade" name="upgrade" type="submit" class="button" value="<?php esc_attr_e('Proceed'); ?>" />
 </p>
index 457624ce3e9b1e3bd50f2b04dee6230bcf11082c..e871ae5e5811a2e6dbffb562dce2bcec9a5b3ad8 100644 (file)
@@ -39,7 +39,7 @@ function wp_image_editor($post_id, $msg = false) {
        <div class="imgedit-menu">
                <div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
 
-       // On some setups GD library does not provide imagerotate() - Ticket #11536   
+       // On some setups GD library does not provide imagerotate() - Ticket #11536
        if ( function_exists('imagerotate') ) { ?>
                <div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
                <div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
@@ -96,10 +96,10 @@ function wp_image_editor($post_id, $msg = false) {
        <div class="imgedit-group-top">
                <a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><strong><?php _e('Restore Original Image'); ?></strong></a>
                <div class="imgedit-help">
-               <p><?php _e('Discard any changes and restore the original image.'); 
+               <p><?php _e('Discard any changes and restore the original image.');
 
                if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
-                       _e(' Previously edited copies of the image will not be deleted.');
+                       echo ' '.__('Previously edited copies of the image will not be deleted.');
 
                ?></p>
                <div class="imgedit-submit">
@@ -118,7 +118,7 @@ function wp_image_editor($post_id, $msg = false) {
                <a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('(help)'); ?></a>
                <div class="imgedit-help">
                <p><?php _e('The image can be cropped by clicking on it and dragging to select the desired part. While dragging the dimensions of the selection are displayed below.'); ?></p>
-               <strong><?php _e('Keyboard shortcuts'); ?></strong>
+               <strong><?php _e('Keyboard Shortcuts'); ?></strong>
                <ul>
                <li><?php _e('Arrow: move by 10px'); ?></li>
                <li><?php _e('Shift + arrow: move by 1px'); ?></li>
@@ -453,7 +453,7 @@ function wp_restore_image($post_id) {
                $meta['file'] = _wp_relative_upload_path( $restored_file );
                $meta['width'] = $data['width'];
                $meta['height'] = $data['height'];
-               list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']);
+               list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
        }
 
@@ -598,7 +598,7 @@ function wp_save_image($post_id) {
                $meta['width'] = imagesx($img);
                $meta['height'] = imagesy($img);
 
-               list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']);
+               list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
 
                if ( $success && ('nothumb' == $target || 'all' == $target) ) {
index 903bd5fe17fc72eca02e02ebb1c2ff5cf4a2f757..44329c0131c6dd3aafaee35f387b153df99d40ff 100644 (file)
  *
  * @param mixed $file Filename of the original image, Or attachment id.
  * @param int $max_side Maximum length of a single side for the thumbnail.
+ * @param mixed $deprecated Never used.
  * @return string Thumbnail path on success, Error string on failure.
  */
 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '1.2' );
        $thumbpath = image_resize( $file, $max_side, $max_side );
        return apply_filters( 'wp_create_thumbnail', $thumbpath );
 }
@@ -38,7 +41,7 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  * @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.
+ * @return string|WP_Error|false New filepath on success, WP_Error or false 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
@@ -46,8 +49,8 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
 
        $src = wp_load_image( $src_file );
 
-       if ( !is_resource( $src ))
-               return $src;
+       if ( !is_resource( $src ) )
+               return new WP_Error( 'error_loading_image', $src, $src_file );
 
        $dst = wp_imagecreatetruecolor( $dst_w, $dst_h );
 
@@ -91,7 +94,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
                $imagesize = getimagesize( $file );
                $metadata['width'] = $imagesize[0];
                $metadata['height'] = $imagesize[1];
-               list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']);
+               list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96);
                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
 
                // Make the file path relative to the upload dir
@@ -99,13 +102,8 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
 
                // make thumbnails and other intermediate sizes
                global $_wp_additional_image_sizes;
-               $temp_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
-               if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
-                       $temp_sizes = array_merge( $temp_sizes, array_keys( $_wp_additional_image_sizes ) );
 
-               $temp_sizes = apply_filters( 'intermediate_image_sizes', $temp_sizes );
-
-               foreach ( $temp_sizes as $s ) {
+               foreach ( get_intermediate_image_sizes() as $s ) {
                        $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
                        if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
                                $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
@@ -139,62 +137,18 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
        return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
 }
 
-/**
- * Load an image from a string, if PHP supports it.
- *
- * @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 ) )
-               $file = get_attached_file( $file );
-
-       if ( ! file_exists( $file ) )
-               return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
-
-       if ( ! function_exists('imagecreatefromstring') )
-               return __('The GD image library is not installed.');
-
-       // Set artificially high because GD uses uncompressed images in memory
-       @ini_set('memory_limit', '256M');
-       $image = imagecreatefromstring( file_get_contents( $file ) );
-
-       if ( !is_resource( $image ) )
-               return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
-
-       return $image;
-}
-
 /**
  * Calculated the new dimentions for a downsampled image.
  *
  * @since 2.0.0
- * @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.
- */
-function get_udims( $width, $height) {
-       return wp_shrink_dimensions( $width, $height );
-}
-
-/**
- * Calculates the new dimentions for a downsampled image.
- *
- * @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 get_udims( $width, $height) {
+       return wp_constrain_dimensions( $width, $height, 128, 96 );
 }
 
 /**
@@ -244,10 +198,10 @@ function wp_exif_date2ts($str) {
  * @return bool|array False on failure. Image metadata array on success.
  */
 function wp_read_image_metadata( $file ) {
-       if ( !file_exists( $file ) )
+       if ( ! file_exists( $file ) )
                return false;
 
-       list(,,$sourceImageType) = getimagesize( $file );
+       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
@@ -268,39 +222,83 @@ function wp_read_image_metadata( $file ) {
 
        // 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']) ) {
-                       $iptc = iptcparse($info['APP13']);
-                       if ( !empty($iptc['2#110'][0]) ) // credit
+       if ( is_callable( 'iptcparse' ) ) {
+               getimagesize( $file, $info );
+
+               if ( ! empty( $info['APP13'] ) ) {
+                       $iptc = iptcparse( $info['APP13'] );
+
+                       // headline, "A brief synopsis of the caption."
+                       if ( ! empty( $iptc['2#105'][0] ) )
+                               $meta['title'] = utf8_encode( trim( $iptc['2#105'][0] ) );
+                       // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways."
+                       elseif ( ! empty( $iptc['2#005'][0] ) )
+                               $meta['title'] = utf8_encode( trim( $iptc['2#005'][0] ) );
+
+                       if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
+                               $caption = utf8_encode( trim( $iptc['2#120'][0] ) );
+                               if ( empty( $meta['title'] ) ) {
+                                       // Assume the title is stored in 2:120 if it's short.
+                                       if ( strlen( $caption ) < 80 )
+                                               $meta['title'] = $caption;
+                                       else
+                                               $meta['caption'] = $caption;
+                               } elseif ( $caption != $meta['title'] ) {
+                                       $meta['caption'] = $caption;
+                               }
+                       }
+
+                       if ( ! empty( $iptc['2#110'][0] ) ) // credit
                                $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
-                       elseif ( !empty($iptc['2#080'][0]) ) // byline
+                       elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
                                $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
-                       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]));
-                       if ( !empty($iptc['2#116'][0]) ) // copyright
-                               $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0]));
-                       if ( !empty($iptc['2#005'][0]) ) // title
-                               $meta['title'] = utf8_encode(trim($iptc['2#005'][0]));
+
+                       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#116'][0] ) ) // copyright
+                               $meta['copyright'] = utf8_encode( trim( $iptc['2#116'][0] ) );
                 }
        }
 
        // fetch additional info from exif if available
-       if ( is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) {
+       if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) {
                $exif = @exif_read_data( $file );
-               if (!empty($exif['FNumber']))
+
+               if ( !empty( $exif['Title'] ) )
+                       $meta['title'] = utf8_encode( trim( $exif['Title'] ) );
+
+               if ( ! empty( $exif['ImageDescription'] ) ) {
+                       if ( empty( $meta['title'] ) && strlen( $exif['ImageDescription'] ) < 80 ) {
+                               // Assume the title is stored in ImageDescription
+                               $meta['title'] = utf8_encode( trim( $exif['ImageDescription'] ) );
+                               if ( ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] )
+                                       $meta['caption'] = utf8_encode( trim( $exif['COMPUTED']['UserComment'] ) );
+                       } elseif ( trim( $exif['ImageDescription'] ) != $meta['title'] ) {
+                               $meta['caption'] = utf8_encode( trim( $exif['ImageDescription'] ) );
+                       }
+               } elseif ( ! empty( $exif['Comments'] ) && trim( $exif['Comments'] ) != $meta['title'] ) {
+                       $meta['caption'] = utf8_encode( trim( $exif['Comments'] ) );
+               }
+
+               if ( ! empty( $exif['Artist'] ) )
+                       $meta['credit'] = utf8_encode( trim( $exif['Artist'] ) );
+               elseif ( ! empty($exif['Author'] ) )
+                       $meta['credit'] = utf8_encode( trim( $exif['Author'] ) );
+
+               if ( ! empty( $exif['Copyright'] ) )
+                       $meta['copyright'] = utf8_encode( trim( $exif['Copyright'] ) );
+               if ( ! empty($exif['FNumber'] ) )
                        $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
-               if (!empty($exif['Model']))
-                       $meta['camera'] = trim( $exif['Model'] );
-               if (!empty($exif['DateTimeDigitized']))
-                       $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
-               if (!empty($exif['FocalLength']))
+               if ( ! empty($exif['Model'] ) )
+                       $meta['camera'] = utf8_encode( trim( $exif['Model'] ) );
+               if ( ! empty($exif['DateTimeDigitized'] ) )
+                       $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
+               if ( ! empty($exif['FocalLength'] ) )
                        $meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );
-               if (!empty($exif['ISOSpeedRatings']))
-                       $meta['iso'] = $exif['ISOSpeedRatings'];
-               if (!empty($exif['ExposureTime']))
+               if ( ! empty($exif['ISOSpeedRatings'] ) )
+                       $meta['iso'] = utf8_encode( trim( $exif['ISOSpeedRatings'] ) );
+               if ( ! empty($exif['ExposureTime'] ) )
                        $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
        }
 
index 6b763df4545def5a1eebe3c55b0faaadeabab4a8..45348765e30f9fd4b76596c61b2c63af6a757e25 100644 (file)
@@ -11,7 +11,7 @@ $mce_ver = "ver=$tinymce_version";
 /**
  * Retrieve list of all cacheable WP files
  *
- * Array format: file, version (optional), bool (whether to use src and set ignoreQuery)
+ * Array format: file, version (optional), bool (whether to use src and set ignoreQuery, defaults to true)
  */
 function &get_manifest() {
        global $mce_ver;
@@ -23,7 +23,6 @@ function &get_manifest() {
                array('images/align-right.png'),
                array('images/archive-link.png'),
                array('images/blue-grad.png'),
-               array('images/browse-happy.gif'),
                array('images/bubble_bg.gif'),
                array('images/bubble_bg-rtl.gif'),
                array('images/button-grad.png'),
@@ -35,7 +34,6 @@ function &get_manifest() {
                array('images/fav.png'),
                array('images/fav-arrow.gif'),
                array('images/fav-arrow-rtl.gif'),
-               array('images/fav-top.png'),
                array('images/generic.png'),
                array('images/gray-grad.png'),
                array('images/icons32.png'),
@@ -61,7 +59,6 @@ function &get_manifest() {
                array('images/no.png'),
                array('images/required.gif'),
                array('images/resize.gif'),
-               array('images/screen-options-left.gif'),
                array('images/screen-options-right.gif'),
                array('images/screen-options-right-up.gif'),
                array('images/se.png'),
@@ -71,7 +68,7 @@ function &get_manifest() {
                array('images/white-grad.png'),
                array('images/white-grad-active.png'),
                array('images/wordpress-logo.png'),
-               array('images/wp-logo.gif'),
+               array('images/wp-logo.png'),
                array('images/xit.gif'),
                array('images/yes.png'),
                array('../wp-includes/images/crystal/archive.png'),
@@ -92,70 +89,70 @@ function &get_manifest() {
 
        if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) :
        $mce = array(
-               array('../wp-includes/js/tinymce/wp-tinymce.php', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/langs/wp-langs-en.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/utils/mctabs.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/utils/validate.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/utils/form_utils.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/utils/editable_selects.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/tiny_mce_popup.js', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/themes/advanced/editor_template.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/source_editor.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/anchor.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/image.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/link.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/color_picker.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/charmap.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/color_picker.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/charmap.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/image.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/link.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/source_editor.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/js/anchor.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css', $mce_ver, true),
-               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/inlinepopups/template.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/media/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/media/js/media.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/media/media.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/media/css/content.css', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/media/css/media.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/paste/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/paste/js/pasteword.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/paste/js/pastetext.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/paste/pasteword.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/paste/blank.htm', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/paste/pastetext.htm', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/safari/editor_plugin.js', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/spellchecker/css/content.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/wordpress/css/content.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css', $mce_ver, true),
-               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css', $mce_ver, true),
-
-               array('../wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/wp-tinymce.php', $mce_ver),
+
+               array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver),
+               array('../wp-includes/js/tinymce/langs/wp-langs-en.js', $mce_ver),
+               array('../wp-includes/js/tinymce/utils/mctabs.js', $mce_ver),
+               array('../wp-includes/js/tinymce/utils/validate.js', $mce_ver),
+               array('../wp-includes/js/tinymce/utils/form_utils.js', $mce_ver),
+               array('../wp-includes/js/tinymce/utils/editable_selects.js', $mce_ver),
+               array('../wp-includes/js/tinymce/tiny_mce_popup.js', $mce_ver),
+
+               array('../wp-includes/js/tinymce/themes/advanced/editor_template.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/source_editor.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/anchor.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/image.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/link.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/color_picker.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/charmap.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/color_picker.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/charmap.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/image.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/link.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/source_editor.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/js/anchor.js', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css', $mce_ver),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/template.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/media/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/media/js/media.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/media/media.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/media/css/content.css', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/media/css/media.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/paste/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/paste/js/pasteword.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/paste/js/pastetext.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/paste/pasteword.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/paste/blank.htm', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/paste/pastetext.htm', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/safari/editor_plugin.js', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/spellchecker/css/content.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/wordpress/css/content.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css', $mce_ver),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css', $mce_ver),
+
+               array('../wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js', $mce_ver),
 
                array('../wp-includes/js/tinymce/themes/advanced/img/icons.gif'),
                array('../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg'),
index 1bfe3e2760c3a01c7da52120da91640a69193e15..405ca9f2e95f07bedbad43bf8cdb12651194fd4e 100644 (file)
@@ -177,13 +177,13 @@ win.send_to_editor('<?php echo addslashes($html); ?>');
  *
  * @since unknown
  *
- * @param unknown_type $file_id
- * @param unknown_type $post_id
- * @param unknown_type $post_data
- * @return unknown
+ * @param string $file_id Index into the {@link $_FILES} array of the upload
+ * @param int $post_id The post ID the media is associated with
+ * @param array $post_data allows you to overwrite some of the attachment
+ * @param array $overrides allows you to override the {@link wp_handle_upload()} behavior
+ * @return int the ID of the attachment
  */
-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 )) {
 
        $time = current_time('mysql');
        if ( $post = get_post($post_id) ) {
@@ -208,9 +208,9 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
 
        // use image exif/iptc data for title and caption defaults if possible
        if ( $image_meta = @wp_read_image_metadata($file) ) {
-               if ( trim($image_meta['title']) )
+               if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
                        $title = $image_meta['title'];
-               if ( trim($image_meta['caption']) )
+               if ( trim( $image_meta['caption'] ) )
                        $content = $image_meta['caption'];
        }
 
@@ -259,9 +259,9 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
 
        // use image exif/iptc data for title and caption defaults if possible
        if ( $image_meta = @wp_read_image_metadata($file) ) {
-               if ( trim($image_meta['title']) )
+               if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
                        $title = $image_meta['title'];
-               if ( trim($image_meta['caption']) )
+               if ( trim( $image_meta['caption'] ) )
                        $content = $image_meta['caption'];
        }
 
@@ -306,7 +306,8 @@ function wp_iframe($content_func /* ... */) {
 wp_enqueue_style( 'global' );
 wp_enqueue_style( 'wp-admin' );
 wp_enqueue_style( 'colors' );
-if ( 0 === strpos( $content_func, 'media' ) )
+// Check callback name for 'media'
+if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) || 0 === strpos( $content_func, 'media' ) )
        wp_enqueue_style( 'media' );
 wp_enqueue_style( 'ie' );
 ?>
@@ -350,29 +351,49 @@ if ( is_string($content_func) )
  * @since unknown
  */
 function media_buttons() {
-       global $post_ID, $temp_ID;
-       $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
+       $do_image = $do_audio = $do_video = true;
+       if ( is_multisite() ) {
+               $media_buttons = get_site_option( 'mu_media_buttons' );
+               if ( empty($media_buttons['image']) )
+                       $do_image = false;
+               if ( empty($media_buttons['audio']) )
+                       $do_audio = false;
+               if ( empty($media_buttons['video']) )
+                       $do_video = false;
+       }
+       $out = '';
+
+       if ( $do_image )
+               $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image');
+       if ( $do_video )
+               $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video');
+       if ( $do_audio )
+               $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio');
+
+       $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media');
+
        $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");
-       $image_title = __('Add an Image');
-       $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
-       $video_title = __('Add Video');
-       $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
-       $audio_title = __('Add Audio');
-       $out = <<<EOF
-
-       <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title' onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a>
-       <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title' onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a>
-       <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title' onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a>
-       <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title' onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a>
-
-EOF;
+
        printf($context, $out);
 }
 add_action( 'media_buttons', 'media_buttons' );
 
+function _media_button($title, $icon, $type) {
+       return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='add_$type' class='thickbox' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' /></a>";
+}
+
+function get_upload_iframe_src($type) {
+       global $post_ID, $temp_ID;
+       $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
+       $upload_iframe_src = add_query_arg('post_id', $uploading_iframe_ID, 'media-upload.php');
+
+       if ( 'media' != $type )
+               $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
+       $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src);
+
+       return add_query_arg('TB_iframe', true, $upload_iframe_src);
+}
+
 /**
  * {@internal Missing Short Description}}
  *
@@ -408,7 +429,7 @@ function media_upload_form_handler() {
 
                $post = apply_filters('attachment_fields_to_save', $post, $attachment);
 
-               if ( isset($attachment['image_alt']) && !empty($attachment['image_alt']) ) {
+               if ( isset($attachment['image_alt']) ) {
                        $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
                        if ( $image_alt != stripslashes($attachment['image_alt']) ) {
                                $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true );
@@ -447,8 +468,9 @@ function media_upload_form_handler() {
 
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
-                       if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
-                               $rel = " rel='attachment wp-att-" . esc_attr($send_id)."'";
+                       $rel = '';
+                       if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'] )
+                               $rel = " rel='attachment wp-att-" . esc_attr($send_id) . "'";
                        $html = "<a href='{$attachment['url']}'$rel>$html</a>";
                }
 
@@ -819,7 +841,7 @@ function image_align_input_fields( $post, $checked = '' ) {
 function image_size_input_fields( $post, $check = '' ) {
 
                // 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'));
+               $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'));
 
                if ( empty($check) )
                        $check = get_user_setting('imgsize', 'medium');
@@ -843,12 +865,12 @@ function image_size_input_fields( $post, $check = '' ) {
                                $checked = " checked='checked'";
                        }
 
-                       $html = "<div class='image-size-item'><input type='radio' " . ( $enabled ? '' : "disabled='disabled' " ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
+                       $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
 
                        $html .= "<label for='{$css_id}'>$label</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 .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
 
                        $html .= '</div>';
 
@@ -912,7 +934,7 @@ function image_attachment_fields_to_edit($form_fields, $post) {
 
                $form_fields['image_alt'] = array(
                        'value' => $alt,
-                       'label' => __('Alternate text'),
+                       'label' => __('Alternate Text'),
                        'helps' => __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;')
                );
 
@@ -1019,6 +1041,8 @@ function get_attachment_fields_to_edit($post, $errors = null) {
 
        $edit_post = sanitize_post($post, 'edit');
 
+
+
        $form_fields = array(
                'post_title'   => array(
                        'label'      => __('Title'),
@@ -1096,6 +1120,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
  * @return string
  */
 function get_media_items( $post_id, $errors ) {
+       $attachments = array();
        if ( $post_id ) {
                $post = get_post($post_id);
                if ( $post && $post->post_type == 'attachment' )
@@ -1131,38 +1156,38 @@ function get_media_items( $post_id, $errors ) {
 function get_media_item( $attachment_id, $args = null ) {
        global $redir_tab;
 
-       if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
+       if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
                $thumb_url = $thumb_url[0];
        else
-               return false;
+               $thumb_url = false;
+
+       $post = get_post( $attachment_id );
 
-       $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );
+       $default_args = array( 'errors' => null, 'send' => post_type_supports(get_post_type($post->post_parent), 'editor'), 'delete' => true, 'toggle' => true, 'show_title' => true );
        $args = wp_parse_args( $args, $default_args );
        extract( $args, EXTR_SKIP );
 
-       $toggle_on = __('Show');
-       $toggle_off = __('Hide');
+       $toggle_on  = __( 'Show' );
+       $toggle_off = __( 'Hide' );
 
-       $post = get_post($attachment_id);
+       $filename = basename( $post->guid );
+       $title = esc_attr( $post->post_title );
 
-       $filename = basename($post->guid);
-       $title = esc_attr($post->post_title);
-
-       if ( $_tags = get_the_tags($attachment_id) ) {
+       if ( $_tags = get_the_tags( $attachment_id ) ) {
                foreach ( $_tags as $tag )
                        $tags[] = $tag->name;
-               $tags = esc_attr(join(', ', $tags));
+               $tags = esc_attr( join( ', ', $tags ) );
        }
 
        $post_mime_types = get_post_mime_types();
-       $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
-       $type = array_shift($keys);
+       $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
+       $type = array_shift( $keys );
        $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
 
-       $form_fields = get_attachment_fields_to_edit($post, $errors);
+       $form_fields = get_attachment_fields_to_edit( $post, $errors );
 
        if ( $toggle ) {
-               $class = empty($errors) ? 'startclosed' : 'startopen';
+               $class = empty( $errors ) ? 'startclosed' : 'startopen';
                $toggle_links = "
        <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
        <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
@@ -1172,35 +1197,37 @@ 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 = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt($display_title, 60) . "</span></div>" : '';
+       $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
 
-       $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
+       $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
        $order = '';
 
        foreach ( $form_fields as $key => $val ) {
                if ( 'menu_order' == $key ) {
                        if ( $gallery )
-                               $order = '<div class="menu_order"> <input class="menu_order_input" type="text" id="attachments['.$attachment_id.'][menu_order]" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" /></div>';
+                               $order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ). "' /></div>";
                        else
-                               $order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';
+                               $order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
 
-                       unset($form_fields['menu_order']);
+                       unset( $form_fields['menu_order'] );
                        break;
                }
        }
 
        $media_dims = '';
-       $meta = wp_get_attachment_metadata($post->ID);
-       if ( is_array($meta) && array_key_exists('width', $meta) && array_key_exists('height', $meta) )
-               $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
-       $media_dims = apply_filters('media_meta', $media_dims, $post);
+       $meta = wp_get_attachment_metadata( $post->ID );
+       if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
+               $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+       $media_dims = apply_filters( 'media_meta', $media_dims, $post );
 
        $image_edit_button = '';
-       if ( gd_edit_image_support($post->post_mime_type) ) {
-               $nonce = wp_create_nonce("image_editor-$post->ID");
-               $image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open($post->ID, \"$nonce\")' class='button' value='" . esc_attr__( 'Edit image' ) . "' /> <img src='images/wpspin_light.gif' class='imgedit-wait-spin' alt='' />";
+       if ( gd_edit_image_support( $post->post_mime_type ) ) {
+               $nonce = wp_create_nonce( "image_editor-$post->ID" );
+               $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <img src='" . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . "' class='imgedit-wait-spin' alt='' />";
        }
 
+       $attachment_url = get_permalink( $attachment_id );
+
        $item = "
        $type_html
        $toggle_links
@@ -1208,18 +1235,23 @@ function get_media_item( $attachment_id, $args = null ) {
        $display_title
        <table class='slidetoggle describe $class'>
                <thead class='media-item-info' id='media-head-$post->ID'>
-               <tr>
-                       <td class='A1B1' id='thumbnail-head-$post->ID' rowspan='5'><img class='thumbnail' src='$thumb_url' alt='' /></td>
-                       <td><strong>" . __('File name:') . "</strong> $filename</td>
-               </tr>
-               <tr><td><strong>" . __('File type:') . "</strong> $post->post_mime_type</td></tr>
-               <tr><td><strong>" . __('Upload date:') . "</strong> " . mysql2date( get_option('date_format'), $post->post_date ) . "</td></tr>\n";
+               <tr valign='top'>
+                       <td class='A1B1' id='thumbnail-head-$post->ID'>
+                       <p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' style='margin-top: 3px' /></a></p>
+                       <p>$image_edit_button</p>
+                       </td>
+                       <td>
+                       <p><strong>" . __('File name:') . "</strong> $filename</p>
+                       <p><strong>" . __('File type:') . "</strong> $post->post_mime_type</p>
+                       <p><strong>" . __('Upload date:') . "</strong> " . mysql2date( get_option('date_format'), $post->post_date ). '</p>';
+                       if ( !empty( $media_dims ) )
+                               $item .= "<p><strong>" . __('Dimensions:') . "</strong> $media_dims</p>\n";
+
+                       $item .= "</td></tr>\n";
+
 
-       if ( !empty($media_dims) )
-               $item .= "<tr><td><strong>" . __('Dimensions:') . "</strong> $media_dims</td></tr>\n";
 
        $item .= "
-               <tr><td class='A1B1'>$image_edit_button</td></tr>
                </thead>
                <tbody>
                <tr><td colspan='2' class='imgedit-response' id='imgedit-response-$post->ID'></td></tr>
@@ -1234,13 +1266,18 @@ function get_media_item( $attachment_id, $args = null ) {
 
        if ( $send )
                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
-       if ( $delete && current_user_can('delete_post', $attachment_id) ) {
+       if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
                if ( !EMPTY_TRASH_DAYS ) {
-                       $delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>";
+                       $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Delete Permanently' ) . '</a>';
                } elseif ( !MEDIA_TRASH ) {
-                       $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a> <div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"button\">" . __('Continue') . "</a> <a href=\"#\" class=\"button\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div>";
+                       $delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a>
+                        <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'>" . sprintf( __( 'You are about to delete <strong>%s</strong>.' ), $filename ) . "
+                        <a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
+                        <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a>
+                        </div>";
                } else {
-                       $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo') . "</a>";
+                       $delete = "<a href='" . wp_nonce_url( "post.php?action=trash&amp;post=$attachment_id", 'trash-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
+                       <a href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$attachment_id", 'untrash-attachment_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>";
                }
        } else {
                $delete = '';
@@ -1249,14 +1286,16 @@ function get_media_item( $attachment_id, $args = null ) {
        $thumbnail = '';
        $calling_post_id = 0;
        if ( isset( $_GET['post_id'] ) )
-               $calling_post_id = $_GET['post_id'];
+               $calling_post_id = absint( $_GET['post_id'] );
        elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set
                $calling_post_id = $post->post_parent;
-       if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id )
-               $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
+       if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
+               $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
+               $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
+       }
 
-       if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) )
-               $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n");
+       if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) )
+               $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n" );
 
        $hidden_fields = array();
 
@@ -1264,12 +1303,12 @@ function get_media_item( $attachment_id, $args = null ) {
                if ( $id{0} == '_' )
                        continue;
 
-               if ( !empty($field['tr']) ) {
+               if ( !empty( $field['tr'] ) ) {
                        $item .= $field['tr'];
                        continue;
                }
 
-               $field = array_merge($defaults, $field);
+               $field = array_merge( $defaults, $field );
                $name = "attachments[$attachment_id][$id]";
 
                if ( $field['input'] == 'hidden' ) {
@@ -1277,30 +1316,30 @@ function get_media_item( $attachment_id, $args = null ) {
                        continue;
                }
 
-               $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
+               $required      = $field['required'] ? '<span class="alignright"><abbr title="required" class="required">*</abbr></span>' : '';
                $aria_required = $field['required'] ? " aria-required='true' " : '';
                $class  = $id;
                $class .= $field['required'] ? ' form-required' : '';
 
-               $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
-               if ( !empty($field[$field['input']]) )
-                       $item .= $field[$field['input']];
+               $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label></th>\n\t\t\t<td class='field'>";
+               if ( !empty( $field[ $field['input'] ] ) )
+                       $item .= $field[ $field['input'] ];
                elseif ( $field['input'] == 'textarea' ) {
-                       $item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . esc_html( $field['value'] ) . "</textarea>";
+                       $item .= "<textarea type='text' id='$name' name='$name' $aria_required>" . esc_html( $field['value'] ) . '</textarea>';
                } else {
-                       $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'" . $aria_required . "/>";
+                       $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "' $aria_required />";
                }
-               if ( !empty($field['helps']) )
-                       $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
+               if ( !empty( $field['helps'] ) )
+                       $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
                $item .= "</td>\n\t\t</tr>\n";
 
                $extra_rows = array();
 
-               if ( !empty($field['errors']) )
-                       foreach ( array_unique((array) $field['errors']) as $error )
+               if ( !empty( $field['errors'] ) )
+                       foreach ( array_unique( (array) $field['errors'] ) as $error )
                                $extra_rows['error'][] = $error;
 
-               if ( !empty($field['extra_rows']) )
+               if ( !empty( $field['extra_rows'] ) )
                        foreach ( $field['extra_rows'] as $class => $rows )
                                foreach ( (array) $rows as $html )
                                        $extra_rows[$class][] = $html;
@@ -1310,7 +1349,7 @@ function get_media_item( $attachment_id, $args = null ) {
                                $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
        }
 
-       if ( !empty($form_fields['_final']) )
+       if ( !empty( $form_fields['_final'] ) )
                $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
        $item .= "\t</tbody>\n";
        $item .= "\t</table>\n";
@@ -1318,11 +1357,10 @@ function get_media_item( $attachment_id, $args = null ) {
        foreach ( $hidden_fields as $name => $value )
                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
 
-       if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) {
+       if ( $post->post_parent < 1 && isset( $_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";
+               $item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='$parent' />\n";
        }
 
        return $item;
@@ -1356,12 +1394,22 @@ function media_upload_form( $errors = null ) {
 
        // If Mac and mod_security, no Flash. :(
        $flash = true;
-       if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
+       if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') )
                $flash = false;
 
        $flash = apply_filters('flash_uploader', $flash);
        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
 
+       $upload_size_unit = $max_upload_size =  wp_max_upload_size();
+       $sizes = array( 'KB', 'MB', 'GB' );
+       for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ )
+               $upload_size_unit /= 1024;
+       if ( $u < 0 ) {
+               $upload_size_unit = 0;
+               $u = 0;
+       } else {
+               $upload_size_unit = (int) $upload_size_unit;
+       }
 ?>
 <script type="text/javascript">
 //<![CDATA[
@@ -1383,21 +1431,27 @@ jQuery(document).ready(function($){
        <?php echo $errors['upload_error']->get_error_message(); ?>
 <?php } ?>
 </div>
+<?php
+// Check quota for this blog if multisite
+if ( is_multisite() && !is_upload_space_available() ) {
+       echo '<p>' . sprintf( __( 'Sorry, you have filled your storage quota (%s MB).' ), get_space_allowed() ) . '</p>';
+       return;
+}
 
-<?php do_action('pre-upload-ui'); ?>
+do_action('pre-upload-ui');
 
-<?php if ( $flash ) : ?>
+if ( $flash ) : ?>
 <script type="text/javascript">
 //<![CDATA[
 var swfu;
 SWFUpload.onload = function() {
        var settings = {
-                       button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
-                       button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
-                       button_height: "24",
+                       button_text: '<span class="button"><?php _e('Select Files'); ?><\/span>',
+                       button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }',
+                       button_height: "23",
                        button_width: "132",
-                       button_text_top_padding: 2,
-                       button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
+                       button_text_top_padding: 3,
+                       button_image_url: '<?php echo includes_url('images/upload.png?ver=20100531'); ?>',
                        button_placeholder_id: "flash-browse-button",
                        upload_url : "<?php echo esc_attr( $flash_action_url ); ?>",
                        flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
@@ -1405,14 +1459,14 @@ SWFUpload.onload = function() {
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
                        post_params : {
                                "post_id" : "<?php echo $post_id; ?>",
-                               "auth_cookie" : "<?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?>",
+                               "auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
                                "logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
                                "_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
                                "type" : "<?php echo $type; ?>",
                                "tab" : "<?php echo $tab; ?>",
                                "short" : "1"
                        },
-                       file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
+                       file_size_limit : "<?php echo $max_upload_size; ?>b",
                        file_dialog_start_handler : fileDialogStart,
                        file_queued_handler : fileQueued,
                        upload_start_handler : uploadStart,
@@ -1435,7 +1489,7 @@ SWFUpload.onload = function() {
 //]]>
 </script>
 
-<div id="flash-upload-ui">
+<div id="flash-upload-ui" class="hide-if-no-js">
 <?php do_action('pre-flash-upload-ui'); ?>
 
        <div>
@@ -1443,6 +1497,7 @@ SWFUpload.onload = function() {
        <div id="flash-browse-button"></div>
        <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /></span>
        </div>
+       <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p>
 <?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>
@@ -1455,6 +1510,7 @@ SWFUpload.onload = function() {
        <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
        </p>
        <div class="clear"></div>
+       <p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p>
        <?php if ( is_lighttpd_before_150() ): ?>
        <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
        <?php endif;?>
@@ -1476,7 +1532,7 @@ SWFUpload.onload = function() {
 function media_upload_type_form($type = 'file', $errors = null, $id = null) {
        media_upload_header();
 
-       $post_id = intval($_REQUEST['post_id']);
+       $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
 
        $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);
@@ -1518,6 +1574,7 @@ if ( $id ) {
 <p class="savebutton ml-submit">
 <input type="submit" class="button" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
 </p>
+</form>
 <?php
 }
 
@@ -1598,7 +1655,7 @@ var addExtImage = {
                document.getElementById('go_button').style.color = '#bbb';
                if ( ! document.forms[0].src.value )
                        document.getElementById('status_img').innerHTML = '*';
-               else document.getElementById('status_img').innerHTML = '<img src="images/no.png" alt="" />';
+               else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';
        },
 
        updateImageData : function() {
@@ -1607,7 +1664,7 @@ var addExtImage = {
                t.width = t.preloadImg.width;
                t.height = t.preloadImg.height;
                document.getElementById('go_button').style.color = '#333';
-               document.getElementById('status_img').innerHTML = '<img src="images/yes.png" alt="" />';
+               document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';
        },
 
        getImageData : function() {
@@ -1617,7 +1674,7 @@ var addExtImage = {
                        t.resetImageData();
                        return false;
                }
-               document.getElementById('status_img').innerHTML = '<img src="images/wpspin_light.gif" alt="" />';
+               document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />';
                t.preloadImg = new Image();
                t.preloadImg.onload = t.updateImageData;
                t.preloadImg.onerror = t.resetImageData;
@@ -1677,7 +1734,7 @@ jQuery(function($){
 <?php _e('Sort Order:'); ?>
 <a href="#" id="asc"><?php _e('Ascending'); ?></a> |
 <a href="#" id="desc"><?php _e('Descending'); ?></a> |
-<a href="#" id="clear"><?php echo _x('Clear', 'verb'); ?></a>
+<a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a>
 </div>
 <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
 <?php wp_nonce_field('media-form'); ?>
@@ -1758,22 +1815,22 @@ jQuery(function($){
        </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>
+                       <option value="2">2</option>
+                       <option value="3" selected="selected">3</option>
+                       <option value="4">4</option>
+                       <option value="5">5</option>
+                       <option value="6">6</option>
+                       <option value="7">7</option>
+                       <option value="8">8</option>
+                       <option value="9">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 esc_attr_e( 'Insert gallery' ); ?>" />
-<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
 </p>
 </div>
 </form>
@@ -1803,7 +1860,7 @@ function media_upload_library_form($errors) {
        $start = ( $_GET['paged'] - 1 ) * 10;
        if ( $start < 1 )
                $start = 0;
-       add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );
+       add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
 
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
 
@@ -1950,7 +2007,6 @@ jQuery(function($){
  * @return unknown
  */
 function type_url_form_image() {
-
        if ( !apply_filters( 'disable_captions', '' ) ) {
                $caption = '
                <tr>
@@ -2019,13 +2075,7 @@ function type_url_form_image() {
                        <button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
                        <p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
                </tr>
-
-               <tr>
-                       <td></td>
-                       <td>
-                               <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
-                       </td>
-               </tr>
+       ' . _insert_into_post_button('image') . '
        </tbody></table>
 ';
 
@@ -2056,12 +2106,7 @@ function type_url_form_audio() {
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
-               <tr>
-                       <td></td>
-                       <td>
-                               <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
-                       </td>
-               </tr>
+       ' . _insert_into_post_button('audio') . '
        </tbody></table>
 ';
 }
@@ -2091,12 +2136,7 @@ function type_url_form_video() {
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8220;') . '</td></tr>
-               <tr>
-                       <td></td>
-                       <td>
-                               <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
-                       </td>
-               </tr>
+       ' . _insert_into_post_button('video') . '
        </tbody></table>
 ';
 }
@@ -2126,14 +2166,34 @@ function type_url_form_file() {
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</td></tr>
+       ' . _insert_into_post_button('file') . '
+       </tbody></table>
+';
+}
+
+
+function _insert_into_post_button($type) {
+       if ( !post_type_supports(get_post_type($_GET['post_id']), 'editor') )
+               return '';
+
+       if ( 'image' == $type )
+       return '
+               <tr>
+                       <td></td>
+                       <td>
+                               <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
+                       </td>
+               </tr>
+       ';
+
+       return '
                <tr>
                        <td></td>
                        <td>
                                <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
                        </td>
                </tr>
-       </tbody></table>
-';
+       ';
 }
 
 /**
@@ -2171,7 +2231,7 @@ function media_upload_flash_bypass() {
  * @since unknown
  */
 function media_upload_html_bypass($flash = true) {
-       echo '<p class="upload-html-bypass">';
+       echo '<p class="upload-html-bypass hide-if-no-js">';
        _e('You are using the Browser uploader.');
        if ( $flash ) {
                // the user manually selected the browser uploader, so let them switch back to Flash
@@ -2215,4 +2275,3 @@ add_action('media_upload_file', 'media_upload_file');
 add_filter('media_upload_gallery', 'media_upload_gallery');
 
 add_filter('media_upload_library', 'media_upload_library');
-
index d5e9cb7e82bf863198291a98dd0432499591a77f..0f8b339b26513da8aedf81fa9a303416c52d961b 100644 (file)
@@ -13,7 +13,8 @@ function post_submit_meta_box($post) {
        global $action;
 
        $post_type = $post->post_type;
-       $can_publish = current_user_can("publish_${post_type}s");
+       $post_type_object = get_post_type_object($post_type);
+       $can_publish = current_user_can($post_type_object->cap->publish_posts);
 ?>
 <div class="submitbox" id="submitpost">
 
@@ -69,8 +70,12 @@ switch ( $post->post_status ) {
                _e('Pending Review');
                break;
        case 'draft':
+       case 'auto-draft':
                _e('Draft');
                break;
+       case 'auto-draft':
+               _e('Unsaved');
+               break;
 }
 ?>
 </span>
@@ -78,7 +83,7 @@ switch ( $post->post_status ) {
 <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 esc_attr($post->post_status); ?>" />
+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $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>
@@ -88,7 +93,11 @@ switch ( $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 if ( 'auto-draft' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+<?php else : ?>
 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+<?php endif; ?>
 </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>
@@ -184,20 +193,18 @@ if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
 <?php do_action('post_submitbox_start'); ?>
 <div id="delete-action">
 <?php
-if ( current_user_can( "delete_${post_type}", $post->ID ) ) {
-       if ( !EMPTY_TRASH_DAYS ) {
-               $delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID) ), "delete-${post_type}_{$post->ID}" );
+if ( current_user_can( "delete_post", $post->ID ) ) {
+       if ( !EMPTY_TRASH_DAYS )
                $delete_text = __('Delete Permanently');
-       } else {
-               $delete_url = wp_nonce_url( add_query_arg( array('action' => 'trash', 'post' => $post->ID) ), "trash-${post_type}_{$post->ID}" );
+       else
                $delete_text = __('Move to Trash');
-       ?>
-<a class="submitdelete deletion<?php if ( 'edit' != $action ) { echo " hidden"; } ?>" href="<?php echo $delete_url; ?>"><?php echo $delete_text; ?></a><?php
+       ?>
+<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
 } ?>
 </div>
 
 <div id="publishing-action">
-<img src="images/wpspin_light.gif" id="ajax-loading" style="visibility:hidden;" alt="" />
+<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" id="ajax-loading" style="visibility:hidden;" alt="" />
 <?php
 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
        if ( $can_publish ) :
@@ -235,26 +242,38 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0
  * @param object $post
  */
 function post_tags_meta_box($post, $box) {
-       $tax_name = esc_attr(substr($box['id'], 8));
-       $taxonomy = get_taxonomy($tax_name);
-       $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
+       $defaults = array('taxonomy' => 'post_tag');
+       if ( !isset($box['args']) || !is_array($box['args']) )
+               $args = array();
+       else
+               $args = $box['args'];
+       extract( wp_parse_args($args, $defaults), EXTR_SKIP );
+       $tax_name = esc_attr($taxonomy);
+       $taxonomy = get_taxonomy($taxonomy);
+       $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : '';
 ?>
 <div class="tagsdiv" id="<?php echo $tax_name; ?>">
        <div class="jaxtag">
        <div class="nojs-tags hide-if-js">
-       <p><?php _e('Add or remove tags'); ?></p>
-       <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
-
+       <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p>
+       <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php echo $disabled; ?>><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
+       <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
        <div class="ajaxtag hide-if-no-js">
                <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
-               <div class="taghint"><?php _e('Add new tag'); ?></div>
-               <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
-               <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
-       </div></div>
-       <p class="howto"><?php echo $helps; ?></p>
+               <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
+               <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
+               <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /></p>
+       </div>
+       <p class="howto"><?php echo esc_attr( $taxonomy->labels->separate_items_with_commas ); ?></p>
+       <?php endif; ?>
+       </div>
        <div class="tagchecklist"></div>
 </div>
-<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
+<?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
+<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>
+<?php else : ?>
+<p><em><?php _e('You cannot modify this taxonomy.'); ?></em></p>
+<?php endif; ?>
 <?php
 }
 
@@ -266,38 +285,65 @@ function post_tags_meta_box($post, $box) {
  *
  * @param object $post
  */
-function post_categories_meta_box($post) {
-?>
-<ul id="category-tabs">
-       <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
-       <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
-</ul>
-
-<div id="categories-pop" class="tabs-panel" style="display: none;">
-       <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
-<?php $popular_ids = wp_popular_terms_checklist('category'); ?>
-       </ul>
-</div>
-
-<div id="categories-all" class="tabs-panel">
-       <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-<?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="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
-       <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
-       <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
-<?php  wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
-       <span id="category-ajax-response"></span></p>
-</div>
-<?php
-endif;
-
+function post_categories_meta_box( $post, $box ) {
+       $defaults = array('taxonomy' => 'category');
+       if ( !isset($box['args']) || !is_array($box['args']) )
+               $args = array();
+       else
+               $args = $box['args'];
+       extract( wp_parse_args($args, $defaults), EXTR_SKIP );
+       $tax = get_taxonomy($taxonomy);
+
+       ?>
+       <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
+               <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
+                       <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
+                       <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
+               </ul>
+
+               <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
+                       <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
+                               <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>
+                       </ul>
+               </div>
+
+               <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
+                       <?php
+            $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
+            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
+            ?>
+                       <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">
+                               <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>
+                       </ul>
+               </div>
+       <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?>
+       <p><em><?php _e('You cannot modify this taxonomy.'); ?></em></p>
+       <?php endif; ?>
+       <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
+                       <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
+                               <h4>
+                                       <a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3">
+                                               <?php
+                                                       /* translators: %s: add new taxonomy label */
+                                                       printf( __( '+ %s' ), $tax->labels->add_new_item );
+                                               ?>
+                                       </a>
+                               </h4>
+                               <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
+                                       <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?></label>
+                                       <input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/>
+                                       <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent">
+                                               <?php echo $tax->labels->parent_item_colon; ?>
+                                       </label>
+                                       <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;', 'tab_index' => 3 ) ); ?>
+                                       <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" />
+                                       <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>
+                                       <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
+                               </p>
+                       </div>
+               <?php endif; ?>
+       </div>
+       <?php
 }
 
 
@@ -336,7 +382,7 @@ function post_trackback_meta_box($post) {
 
 ?>
 <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>
+<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites 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;
@@ -375,12 +421,24 @@ function post_comment_status_meta_box($post) {
 ?>
 <input name="advanced_view" type="hidden" value="1" />
 <p class="meta-options">
-       <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /><?php _e('Allow Comments.') ?></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 printf( __('Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.'),_x('http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments','Url to codex article on Managing Comments')); ?></label>
+       <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><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 printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label>
 </p>
 <?php
 }
 
+/**
+ * Display comments for post table header
+ *
+ * @since 3.0.0
+ *
+ * @param $result table header rows
+ * @return
+ */
+function post_comment_meta_box_thead($result) {
+       unset($result['cb'], $result['response']);
+       return $result;
+}
 
 /**
  * Display comments for post.
@@ -400,23 +458,23 @@ function post_comment_meta_box($post) {
        }
 
        wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
+       add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
 ?>
 
 <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 /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
+       <?php print_column_headers('edit-comments'); ?>
 </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/wpspin_light.gif" alt="" /></p>
+<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>
 <?php
        $hidden = get_hidden_meta_boxes('post');
        if ( ! in_array('commentsdiv', $hidden) ) { ?>
                <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
 <?php
        }
+       remove_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead');
        wp_comment_trashnotice();
 }
 
@@ -474,25 +532,31 @@ function post_revisions_meta_box($post) {
  *
  * @param object $post
  */
-function page_attributes_meta_box($post){
+function page_attributes_meta_box($post) {
+       $post_type_object = get_post_type_object($post->post_type);
+       if ( $post_type_object->hierarchical ) {
+               $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));
+               if ( ! empty($pages) ) {
 ?>
-<h5><?php _e('Parent') ?></h5>
-<label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label>
-<?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
-<p><?php _e('You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
+<p><strong><?php _e('Parent') ?></strong></p>
+<label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
+<?php echo $pages; ?>
 <?php
-       if ( 0 != count( get_page_templates() ) ) { ?>
-<h5><?php _e('Template') ?></h5>
+               } // end empty pages check
+       } // end hierarchical check.
+       if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {
+               $template = !empty($post->page_template) ? $post->page_template : false;
+               ?>
+<p><strong><?php _e('Template') ?></strong></p>
 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
 <option value='default'><?php _e('Default Template'); ?></option>
-<?php page_template_dropdown($post->page_template); ?>
+<?php page_template_dropdown($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="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
-<p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in.'); ?></p>
+<p><strong><?php _e('Order') ?></strong></p>
+<p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
+<p><?php if ( 'page' == $post->post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p>
 <?php
 }
 
@@ -567,7 +631,7 @@ if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('m
  * @param object $link
  */
 function link_categories_meta_box($link) { ?>
-<ul id="category-tabs">
+<ul id="category-tabs" class="category-tabs">
        <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
        <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
 </ul>
@@ -614,13 +678,13 @@ function link_target_meta_box($link) { ?>
 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
 <p><label for="link_target_blank" class="selectit">
 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
-<?php _e('<code>_blank</code> - new window or tab.'); ?></label></p>
+<?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
 <p><label for="link_target_top" class="selectit">
 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
-<?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p>
+<?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
 <p><label for="link_target_none" class="selectit">
 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
-<?php _e('<code>_none</code> - same window or tab.'); ?></label></p>
+<?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
 </fieldset>
 <p><?php _e('Choose the target frame for your link.'); ?></p>
 <?php
@@ -634,11 +698,14 @@ function link_target_meta_box($link) { ?>
  *
  * @param string $class
  * @param string $value
- * @param mixed $deprecated Not used.
+ * @param mixed $deprecated Never used.
  */
-function xfn_check($class, $value = '', $deprecated = '') {
+function xfn_check( $class, $value = '', $deprecated = '' ) {
        global $link;
 
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented
+
        $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
        $rels = preg_split('/\s+/', $link_rel);
 
@@ -684,13 +751,13 @@ function link_xfn_meta_box($link) {
                                        <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>
                                        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>
                                                <label for="contact">
-                                               <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
                                                <label for="acquaintance">
-                                               <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance'); ?> />  <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
                                                <label for="friend">
-                                               <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
                                                <label for="friendship">
-                                               <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
+                                               <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
@@ -716,13 +783,13 @@ function link_xfn_meta_box($link) {
                                        <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>
                                        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
                                                <label for="co-resident">
-                                               <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>
                                                <label for="neighbor">
-                                               <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>
                                                <label for="geographical">
-                                               <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
@@ -730,22 +797,22 @@ function link_xfn_meta_box($link) {
                                        <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>
                                        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
                                                <label for="child">
-                                               <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
+                                               <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child'); ?>  />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>
                                                <label for="kin">
-                                               <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
+                                               <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin'); ?>  />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>
                                                <label for="parent">
-                                               <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>
                                                <label for="sibling">
-                                               <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>
                                                <label for="spouse">
-                                               <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>
                                                <label for="family">
-                                               <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
+                                               <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />
                                                <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
index 96bcab3e3d9b4f66d058372a32ef71a5b9e212c6..1ecb3a05ca07830cac491bc1fff7d650b8dac2ab 100644 (file)
@@ -120,12 +120,15 @@ function insert_with_markers( $filename, $marker, $insertion ) {
  * @since unknown
  */
 function save_mod_rewrite_rules() {
+       if ( is_multisite() )
+               return;
+
        global $wp_rewrite;
 
        $home_path = get_home_path();
        $htaccess_file = $home_path.'.htaccess';
 
-       // If the file doesn't already exists check for write access to the directory and whether of not we have some rules.
+       // If the file doesn't already exist check for write access to the directory and whether we have some rules.
        // else check for write access to the file.
        if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
                if ( got_mod_rewrite() ) {
@@ -227,26 +230,28 @@ function url_shorten( $url ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Resets global variables based on $_GET and $_POST
+ *
+ * This function resets global variables based on the names passed
+ * in the $vars array to the value of $_POST[$var] or $_GET[$var] or ''
+ * if neither is defined.
  *
  * @since unknown
  *
- * @param unknown_type $vars
+ * @param array $vars An array of globals to reset.
  */
 function wp_reset_vars( $vars ) {
        for ( $i=0; $i<count( $vars ); $i += 1 ) {
                $var = $vars[$i];
                global $$var;
 
-               if (!isset( $$var ) ) {
-                       if ( empty( $_POST["$var"] ) ) {
-                               if ( empty( $_GET["$var"] ) )
-                                       $$var = '';
-                               else
-                                       $$var = $_GET["$var"];
-                       } else {
-                               $$var = $_POST["$var"];
-                       }
+               if ( empty( $_POST[$var] ) ) {
+                       if ( empty( $_GET[$var] ) )
+                               $$var = '';
+                       else
+                               $$var = $_GET[$var];
+               } else {
+                       $$var = $_POST[$var];
                }
        }
 }
@@ -259,13 +264,15 @@ function wp_reset_vars( $vars ) {
  * @param unknown_type $message
  */
 function show_message($message) {
-       if( is_wp_error($message) ){
-               if( $message->get_error_data() )
+       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";
+       wp_ob_end_flush_all();
+       flush();
 }
 
 function wp_doc_link_parse( $content ) {
@@ -305,76 +312,6 @@ function wp_doc_link_parse( $content ) {
        return $out;
 }
 
-/**
- * Determines the language to use for CodePress syntax highlighting,
- * based only on a filename.
- *
- * @since 2.8
- *
- * @param string $filename The name of the file to be highlighting
-**/
-function codepress_get_lang( $filename ) {
-       $codepress_supported_langs = apply_filters( 'codepress_supported_langs',
-                                                                       array( '.css' => 'css',
-                                                                                       '.js' => 'javascript',
-                                                                                       '.php' => 'php',
-                                                                                       '.html' => 'html',
-                                                                                       '.htm' => 'html',
-                                                                                       '.txt' => 'text'
-                                                                                       ) );
-       $extension = substr( $filename, strrpos( $filename, '.' ) );
-       if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) )
-               return $codepress_supported_langs[$extension];
-
-       return 'generic';
-}
-
-/**
- * Adds Javascript required to make CodePress work on the theme/plugin editors.
- *
- * This code is attached to the action admin_print_footer_scripts.
- *
- * @since 2.8
-**/
-function codepress_footer_js() {
-       // Script-loader breaks CP's automatic path-detection, thus CodePress.path
-       // CP edits in an iframe, so we need to grab content back into normal form
-       ?><script type="text/javascript">
-/* <![CDATA[ */
-var codepress_path = '<?php echo includes_url('js/codepress/'); ?>';
-jQuery('#template').submit(function(){
-       if (jQuery('#newcontent_cp').length)
-               jQuery('#newcontent_cp').val(newcontent.getCode()).removeAttr('disabled');
-});
-jQuery('#codepress-on').hide();
-jQuery('#codepress-off').show();
-/* ]]> */
-</script>
-<?php
-}
-
-/**
- * Determine whether to use CodePress or not.
- *
- * @since 2.8
-**/
-function use_codepress() {
-
-       if ( isset($_GET['codepress']) ) {
-               $on = 'on' == $_GET['codepress'] ? 'on' : 'off';
-               set_user_setting( 'codepress', $on );
-       } else {
-               $on = get_user_setting('codepress', 'on');
-       }
-
-       if ( 'on' == $on ) {
-               add_action( 'admin_print_footer_scripts', 'codepress_footer_js' );
-               return true;
-       }
-
-       return false;
-}
-
 /**
  * Saves option for number of rows when listing posts, pages, comments, etc.
  *
@@ -395,12 +332,21 @@ function set_screen_options() {
 
                $option = str_replace('-', '_', $option);
 
-               switch ( $option ) {
+               $map_option = $option;
+               $type = str_replace('edit_', '', $map_option);
+               $type = str_replace('_per_page', '', $type);
+               if ( in_array($type, get_post_types()) )
+                       $map_option = 'edit_per_page';
+               if ( in_array( $type, get_taxonomies()) )
+                       $map_option = 'edit_tags_per_page';
+
+
+               switch ( $map_option ) {
                        case 'edit_per_page':
-                       case 'edit_pages_per_page':
+                       case 'ms_sites_per_page':
+                       case 'ms_users_per_page':
                        case 'edit_comments_per_page':
                        case 'upload_per_page':
-                       case 'categories_per_page':
                        case 'edit_tags_per_page':
                        case 'plugins_per_page':
                                $value = (int) $value;
@@ -414,7 +360,7 @@ function set_screen_options() {
                                break;
                }
 
-               update_usermeta($user->ID, $option, $value);
+               update_user_meta($user->ID, $option, $value);
                wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
                exit;
        }
@@ -474,7 +420,7 @@ function iis7_rewrite_rule_exists($filename) {
        if ( $doc->load($filename) === false )
                return false;
        $xpath = new DOMXPath($doc);
-       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
        if ( $rules->length == 0 )
                return false;
        else
@@ -503,7 +449,7 @@ function iis7_delete_rewrite_rule($filename) {
        if ( $doc -> load($filename) === false )
                return false;
        $xpath = new DOMXPath($doc);
-       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
        if ( $rules->length > 0 ) {
                $child = $rules->item(0);
                $parent = $child->parentNode;
@@ -543,7 +489,7 @@ function iis7_add_rewrite_rule($filename, $rewrite_rule) {
        $xpath = new DOMXPath($doc);
 
        // First check if the rule already exists as in that case there is no need to re-add it
-       $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
        if ( $wordpress_rules->length > 0 )
                return true;
 
@@ -639,4 +585,33 @@ function win_is_writable($path) {
         unlink($path);
     return true;
 }
+
+/**
+ * Display the default admin color scheme picker (Used in user-edit.php)
+ *
+ * @since 3.0.0
+ */
+function admin_color_scheme_picker() {
+       global $_wp_admin_css_colors, $user_id; ?>
+<fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
+<?php
+$current_color = get_user_option('admin_color', $user_id);
+if ( empty($current_color) )
+       $current_color = 'fresh';
+foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
+<div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo esc_attr($color) ?>" class="tog" <?php checked($color, $current_color); ?> />
+       <table class="color-palette">
+       <tr>
+       <?php foreach ( $color_info->colors as $html_color ): ?>
+       <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>
+       <?php endforeach; ?>
+</fieldset>
+<?php
+}
 ?>
diff --git a/wp-admin/includes/ms-deprecated.php b/wp-admin/includes/ms-deprecated.php
new file mode 100644 (file)
index 0000000..e7b017b
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Deprecated multisite admin functions from past WordPress versions and WordPress MU.
+ * You shouldn't use these functions and look for the alternatives instead. The functions
+ * will be removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @since 3.0.0
+ */
+
+/**
+ * @deprecated 3.0.0
+ */
+function wpmu_menu() {
+       _deprecated_function(__FUNCTION__, '3.0' );
+       // deprecated. See #11763
+}
+
+/**
+  * Determines if the available space defined by the admin has been exceeded by the user.
+  *
+  * @deprecated 3.0.0
+  * @see is_upload_space_available()
+ */
+function wpmu_checkAvailableSpace() {
+       _deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()' );
+
+       if ( !is_upload_space_available() )
+               wp_die( __('Sorry, you must delete files before you can upload any more.') );
+}
+
+/**
+ * @deprecated 3.0.0
+ */
+function mu_options( $options ) {
+       _deprecated_function(__FUNCTION__, '3.0' );
+       return $options;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see activate_plugin()
+ */
+function activate_sitewide_plugin() {
+       _deprecated_function(__FUNCTION__, '3.0', 'activate_plugin()' );
+       return false;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see deactivate_sitewide_plugin()
+ */
+function deactivate_sitewide_plugin( $plugin = false ) {
+       _deprecated_function(__FUNCTION__, '3.0', 'deactivate_plugin()' );
+       return;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see is_network_only_plugin()
+ */
+function is_wpmu_sitewide_plugin( $file ) {
+       _deprecated_function(__FUNCTION__, '3.0', 'is_network_only_plugin()' );
+       return is_network_only_plugin( $file );
+}
+
+?>
\ No newline at end of file
diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php
new file mode 100644 (file)
index 0000000..ae23b7f
--- /dev/null
@@ -0,0 +1,897 @@
+<?php
+/**
+ * Multisite administration functions.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/**
+ * Determine if uploaded file exceeds space quota.
+ *
+ * @since 3.0.0
+ *
+ * @param array $file $_FILES array for a given file.
+ * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
+ */
+function check_upload_size( $file ) {
+       if ( get_site_option( 'upload_space_check_disabled' ) )
+               return $file;
+
+       if ( $file['error'] != '0' ) // there's already an error
+               return $file;
+
+       if ( defined( 'WP_IMPORTING' ) )
+               return $file;
+
+       $space_allowed = 1048576 * get_space_allowed();
+       $space_used = get_dirsize( BLOGUPLOADDIR );
+       $space_left = $space_allowed - $space_used;
+       $file_size = filesize( $file['tmp_name'] );
+       if ( $space_left < $file_size )
+               $file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ($file_size - $space_left) /1024 ) );
+       if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
+               $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s KB in size.'), get_site_option( 'fileupload_maxk', 1500 ) );
+       if ( upload_is_user_over_quota( false ) ) {
+               $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
+       }
+       if ( $file['error'] != '0' && !isset($_POST['html-upload']) )
+               wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
+
+       return $file;
+}
+add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
+
+/**
+ * Delete a blog
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ * @param bool $drop True if blog's table should be dropped.  Default is false.
+ * @return void
+ */
+function wpmu_delete_blog( $blog_id, $drop = false ) {
+       global $wpdb;
+
+       $switch = false;
+       if ( $blog_id != $wpdb->blogid ) {
+               $switch = true;
+               switch_to_blog( $blog_id );
+       }
+
+       $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
+
+       do_action( 'delete_blog', $blog_id, $drop );
+
+       $users = get_users_of_blog( $blog_id );
+
+       // Remove users from this blog.
+       if ( ! empty( $users ) ) {
+               foreach ( $users as $user ) {
+                       remove_user_from_blog( $user->user_id, $blog_id) ;
+               }
+       }
+
+       update_blog_status( $blog_id, 'deleted', 1 );
+
+       if ( $drop ) {
+               if ( substr( $blog_prefix, -1 ) == '_' )
+                       $blog_prefix =  substr( $blog_prefix, 0, -1 ) . '\_';
+
+               $drop_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A );
+               $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
+
+               reset( $drop_tables );
+               foreach ( (array) $drop_tables as $drop_table) {
+                       $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" );
+               }
+               $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
+               $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
+               $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
+               $top_dir = $dir;
+               $stack = array($dir);
+               $index = 0;
+
+               while ( $index < count( $stack ) ) {
+                       # Get indexed directory from stack
+                       $dir = $stack[$index];
+
+                       $dh = @opendir( $dir );
+                       if ( $dh ) {
+                               while ( ( $file = @readdir( $dh ) ) !== false ) {
+                                       if ( $file == '.' || $file == '..' )
+                                               continue;
+
+                                       if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) )
+                                               $stack[] = $dir . DIRECTORY_SEPARATOR . $file;
+                                       else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) )
+                                               @unlink( $dir . DIRECTORY_SEPARATOR . $file );
+                               }
+                       }
+                       $index++;
+               }
+
+               $stack = array_reverse( $stack );  // Last added dirs are deepest
+               foreach( (array) $stack as $dir ) {
+                       if ( $dir != $top_dir)
+                       @rmdir( $dir );
+               }
+       }
+
+       $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '{$blog_prefix}autosave_draft_ids'" );
+       $blogs = get_site_option( 'blog_list' );
+       if ( is_array( $blogs ) ) {
+               foreach ( $blogs as $n => $blog ) {
+                       if ( $blog['blog_id'] == $blog_id )
+                               unset( $blogs[$n] );
+               }
+               update_site_option( 'blog_list', $blogs );
+       }
+
+       if ( $switch === true )
+               restore_current_blog();
+}
+
+// @todo Merge with wp_delete_user() ?
+function wpmu_delete_user( $id ) {
+       global $wpdb;
+
+       $id = (int) $id;
+
+       do_action( 'wpmu_delete_user', $id );
+
+       $blogs = get_blogs_of_user( $id );
+
+       if ( ! empty( $blogs ) ) {
+               foreach ( $blogs as $blog ) {
+                       switch_to_blog( $blog->userblog_id );
+                       remove_user_from_blog( $id, $blog->userblog_id );
+
+                       $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
+                       foreach ( (array) $post_ids as $post_id ) {
+                               wp_delete_post( $post_id );
+                       }
+
+                       // Clean links
+                       $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
+
+                       if ( $link_ids ) {
+                               foreach ( $link_ids as $link_id )
+                                       wp_delete_link( $link_id );
+                       }
+
+                       restore_current_blog();
+               }
+       }
+
+       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) );
+       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
+
+       clean_user_cache( $id );
+
+       // allow for commit transaction
+       do_action( 'deleted_user', $id );
+
+       return true;
+}
+
+function confirm_delete_users( $users ) {
+       global $current_user;
+       if ( !is_array( $users ) )
+               return false;
+
+    screen_icon();
+    ?>
+       <h2><?php esc_html_e( 'Users' ); ?></h2>
+       <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
+       <form action="ms-edit.php?action=dodelete" method="post">
+       <input type="hidden" name="dodelete" />
+    <?php
+       wp_nonce_field( 'ms-users-delete' );
+       $site_admins = get_super_admins();
+       $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
+
+       foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
+               if ( $val != '' && $val != '0' ) {
+                       $delete_user = new WP_User( $val );
+
+                       if ( in_array( $delete_user->user_login, $site_admins ) )
+                               wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
+
+                       echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
+                       $blogs = get_blogs_of_user( $val, true );
+
+                       if ( !empty( $blogs ) ) {
+                               ?>
+                               <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
+                               <?php
+                               foreach ( (array) $blogs as $key => $details ) {
+                                       $blog_users = get_users_of_blog( $details->userblog_id );
+                                       if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
+                                               $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
+                                               $user_dropdown = "<select name='blog[$val][{$key}]'>";
+                                               $user_list = '';
+                                               foreach ( $blog_users as $user ) {
+                                                       if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
+                                                               $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
+                                               }
+                                               if ( '' == $user_list )
+                                                       $user_list = $admin_out;
+                                               $user_dropdown .= $user_list;
+                                               $user_dropdown .= "</select>\n";
+                                               ?>
+                                               <ul style="list-style:none;">
+                                                       <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
+                                                       <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
+                                                       <?php _e( 'Delete all posts and links.' ); ?></label></li>
+                                                       <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
+                                                       <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
+                                               </ul>
+                                               <?php
+                                       }
+                               }
+                               echo "</fieldset>";
+                       }
+               }
+       }
+       ?>
+       <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
+       </form>
+    <?php
+       return true;
+}
+
+function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
+       $themes = get_themes();
+
+       if ( $blog_id != 0 )
+               switch_to_blog( $blog_id );
+
+       $blog_allowed_themes = get_option( 'allowedthemes' );
+       if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
+               $blog_allowed_themes = get_option( 'allowed_themes' );
+
+               if ( is_array( $blog_allowed_themes ) ) {
+                       foreach( (array) $themes as $key => $theme ) {
+                               $theme_key = esc_html( $theme['Stylesheet'] );
+                               if ( isset( $blog_allowed_themes[$key] ) == true ) {
+                                       $blog_allowedthemes[$theme_key] = 1;
+                               }
+                       }
+                       $blog_allowed_themes = $blog_allowedthemes;
+                       add_option( 'allowedthemes', $blog_allowed_themes );
+                       delete_option( 'allowed_themes' );
+               }
+       }
+
+       if ( $blog_id != 0 )
+               restore_current_blog();
+
+       return $blog_allowed_themes;
+}
+
+function update_option_new_admin_email( $old_value, $value ) {
+       $email = get_option( 'admin_email' );
+       if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
+               return;
+
+       $hash = md5( $value. time() .mt_rand() );
+       $new_admin_email = array(
+               'hash' => $hash,
+               'newemail' => $value
+       );
+       update_option( 'adminhash', $new_admin_email );
+
+       $content = apply_filters( 'new_admin_email_content', __( "Dear user,
+
+You recently requested to have the administration email address on
+your site changed.
+If this is correct, please click on the following link to change it:
+###ADMIN_URL###
+
+You can safely ignore and delete this email if you do not want to
+take this action.
+
+This email has been sent to ###EMAIL###
+
+Regards,
+All at ###SITENAME###
+###SITEURL### "), $new_admin_email );
+
+       $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
+       $content = str_replace( '###EMAIL###', $value, $content );
+       $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
+       $content = str_replace( '###SITEURL###', network_home_url(), $content );
+
+       wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content );
+}
+add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
+add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
+
+function send_confirmation_on_profile_email() {
+       global $errors, $wpdb, $current_user;
+       if ( ! is_object($errors) )
+               $errors = new WP_Error();
+
+       if ( $current_user->id != $_POST['user_id'] )
+               return false;
+
+       if ( $current_user->user_email != $_POST['email'] ) {
+               if ( !is_email( $_POST['email'] ) ) {
+                       $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
+                       return;
+               }
+
+               if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
+                       $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) );
+                       delete_option( $current_user->ID . '_new_email' );
+                       return;
+               }
+
+               $hash = md5( $_POST['email'] . time() . mt_rand() );
+               $new_user_email = array(
+                               'hash' => $hash,
+                               'newemail' => $_POST['email']
+                               );
+               update_option( $current_user->ID . '_new_email', $new_user_email );
+
+               $content = apply_filters( 'new_user_email_content', __( "Dear user,
+
+You recently requested to have the email address on your account changed.
+If this is correct, please click on the following link to change it:
+###ADMIN_URL###
+
+You can safely ignore and delete this email if you do not want to
+take this action.
+
+This email has been sent to ###EMAIL###
+
+Regards,
+All at ###SITENAME###
+###SITEURL###" ), $new_user_email );
+
+               $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
+               $content = str_replace( '###EMAIL###', $_POST['email'], $content);
+               $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
+               $content = str_replace( '###SITEURL###', network_home_url(), $content );
+
+               wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content );
+               $_POST['email'] = $current_user->user_email;
+       }
+}
+add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
+
+function new_user_email_admin_notice() {
+       global $current_user;
+       if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )
+               echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
+}
+add_action( 'admin_notices', 'new_user_email_admin_notice' );
+
+function get_site_allowed_themes() {
+       $themes = get_themes();
+       $allowed_themes = get_site_option( 'allowedthemes' );
+       if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
+               $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format
+               if ( !is_array( $allowed_themes ) ) {
+                       $allowed_themes = array();
+               } else {
+                       foreach( (array) $themes as $key => $theme ) {
+                               $theme_key = esc_html( $theme['Stylesheet'] );
+                               if ( isset( $allowed_themes[ $key ] ) == true ) {
+                                       $allowedthemes[ $theme_key ] = 1;
+                               }
+                       }
+                       $allowed_themes = $allowedthemes;
+               }
+       }
+       return $allowed_themes;
+}
+
+/**
+ * Determines if there is any upload space left in the current blog's quota.
+ *
+ * @since 3.0.0
+ * @return bool True if space is available, false otherwise.
+ */
+function is_upload_space_available() {
+       if ( get_site_option( 'upload_space_check_disabled' ) )
+               return true;
+
+       if ( !( $space_allowed = get_upload_space_available() ) )
+               return false;
+
+       return true;
+}
+
+/*
+ * @since 3.0.0
+ *
+ * @return int of upload size limit in bytes
+ */
+function upload_size_limit_filter( $size ) {
+       $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );
+       return min( $size, $fileupload_maxk, get_upload_space_available() );
+}
+/**
+ * Determines if there is any upload space left in the current blog's quota.
+ *
+ * @return int of upload space available in bytes
+ */
+function get_upload_space_available() {
+       $space_allowed = get_space_allowed() * 1024 * 1024;
+       if ( get_site_option( 'upload_space_check_disabled' ) )
+               return $space_allowed;
+
+       $dir_name = trailingslashit( BLOGUPLOADDIR );
+       if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) )
+               return $space_allowed;
+
+       $dir = dir( $dir_name );
+       $size = 0;
+
+       while ( $file = $dir->read() ) {
+               if ( $file != '.' && $file != '..' ) {
+                       if ( is_dir( $dir_name . $file) ) {
+                               $size += get_dirsize( $dir_name . $file );
+                       } else {
+                               $size += filesize( $dir_name . $file );
+                       }
+               }
+       }
+       $dir->close();
+
+       if ( ( $space_allowed - $size ) <= 0 )
+               return 0;
+
+       return $space_allowed - $size;
+}
+
+/**
+ * Returns the upload quota for the current blog.
+ *
+ * @return int Quota
+ */
+function get_space_allowed() {
+       $space_allowed = get_option( 'blog_upload_space' );
+       if ( $space_allowed == false )
+               $space_allowed = get_site_option( 'blog_upload_space' );
+       if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) )
+               $space_allowed = 50;
+
+       return $space_allowed;
+}
+
+function display_space_usage() {
+       $space = get_space_allowed();
+       $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
+
+       $percentused = ( $used / $space ) * 100;
+
+       if ( $space > 1000 ) {
+               $space = number_format( $space / 1024 );
+               /* translators: Gigabytes */
+               $space .= __( 'GB' );
+       } else {
+               /* translators: Megabytes */
+               $space .= __( 'MB' );
+       }
+       ?>
+       <strong><?php printf( __( 'Used: %1s%% of %2s' ), number_format( $percentused ), $space ); ?></strong>
+       <?php
+}
+
+// Display File upload quota on dashboard
+function dashboard_quota() {
+       if ( get_site_option( 'upload_space_check_disabled' ) )
+               return true;
+
+       $quota = get_space_allowed();
+       $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
+
+       if ( $used > $quota )
+               $percentused = '100';
+       else
+               $percentused = ( $used / $quota ) * 100;
+       $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
+       $used = round( $used, 2 );
+       $percentused = number_format( $percentused );
+
+       ?>
+       <p class="sub musub"><?php _e( 'Storage Space' ); ?></p>
+       <div class="table table_content musubtable">
+       <table>
+               <tr class="first">
+                       <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?></td>
+                       <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
+               </tr>
+       </table>
+       </div>
+       <div class="table table_discussion musubtable">
+       <table>
+               <tr class="first">
+                       <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), esc_url( admin_url( 'upload.php' ) ), $used, $percentused ); ?></td>
+                       <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
+               </tr>
+       </table>
+       </div>
+       <br class="clear" />
+       <?php
+}
+if ( current_user_can( 'edit_posts' ) )
+       add_action( 'activity_box_end', 'dashboard_quota' );
+
+// Edit blog upload space setting on Edit Blog page
+function upload_space_setting( $id ) {
+       $quota = get_blog_option( $id, 'blog_upload_space' );
+       if ( !$quota )
+               $quota = '';
+
+       ?>
+       <tr>
+               <th><?php _e( 'Site Upload Space Quota '); ?></th>
+               <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
+       </tr>
+       <?php
+}
+add_action( 'wpmueditblogaction', 'upload_space_setting' );
+
+function update_user_status( $id, $pref, $value, $refresh = 1 ) {
+       global $wpdb;
+
+       $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) );
+
+       if ( $refresh == 1 )
+               refresh_user_details( $id );
+
+       if ( $pref == 'spam' ) {
+               if ( $value == 1 )
+                       do_action( 'make_spam_user', $id );
+               else
+                       do_action( 'make_ham_user', $id );
+       }
+
+       return $value;
+}
+
+function refresh_user_details( $id ) {
+       $id = (int) $id;
+
+       if ( !$user = get_userdata( $id ) )
+               return false;
+
+       clean_user_cache( $id );
+
+       return $id;
+}
+
+function format_code_lang( $code = '' ) {
+       $code = strtolower( substr( $code, 0, 2 ) );
+       $lang_codes = array(
+               'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
+               'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
+               'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',
+               'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',
+               'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',
+               'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',
+               'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'BokmÃ¥l, Norwegian, Norwegian BokmÃ¥l',
+               'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
+               'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
+               'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
+               've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
+       $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
+       return strtr( $code, $lang_codes );
+}
+
+function sync_category_tag_slugs( $term, $taxonomy ) {
+       if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
+               if ( is_object( $term ) ) {
+                       $term->slug = sanitize_title( $term->name );
+               } else {
+                       $term['slug'] = sanitize_title( $term['name'] );
+               }
+       }
+       return $term;
+}
+add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
+
+function redirect_user_to_blog() {
+       global $current_user;
+       $c = 0;
+       if ( isset( $_GET['c'] ) )
+               $c = (int) $_GET['c'];
+
+       if ( $c >= 5 ) {
+               wp_die( __( "You don&#8217;t have permission to view this site. Please contact the system administrator." ) );
+       }
+       $c ++;
+
+       $blog = get_active_blog_for_user( $current_user->ID );
+       $dashboard_blog = get_dashboard_blog();
+       if ( is_object( $blog ) ) {
+               wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
+               exit;
+       }
+
+       /*
+          If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
+          then update the primary_blog record to match the user's blog
+        */
+       $blogs = get_blogs_of_user( $current_user->ID );
+
+       if ( !empty( $blogs ) ) {
+               foreach( $blogs as $blogid => $blog ) {
+                       if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
+                               update_user_meta( $current_user->ID, 'primary_blog', $blogid );
+                               continue;
+                       }
+               }
+               $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
+                       wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
+               exit;
+       }
+       wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
+}
+add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
+
+function check_import_new_users( $permission ) {
+       if ( !is_super_admin() )
+               return false;
+       return true;
+}
+add_filter( 'import_allow_create_users', 'check_import_new_users' );
+// See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too.
+
+function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
+       $flag = false;
+       $output = array();
+
+       foreach ( (array) $lang_files as $val ) {
+               $code_lang = basename( $val, '.mo' );
+
+               if ( $code_lang == 'en_US' ) { // American English
+                       $flag = true;
+                       $ae = __( 'American English' );
+                       $output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $ae . '</option>';
+               } elseif ( $code_lang == 'en_GB' ) { // British English
+                       $flag = true;
+                       $be = __( 'British English' );
+                       $output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $be . '</option>';
+               } else {
+                       $translated = format_code_lang( $code_lang );
+                       $output[$translated] =  '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . esc_html ( $translated ) . '</option>';
+               }
+
+       }
+
+       if ( $flag === false ) // WordPress english
+               $output[] = '<option value=""' . selected( $current, '' ) . '>' . __( 'English' ) . "</option>";
+
+       // Order by name
+       uksort( $output, 'strnatcasecmp' );
+
+       $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
+       echo implode( "\n\t", $output );
+}
+
+/* Warn the admin if SECRET SALT information is missing from wp-config.php */
+function secret_salt_warning() {
+       if ( !is_super_admin() )
+               return;
+       $secret_keys = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' );
+       $out = '';
+       foreach( $secret_keys as $key ) {
+               if ( ! defined( $key ) )
+                       $out .= "define( '$key', '" . esc_html( wp_generate_password( 64, true, true ) ) . "' );<br />";
+       }
+       if ( $out != '' ) {
+               $msg  = __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to <strong>wp-config.php</strong> for it to be more secure.' );
+               $msg .= '<br/>' . __( "Before the line <code>/* That's all, stop editing! Happy blogging. */</code> please add this code:" );
+               $msg .= "<br/><br/><code>$out</code>";
+
+               echo "<div class='update-nag'>$msg</div>";
+       }
+}
+add_action( 'admin_notices', 'secret_salt_warning' );
+
+function admin_notice_feed() {
+       global $current_user, $current_screen;
+       if ( $current_screen->id != 'dashboard' )
+               return;
+
+       if ( !empty( $_GET['feed_dismiss'] ) ) {
+               update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
+               return;
+       }
+
+       $url = get_site_option( 'admin_notice_feed' );
+       if ( empty( $url ) )
+               return;
+
+       $rss = fetch_feed( $url );
+       if ( ! is_wp_error( $rss ) && $item = $rss->get_item() ) {
+               $title = $item->get_title();
+               if ( md5( $title ) == get_user_option( 'admin_feed_dismiss' ) )
+                       return;
+               $msg = "<h3>" . esc_html( $title ) . "</h3>\n";
+               $content = $item->get_description();
+               $content = $content ? wp_html_excerpt( $content, 200 ) . ' &hellip; ' : '';
+               $link = esc_url( strip_tags( $item->get_link() ) );
+               $msg .= "<p>" . $content . "<a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $title ) . "'>" . __( 'Dismiss' ) . "</a></p>";
+               echo "<div class='updated'>$msg</div>";
+       } elseif ( is_super_admin() ) {
+               printf( '<div class="update-nag">' . __( 'Your feed at %s is empty.' ) . '</div>', esc_html( $url ) );
+       }
+}
+add_action( 'admin_notices', 'admin_notice_feed' );
+
+function site_admin_notice() {
+       global $current_user, $wp_db_version;
+       if ( !is_super_admin() )
+               return false;
+       if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
+               echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "</div>";
+}
+add_action( 'admin_notices', 'site_admin_notice' );
+
+function avoid_blog_page_permalink_collision( $data, $postarr ) {
+       if ( is_subdomain_install() )
+               return $data;
+       if ( $data['post_type'] != 'page' )
+               return $data;
+       if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
+               return $data;
+       if ( !is_main_site() )
+               return $data;
+
+       $post_name = $data['post_name'];
+       $c = 0;
+       while( $c < 10 && get_id_from_blogname( $post_name ) ) {
+               $post_name .= mt_rand( 1, 10 );
+               $c ++;
+       }
+       if ( $post_name != $data['post_name'] ) {
+               $data['post_name'] = $post_name;
+       }
+       return $data;
+}
+add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 );
+
+function choose_primary_blog() {
+       global $current_user;
+       ?>
+       <table class="form-table">
+       <tr>
+       <?php /* translators: My sites label */ ?>
+               <th scope="row"><?php _e( 'Primary Site' ); ?></th>
+               <td>
+               <?php
+               $all_blogs = get_blogs_of_user( $current_user->ID );
+               $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );
+               if ( count( $all_blogs ) > 1 ) {
+                       $found = false;
+                       ?>
+                       <select name="primary_blog">
+                               <?php foreach( (array) $all_blogs as $blog ) {
+                                       if ( $primary_blog == $blog->userblog_id )
+                                               $found = true;
+                                       ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog,  $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
+                               } ?>
+                       </select>
+                       <?php
+                       if ( !$found ) {
+                               $blog = array_shift( $all_blogs );
+                               update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
+                       }
+               } elseif ( count( $all_blogs ) == 1 ) {
+                       $blog = array_shift( $all_blogs );
+                       echo $blog->domain;
+                       if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
+                               update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
+               } else {
+                       echo "N/A";
+               }
+               ?>
+               </td>
+       </tr>
+       <?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?>
+               <tr>
+                       <th scope="row" colspan="2" class="th-full">
+                               <a href="<?php echo apply_filters( 'wp_signup_location', network_home_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a>
+                       </th>
+               </tr>
+       <?php endif; ?>
+       </table>
+       <?php
+}
+
+function show_post_thumbnail_warning() {
+       if ( ! is_super_admin() )
+               return;
+       $mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
+       if ( empty($mu_media_buttons['image']) && current_theme_supports( 'post-thumbnails' ) ) {
+               echo "<div class='update-nag'>" . sprintf( __( "Warning! The current theme supports Featured Images. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "</div>";
+       }
+}
+add_action( 'admin_notices', 'show_post_thumbnail_warning' );
+
+function ms_deprecated_blogs_file() {
+       if ( ! is_super_admin() )
+               return;
+       if ( ! file_exists( WP_CONTENT_DIR . '/blogs.php' ) )
+               return;
+       echo '<div class="update-nag">' . sprintf( __( 'The <code>%1$s</code> file is deprecated. Please remove it and update your server rewrite rules to use <code>%2$s</code> instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . '</div>';
+}
+add_action( 'admin_notices', 'ms_deprecated_blogs_file' );
+
+/**
+ * Outputs the notice message for multisite regarding activation of plugin page.
+ *
+ * @since 3.0.0
+ * @return none
+ */
+function _admin_notice_multisite_activate_plugins_page() {
+       $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="' . esc_url( admin_url( 'ms-options.php#menu' ) ) . '">' . __( 'Activate' ) . '</a>' );
+       echo "<div class='error'><p>$message</p></div>";
+}
+
+/**
+ * Grants super admin privileges.
+ *
+ * @since 3.0.0
+ * @param $user_id
+ */
+function grant_super_admin( $user_id ) {
+       global $super_admins;
+
+       // If global super_admins override is defined, there is nothing to do here.
+       if ( isset($super_admins) )
+               return false;
+
+       do_action( 'grant_super_admin', $user_id );
+
+       // Directly fetch site_admins instead of using get_super_admins()
+       $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
+
+       $user = new WP_User( $user_id );
+       if ( ! in_array( $user->user_login, $super_admins ) ) {
+               $super_admins[] = $user->user_login;
+               update_site_option( 'site_admins' , $super_admins );
+               do_action( 'granted_super_admin', $user_id );
+               return true;
+       }
+       return false;
+}
+
+/**
+ * Revokes super admin privileges.
+ *
+ * @since 3.0.0
+ * @param $user_id
+ */
+function revoke_super_admin( $user_id ) {
+       global $super_admins;
+
+       // If global super_admins override is defined, there is nothing to do here.
+       if ( isset($super_admins) )
+               return false;
+
+       do_action( 'revoke_super_admin', $user_id );
+
+       // Directly fetch site_admins instead of using get_super_admins()
+       $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
+
+       $user = new WP_User( $user_id );
+       if ( $user->user_email != get_site_option( 'admin_email' ) ) {
+               if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) {
+                       unset( $super_admins[$key] );
+                       update_site_option( 'site_admins', $super_admins );
+                       do_action( 'revoked_super_admin', $user_id );
+                       return true;
+               }
+       }
+       return false;
+}
+?>
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
new file mode 100644 (file)
index 0000000..e467559
--- /dev/null
@@ -0,0 +1,1139 @@
+<?php
+
+/**
+ * Create HTML list of nav menu input items.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ * @uses Walker_Nav_Menu
+ */
+class Walker_Nav_Menu_Edit extends Walker_Nav_Menu  {
+       /**
+        * @see Walker_Nav_Menu::start_lvl()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference.
+        * @param int $depth Depth of page.
+        */
+       function start_lvl(&$output) {}
+
+       /**
+        * @see Walker_Nav_Menu::end_lvl()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference.
+        * @param int $depth Depth of page.
+        */
+       function end_lvl(&$output) {
+       }
+
+       /**
+        * @see Walker::start_el()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $item Menu item data object.
+        * @param int $depth Depth of menu item. Used for padding.
+        * @param int $current_page Menu item ID.
+        * @param object $args
+        */
+       function start_el(&$output, $item, $depth, $args) {
+               global $_wp_nav_menu_max_depth;
+               $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
+
+               $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
+
+               ob_start();
+               $item_id = esc_attr( $item->ID );
+               $removed_args = array(
+                       'action',
+                       'customlink-tab',
+                       'edit-menu-item',
+                       'menu-item',
+                       'page-tab',
+                       '_wpnonce',
+               );
+
+               $original_title = '';
+               if ( 'taxonomy' == $item->type ) {
+                       $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
+               } elseif ( 'post_type' == $item->type ) {
+                       $original_object = get_post( $item->object_id );
+                       $original_title = $original_object->post_title;
+               }
+
+               $classes = array(
+                       'menu-item menu-item-depth-' . $depth,
+                       'menu-item-' . esc_attr( $item->object ),
+                       'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'),
+               );
+
+               $title = $item->title;
+
+               if ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
+                       $classes[] = 'pending';
+                       /* translators: %s: title of menu item in draft status */
+                       $title = sprintf( __('%s (Pending)'), $item->title );
+               }
+
+               $title = empty( $item->label ) ? $title : $item->label;
+
+               ?>
+               <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>">
+                       <dl class="menu-item-bar">
+                               <dt class="menu-item-handle">
+                                       <span class="item-title"><?php echo esc_html( $title ); ?></span>
+                                       <span class="item-controls">
+                                               <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
+                                               <span class="item-order">
+                                                       <a href="<?php
+                                                               echo wp_nonce_url(
+                                                                       add_query_arg(
+                                                                               array(
+                                                                                       'action' => 'move-up-menu-item',
+                                                                                       'menu-item' => $item_id,
+                                                                               ),
+                                                                               remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
+                                                                       ),
+                                                                       'move-menu_item'
+                                                               );
+                                                       ?>" class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?>">&#8593;</abbr></a>
+                                                       |
+                                                       <a href="<?php
+                                                               echo wp_nonce_url(
+                                                                       add_query_arg(
+                                                                               array(
+                                                                                       'action' => 'move-down-menu-item',
+                                                                                       'menu-item' => $item_id,
+                                                                               ),
+                                                                               remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
+                                                                       ),
+                                                                       'move-menu_item'
+                                                               );
+                                                       ?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">&#8595;</abbr></a>
+                                               </span>
+                                               <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php
+                                                       echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
+                                               ?>"><?php _e( 'Edit Menu Item' ); ?></a>
+                                       </span>
+                               </dt>
+                       </dl>
+
+                       <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?>">
+                               <?php if( 'custom' == $item->type ) : ?>
+                                       <p class="field-url description description-wide">
+                                               <label for="edit-menu-item-url-<?php echo $item_id; ?>">
+                                                       <?php _e( 'URL' ); ?><br />
+                                                       <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" />
+                                               </label>
+                                       </p>
+                               <?php endif; ?>
+                               <p class="description description-thin">
+                                       <label for="edit-menu-item-title-<?php echo $item_id; ?>">
+                                               <?php _e( 'Navigation Label' ); ?><br />
+                                               <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" />
+                                       </label>
+                               </p>
+                               <p class="description description-thin">
+                                       <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>">
+                                               <?php _e( 'Title Attribute' ); ?><br />
+                                               <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>" />
+                                       </label>
+                               </p>
+                               <p class="field-link-target description description-thin">
+                                       <label for="edit-menu-item-target-<?php echo $item_id; ?>">
+                                               <?php _e( 'Link Target' ); ?><br />
+                                               <select id="edit-menu-item-target-<?php echo $item_id; ?>" class="widefat edit-menu-item-target" name="menu-item-target[<?php echo $item_id; ?>]">
+                                                       <option value="" <?php selected( $item->target, ''); ?>><?php _e('Same window or tab'); ?></option>
+                                                       <option value="_blank" <?php selected( $item->target, '_blank'); ?>><?php _e('New window or tab'); ?></option>
+                                               </select>
+                                       </label>
+                               </p>
+                               <p class="field-css-classes description description-thin">
+                                       <label for="edit-menu-item-classes-<?php echo $item_id; ?>">
+                                               <?php _e( 'CSS Classes (optional)' ); ?><br />
+                                               <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" />
+                                       </label>
+                               </p>
+                               <p class="field-xfn description description-thin">
+                                       <label for="edit-menu-item-xfn-<?php echo $item_id; ?>">
+                                               <?php _e( 'Link Relationship (XFN)' ); ?><br />
+                                               <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" />
+                                       </label>
+                               </p>
+                               <p class="field-description description description-wide">
+                                       <label for="edit-menu-item-description-<?php echo $item_id; ?>">
+                                               <?php _e( 'Description' ); ?><br />
+                                               <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); ?></textarea>
+                                               <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span>
+                                       </label>
+                               </p>
+
+                               <div class="menu-item-actions description-wide submitbox">
+                                       <?php if( 'custom' != $item->type ) : ?>
+                                               <p class="link-to-original">
+                                                       <?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
+                                               </p>
+                                       <?php endif; ?>
+                                       <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php
+                                       echo wp_nonce_url(
+                                               add_query_arg(
+                                                       array(
+                                                               'action' => 'delete-menu-item',
+                                                               'menu-item' => $item_id,
+                                                       ),
+                                                       remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
+                                               ),
+                                               'delete-menu_item_' . $item_id
+                                       ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) );
+                                               ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>
+                               </div>
+
+                               <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />
+                               <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />
+                               <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" />
+                               <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />
+                               <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
+                               <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />
+                       </div><!-- .menu-item-settings-->
+                       <ul class="menu-item-transport"></ul>
+               <?php
+               $output .= ob_get_clean();
+       }
+}
+
+/**
+ * Create HTML list of nav menu input items.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ * @uses Walker_Nav_Menu
+ */
+class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu  {
+
+       /**
+        * @see Walker::start_el()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $item Menu item data object.
+        * @param int $depth Depth of menu item. Used for padding.
+        * @param int $current_page Menu item ID.
+        * @param object $args
+        */
+       function start_el(&$output, $item, $depth, $args) {
+               global $_nav_menu_placeholder;
+
+               $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
+               $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
+               $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
+
+               $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
+
+               $output .= $indent . '<li>';
+               $output .= '<label class="menu-item-title">';
+               $output .= '<input type="checkbox" class="menu-item-checkbox';
+               if ( ! empty( $item->_add_to_top ) ) {
+                       $output .= ' add-to-top';
+               }
+               $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
+               $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );
+               $output .= '</label>';
+
+               // Menu item hidden fields
+               $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
+               $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
+               $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
+       }
+}
+
+/**
+ * Prints the appropriate response to a menu quick search.
+ *
+ * @since 3.0.0
+ *
+ * @param array $request The unsanitized request values.
+ */
+function _wp_ajax_menu_quick_search( $request = array() ) {
+       $args = array();
+       $type = isset( $request['type'] ) ? $request['type'] : '';
+       $object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
+       $query = isset( $request['q'] ) ? $request['q'] : '';
+       $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json';
+
+       if ( 'markup' == $response_format ) {
+               $args['walker'] = new Walker_Nav_Menu_Checklist;
+       }
+
+       if ( 'get-post-item' == $type ) {
+               if ( post_type_exists( $object_type ) ) {
+                       if ( isset( $request['ID'] ) ) {
+                               $object_id = (int) $request['ID'];
+                               if ( 'markup' == $response_format ) {
+                                       echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
+                               } elseif ( 'json' == $response_format ) {
+                                       $post_obj = get_post( $object_id );
+                                       echo json_encode(
+                                               array(
+                                                       'ID' => $object_id,
+                                                       'post_title' => get_the_title( $object_id ),
+                                                       'post_type' => get_post_type( $object_id ),
+                                               )
+                                       );
+                                       echo "\n";
+                               }
+                       }
+               } elseif ( taxonomy_exists( $object_type ) ) {
+                       if ( isset( $request['ID'] ) ) {
+                               $object_id = (int) $request['ID'];
+                               if ( 'markup' == $response_format ) {
+                                       echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
+                               } elseif ( 'json' == $response_format ) {
+                                       $post_obj = get_term( $object_id, $object_type );
+                                       echo json_encode(
+                                               array(
+                                                       'ID' => $object_id,
+                                                       'post_title' => $post_obj->name,
+                                                       'post_type' => $object_type,
+                                               )
+                                       );
+                                       echo "\n";
+                               }
+                       }
+
+               }
+
+
+       } elseif ( preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches) ) {
+               if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) {
+                       query_posts(array(
+                               'posts_per_page' => 10,
+                               'post_type' => $matches[2],
+                               's' => $query,
+                       ));
+                       if ( ! have_posts() )
+                               return;
+                       while ( have_posts() ) {
+                               the_post();
+                               if ( 'markup' == $response_format ) {
+                                       echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( get_the_ID() ) ) ), 0, (object) $args );
+                               } elseif ( 'json' == $response_format ) {
+                                       echo json_encode(
+                                               array(
+                                                       'ID' => get_the_ID(),
+                                                       'post_title' => get_the_title(),
+                                                       'post_type' => get_post_type(),
+                                               )
+                                       );
+                                       echo "\n";
+                               }
+                       }
+               } elseif ( 'taxonomy' == $matches[1] ) {
+                       $terms = get_terms( $matches[2], array(
+                               'name__like' => $query,
+                               'number' => 10,
+                       ));
+                       if ( empty( $terms ) || is_wp_error( $terms ) )
+                               return;
+                       foreach( (array) $terms as $term ) {
+                               if ( 'markup' == $response_format ) {
+                                       echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
+                               } elseif ( 'json' == $response_format ) {
+                                       echo json_encode(
+                                               array(
+                                                       'ID' => $term->term_id,
+                                                       'post_title' => $term->name,
+                                                       'post_type' => $matches[2],
+                                               )
+                                       );
+                                       echo "\n";
+                               }
+                       }
+               }
+       }
+}
+
+/**
+ * Register nav menu metaboxes and advanced menu items
+ *
+ * @since 3.0.0
+ **/
+function wp_nav_menu_setup() {
+       // Register meta boxes
+       if ( wp_get_nav_menus() )
+               add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
+       add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
+       wp_nav_menu_post_type_meta_boxes();
+       wp_nav_menu_taxonomy_meta_boxes();
+
+       // Register advanced menu items (columns)
+       add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
+
+       // If first time editing, disable advanced items by default.
+       if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
+               $user = wp_get_current_user();
+               update_user_option($user->ID, 'managenav-menuscolumnshidden',
+                       array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ),
+                       true);
+       }
+}
+
+/**
+ * Limit the amount of meta boxes to just links, pages and cats for first time users.
+ *
+ * @since 3.0.0
+ **/
+function wp_initial_nav_menu_meta_boxes() {
+       global $wp_meta_boxes;
+
+       if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
+               return;
+
+       $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );
+       $hidden_meta_boxes = array();
+
+       foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
+               foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
+                       foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
+                               if ( in_array( $box['id'], $initial_meta_boxes ) ) {
+                                       unset( $box['id'] );
+                               } else {
+                                       $hidden_meta_boxes[] = $box['id'];
+                               }
+                       }
+               }
+       }
+
+       $user = wp_get_current_user();
+       update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
+}
+
+/**
+ * Creates metaboxes for any post type menu item.
+ *
+ * @since 3.0.0
+ */
+function wp_nav_menu_post_type_meta_boxes() {
+       $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
+
+       if ( ! $post_types )
+               return;
+
+       foreach ( $post_types as $post_type ) {
+               $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
+               if ( $post_type ) {
+                       $id = $post_type->name;
+                       add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
+               }
+       }
+}
+
+/**
+ * Creates metaboxes for any taxonomy menu item.
+ *
+ * @since 3.0.0
+ */
+function wp_nav_menu_taxonomy_meta_boxes() {
+       $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
+
+       if ( !$taxonomies )
+               return;
+
+       foreach ( $taxonomies as $tax ) {
+               $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
+               if ( $tax ) {
+                       $id = $tax->name;
+                       add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
+               }
+       }
+}
+
+/**
+ * Displays a metabox for the nav menu theme locations.
+ *
+ * @since 3.0.0
+ */
+function wp_nav_menu_locations_meta_box() {
+       global $nav_menu_selected_id;
+
+       if ( ! current_theme_supports( 'menus' ) ) {
+               // We must only support widgets. Leave a message and bail.
+               echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p>';
+               return;
+       }
+
+       $locations = get_registered_nav_menus();
+       $menus = wp_get_nav_menus();
+       $menu_locations = get_nav_menu_locations();
+       $num_locations = count( array_keys($locations) );
+
+       echo '<p class="howto">' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '</p>';
+
+       foreach ( $locations as $location => $description ) {
+               ?>
+               <p>
+                       <label class="howto" for="locations-<?php echo $location; ?>">
+                               <span><?php echo $description; ?></span>
+                               <select name="menu-locations[<?php echo $location; ?>]" id="locations-<?php echo $location; ?>">
+                                       <option value="0"></option>
+                                       <?php foreach ( $menus as $menu ) : ?>
+                                       <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
+                                               value="<?php echo $menu->term_id; ?>"><?php
+                                               $truncated_name = wp_html_excerpt( $menu->name, 40 );
+                                               echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '&hellip;';
+                                       ?></option>
+                                       <?php endforeach; ?>
+                               </select>
+                       </label>
+               </p>
+       <?php
+       }
+       ?>
+       <p class="button-controls">
+               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-primary" name="nav-menu-locations" value="<?php esc_attr_e( 'Save' ); ?>" />
+       </p>
+       <?php
+}
+
+/**
+ * Displays a metabox for the custom links menu item.
+ *
+ * @since 3.0.0
+ */
+function wp_nav_menu_item_link_meta_box() {
+       global $_nav_menu_placeholder, $nav_menu_selected_id;
+       $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
+
+       $current_tab = 'create';
+       if ( isset( $_REQUEST['customlink-tab'] ) && in_array( $_REQUEST['customlink-tab'], array('create', 'all') ) ) {
+               $current_tab = $_REQUEST['customlink-tab'];
+       }
+
+       $removed_args = array(
+               'action',
+               'customlink-tab',
+               'edit-menu-item',
+               'menu-item',
+               'page-tab',
+               '_wpnonce',
+       );
+
+       ?>
+       <div class="customlinkdiv" id="customlinkdiv">
+
+                       <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
+                       <p id="menu-item-url-wrap">
+                               <label class="howto" for="custom-menu-item-url">
+                                       <span><?php _e('URL'); ?></span>
+                                       <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
+                               </label>
+                       </p>
+
+                       <p id="menu-item-name-wrap">
+                               <label class="howto" for="custom-menu-item-name">
+                                       <span><?php _e('Label'); ?></span>
+                                       <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
+                               </label>
+                       </p>
+
+               <p class="button-controls">
+                       <span class="add-to-menu">
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
+                       </span>
+               </p>
+
+       </div><!-- /.customlinkdiv -->
+       <?php
+}
+
+/**
+ * Displays a metabox for a post type menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param string $object Not used.
+ * @param string $post_type The post type object.
+ */
+function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
+       global $_nav_menu_placeholder, $nav_menu_selected_id;
+
+       $post_type_name = $post_type['args']->name;
+
+       // paginate browsing for large numbers of post objects
+       $per_page = 50;
+       $pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
+       $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
+
+       $args = array(
+               'offset' => $offset,
+               'order' => 'ASC',
+               'orderby' => 'title',
+               'posts_per_page' => $per_page,
+               'post_type' => $post_type_name,
+               'suppress_filters' => true,
+               'update_post_term_cache' => false,
+               'update_post_meta_cache' => false
+       );
+
+       if ( isset( $post_type['args']->_default_query ) )
+               $args = array_merge($args, (array) $post_type['args']->_default_query );
+
+       // @todo transient caching of these results with proper invalidation on updating of a post of this type
+       $get_posts = new WP_Query;
+       $posts = $get_posts->query( $args );
+       if ( ! $get_posts->post_count ) {
+               echo '<p>' . __( 'No items.' ) . '</p>';
+               return;
+       }
+
+       $post_type_object = get_post_type_object($post_type_name);
+
+       $num_pages = $get_posts->max_num_pages;
+
+       $page_links = paginate_links( array(
+               'base' => add_query_arg(
+                       array(
+                               $post_type_name . '-tab' => 'all',
+                               'paged' => '%#%',
+                               'item-type' => 'post_type',
+                               'item-object' => $post_type_name,
+                       )
+               ),
+               'format' => '',
+               'prev_text' => __('&laquo;'),
+               'next_text' => __('&raquo;'),
+               'total' => $num_pages,
+               'current' => $pagenum
+       ));
+
+       if ( !$posts )
+               $error = '<li id="error">'. $post_type['args']->labels->not_found .'</li>';
+
+       $walker = new Walker_Nav_Menu_Checklist;
+
+       $current_tab = 'most-recent';
+       if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) {
+               $current_tab = $_REQUEST[$post_type_name . '-tab'];
+       }
+
+       if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
+               $current_tab = 'search';
+       }
+
+       $removed_args = array(
+               'action',
+               'customlink-tab',
+               'edit-menu-item',
+               'menu-item',
+               'page-tab',
+               '_wpnonce',
+       );
+
+       ?>
+       <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
+               <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
+                       <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>
+                       <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>
+                       <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>
+               </ul>
+
+               <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
+                       echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>">
+                       <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
+                               <?php
+                               $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'showposts' => 15 ) );
+                               $most_recent = $get_posts->query( $recent_args );
+                               $args['walker'] = $walker;
+                               echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
+                               ?>
+                       </ul>
+               </div><!-- /.tabs-panel -->
+
+               <div class="tabs-panel <?php
+                       echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
+                       <?php
+                       if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
+                               $searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
+                               $search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
+                       } else {
+                               $searched = '';
+                               $search_results = array();
+                       }
+                       ?>
+                       <p class="quick-search-wrap">
+                               <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                               <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
+                       </p>
+
+                       <ul id="<?php echo $post_type_name; ?>-search-checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
+                       <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
+                               <?php
+                               $args['walker'] = $walker;
+                               echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
+                               ?>
+                       <?php elseif ( is_wp_error( $search_results ) ) : ?>
+                               <li><?php echo $search_results->get_error_message(); ?></li>
+                       <?php elseif ( ! empty( $searched ) ) : ?>
+                               <li><?php _e('No results found.'); ?></li>
+                       <?php endif; ?>
+                       </ul>
+               </div><!-- /.tabs-panel -->
+
+
+               <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
+                       echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>">
+                       <?php if ( ! empty( $page_links ) ) : ?>
+                               <div class="add-menu-item-pagelinks">
+                                       <?php echo $page_links; ?>
+                               </div>
+                       <?php endif; ?>
+                       <ul id="<?php echo $post_type_name; ?>checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
+                               <?php
+                               $args['walker'] = $walker;
+
+                               // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
+                               if ( 'page' == $post_type_name ) {
+                                       $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
+                                       if ( ! empty( $front_page ) ) {
+                                               $front_page_obj = get_post( $front_page );
+                                               $front_page_obj->_add_to_top = true;
+                                               $front_page_obj->label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title );
+                                               array_unshift( $posts, $front_page_obj );
+                                       } else {
+                                               $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
+                                               array_unshift( $posts, (object) array(
+                                                       '_add_to_top' => true,
+                                                       'ID' => 0,
+                                                       'object_id' => $_nav_menu_placeholder,
+                                                       'post_content' => '',
+                                                       'post_excerpt' => '',
+                                                       'post_title' => _x('Home', 'nav menu home label'),
+                                                       'post_type' => 'nav_menu_item',
+                                                       'type' => 'custom',
+                                                       'url' => home_url('/'),
+                                               ) );
+                                       }
+                               }
+
+                               $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
+
+                               if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
+                                       $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items);
+
+                               }
+
+                               echo $checkbox_items;
+                               ?>
+                       </ul>
+                       <?php if ( ! empty( $page_links ) ) : ?>
+                               <div class="add-menu-item-pagelinks">
+                                       <?php echo $page_links; ?>
+                               </div>
+                       <?php endif; ?>
+               </div><!-- /.tabs-panel -->
+
+
+               <p class="button-controls">
+                       <span class="list-controls">
+                               <a href="<?php
+                                       echo esc_url(add_query_arg(
+                                               array(
+                                                       $post_type_name . '-tab' => 'all',
+                                                       'selectall' => 1,
+                                               ),
+                                               remove_query_arg($removed_args)
+                                       ));
+                               ?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
+                       </span>
+
+                       <span class="add-to-menu">
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
+                       </span>
+               </p>
+
+       </div><!-- /.posttypediv -->
+       <?php
+}
+
+/**
+ * Displays a metabox for a taxonomy menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param string $object Not used.
+ * @param string $taxonomy The taxonomy object.
+ */
+function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
+       global $nav_menu_selected_id;
+       $taxonomy_name = $taxonomy['args']->name;
+
+       // paginate browsing for large numbers of objects
+       $per_page = 50;
+       $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
+       $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
+
+       $args = array(
+               'child_of' => 0,
+               'exclude' => '',
+               'hide_empty' => false,
+               'hierarchical' => 1,
+               'include' => '',
+               'include_last_update_time' => false,
+               'number' => $per_page,
+               'offset' => $offset,
+               'order' => 'ASC',
+               'orderby' => 'name',
+               'pad_counts' => false,
+       );
+
+       $terms = get_terms( $taxonomy_name, $args );
+
+       if ( ! $terms || is_wp_error($terms) ) {
+               echo '<p>' . __( 'No items.' ) . '</p>';
+               return;
+       }
+
+       $num_pages = ceil( wp_count_terms( $taxonomy_name , array_merge( $args, array('number' => '', 'offset' => '') ) ) / $per_page );
+
+       $page_links = paginate_links( array(
+               'base' => add_query_arg(
+                       array(
+                               $taxonomy_name . '-tab' => 'all',
+                               'paged' => '%#%',
+                               'item-type' => 'taxonomy',
+                               'item-object' => $taxonomy_name,
+                       )
+               ),
+               'format' => '',
+               'prev_text' => __('&laquo;'),
+               'next_text' => __('&raquo;'),
+               'total' => $num_pages,
+               'current' => $pagenum
+       ));
+
+       $walker = new Walker_Nav_Menu_Checklist;
+
+       $current_tab = 'most-used';
+       if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) {
+               $current_tab = $_REQUEST[$taxonomy_name . '-tab'];
+       }
+
+       if ( ! empty( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
+               $current_tab = 'search';
+       }
+
+       $removed_args = array(
+               'action',
+               'customlink-tab',
+               'edit-menu-item',
+               'menu-item',
+               'page-tab',
+               '_wpnonce',
+       );
+
+       ?>
+       <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
+               <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
+                       <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
+                       <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>
+                       <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>
+               </ul>
+
+               <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
+                       echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>">
+                       <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
+                               <?php
+                               $popular_terms = get_terms( $taxonomy_name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
+                               $args['walker'] = $walker;
+                               echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
+                               ?>
+                       </ul>
+               </div><!-- /.tabs-panel -->
+
+               <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
+                       echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>">
+                       <?php if ( ! empty( $page_links ) ) : ?>
+                               <div class="add-menu-item-pagelinks">
+                                       <?php echo $page_links; ?>
+                               </div>
+                       <?php endif; ?>
+                       <ul id="<?php echo $taxonomy_name; ?>checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
+                               <?php
+                               $args['walker'] = $walker;
+                               echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
+                               ?>
+                       </ul>
+                       <?php if ( ! empty( $page_links ) ) : ?>
+                               <div class="add-menu-item-pagelinks">
+                                       <?php echo $page_links; ?>
+                               </div>
+                       <?php endif; ?>
+               </div><!-- /.tabs-panel -->
+
+               <div class="tabs-panel <?php
+                       echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+               ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
+                       <?php
+                       if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
+                               $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
+                               $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
+                       } else {
+                               $searched = '';
+                               $search_results = array();
+                       }
+                       ?>
+                       <p class="quick-search-wrap">
+                               <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                               <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
+                       </p>
+
+                       <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
+                       <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
+                               <?php
+                               $args['walker'] = $walker;
+                               echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
+                               ?>
+                       <?php elseif ( is_wp_error( $search_results ) ) : ?>
+                               <li><?php echo $search_results->get_error_message(); ?></li>
+                       <?php elseif ( ! empty( $searched ) ) : ?>
+                               <li><?php _e('No results found.'); ?></li>
+                       <?php endif; ?>
+                       </ul>
+               </div><!-- /.tabs-panel -->
+
+               <p class="button-controls">
+                       <span class="list-controls">
+                               <a href="<?php
+                                       echo esc_url(add_query_arg(
+                                               array(
+                                                       $taxonomy_name . '-tab' => 'all',
+                                                       'selectall' => 1,
+                                               ),
+                                               remove_query_arg($removed_args)
+                                       ));
+                               ?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
+                       </span>
+
+                       <span class="add-to-menu">
+                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
+                       </span>
+               </p>
+
+       </div><!-- /.taxonomydiv -->
+       <?php
+}
+
+/**
+ * Save posted nav menu item data.
+ *
+ * @since 3.0.0
+ *
+ * @param int $menu_id The menu ID for which to save this item. $menu_id of 0 makes a draft, orphaned menu item.
+ * @param array $menu_data The unsanitized posted menu item data.
+ * @return array The database IDs of the items saved
+ */
+function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
+       $menu_id = (int) $menu_id;
+       $items_saved = array();
+
+       if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
+
+               // Loop through all the menu items' POST values
+               foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
+                       if (
+                               empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked
+                               (
+                                       ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set
+                                       in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default
+                                       ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||  // or it's not a custom menu item (but not the custom home page)
+                                       ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists
+                               )
+                       ) {
+                               continue; // then this potential menu item is not getting added to this menu
+                       }
+
+                       // if this possible menu item doesn't actually have a menu database ID yet
+                       if (
+                               empty( $_item_object_data['menu-item-db-id'] ) ||
+                               ( 0 > $_possible_db_id ) ||
+                               $_possible_db_id != $_item_object_data['menu-item-db-id']
+                       ) {
+                               $_actual_db_id = 0;
+                       } else {
+                               $_actual_db_id = (int) $_item_object_data['menu-item-db-id'];
+                       }
+
+                       $args = array(
+                               'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ),
+                               'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ),
+                               'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ),
+                               'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ),
+                               'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ),
+                               'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ),
+                               'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ),
+                               'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ),
+                               'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ),
+                               'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ),
+                               'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ),
+                               'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ),
+                               'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ),
+                       );
+
+                       $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args );
+
+               }
+       }
+       return $items_saved;
+}
+
+/**
+ * Adds custom arguments to some of the meta box object types.
+ *
+ * @since 3.0.0
+ *
+ * @access private
+ *
+ * @param object $object The post type or taxonomy meta-object.
+ * @return object The post type of taxonomy object.
+ */
+function _wp_nav_menu_meta_box_object( $object = null ) {
+       if ( isset( $object->name ) ) {
+
+               if ( 'page' == $object->name ) {
+                       $object->_default_query = array(
+                               'orderby' => 'menu_order title',
+                               'post_status' => 'publish',
+                       );
+
+               // posts should show only published items
+               } elseif ( 'post' == $object->name ) {
+                       $object->_default_query = array(
+                               'post_status' => 'publish',
+                       );
+
+               // cats should be in reverse chronological order
+               } elseif ( 'category' == $object->name ) {
+                       $object->_default_query = array(
+                               'orderby' => 'id',
+                               'order' => 'DESC',
+                       );
+
+               // custom post types should show only published items
+               } else {
+                       $object->_default_query = array(
+                               'post_status' => 'publish',
+                       );
+               }
+       }
+
+       return $object;
+}
+
+/**
+ * Returns the menu formatted to edit.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu_id The ID of the menu to format.
+ * @return string|WP_Error $output The menu formatted to edit or error object on failure.
+ */
+function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
+       $menu = wp_get_nav_menu_object( $menu_id );
+
+       // If the menu exists, get its items.
+       if ( is_nav_menu( $menu ) ) {
+               $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') );
+               $result = '<div id="menu-instructions" class="post-body-plain';
+               $result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
+               $result .= '<p>' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '</p>';
+               $result .= '</div>';
+
+               if( empty($menu_items) )
+                       return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
+
+               $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
+
+               if ( class_exists( $walker_class_name ) )
+                       $walker = new $walker_class_name;
+               else
+                       return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named <strong>%s</strong> does not exist.'), $walker_class_name ) );
+
+               $some_pending_menu_items = false;
+               foreach( (array) $menu_items as $menu_item ) {
+                       if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
+                               $some_pending_menu_items = true;
+               }
+
+               if ( $some_pending_menu_items )
+                       $result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
+
+               $result .= '<ul class="menu" id="menu-to-edit"> ';
+               $result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
+               $result .= ' </ul> ';
+               return $result;
+       } elseif ( is_wp_error( $menu ) ) {
+               return $menu;
+       }
+
+
+}
+
+/**
+ * Returns the columns for the nav menus page.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu_item_id The ID of the menu item to format.
+ * @return string|WP_Error $output The menu formatted to edit or error object on failure.
+ */
+function wp_nav_menu_manage_columns() {
+       return array(
+               '_title' => __('Show advanced menu properties'),
+               'cb' => '<input type="checkbox" />',
+               'link-target' => __('Link Target'),
+               'css-classes' => __('CSS Classes'),
+               'xfn' => __('Link Relationship (XFN)'),
+               'description' => __('Description'),
+       );
+}
+
+/**
+ * Deletes orphaned draft menu items
+ *
+ * @access private
+ * @since 3.0.0
+ *
+ */
+function _wp_delete_orphaned_draft_menu_items() {
+       global $wpdb;
+       $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
+
+       // delete orphaned draft menu items
+       $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
+
+       foreach( (array) $menu_items_to_delete as $menu_item_id )
+               wp_delete_post( $menu_item_id, true );
+}
+
+add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
+
+?>
index f81ecc82d9f842266c8165a5b601de5a2274089a..f348e609e515fde9afe8c0390a6b3ad4be87fc8e 100644 (file)
  *
  * @param string $action
  * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
- * @return mixed
+ * @return object plugins_api response object on success, WP_Error on failure.
  */
 function plugins_api($action, $args = null) {
 
-       if( is_array($args) )
+       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.
+       // Allows a plugin to override the WordPress.org API entirely.
+       // Use the filter 'plugins_api_result' to mearly add results.
+       // Please ensure that a object is returned from the following filters.
+       $args = apply_filters('plugins_api_args', $args, $action);
+       $res = apply_filters('plugins_api', false, $action, $args);
 
-       if ( ! $res ) {
-               $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
+       if ( false === $res ) {
+               $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
                if ( is_wp_error($request) ) {
-                       $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
+                       $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );
                } else {
                        $res = unserialize($request['body']);
-                       if ( ! $res )
-                               $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
+                       if ( false === $res )
+                               $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), $request['body']);
                }
        } elseif ( !is_wp_error($res) ) {
                $res->external = true;
@@ -136,16 +139,20 @@ function install_dashboard() {
 
        $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' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
-                                                               'name' => $tag['name'],
-                                                               'id' => sanitize_title_with_dashes($tag['name']),
-                                                               'count' => $tag['count'] );
        echo '<p class="popular-tags">';
-       echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
+       if ( is_wp_error($api_tags) ) {
+               echo $api_tags->get_error_message();
+       } else {
+               //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' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
+                                                                       'name' => $tag['name'],
+                                                                       'id' => sanitize_title_with_dashes($tag['name']),
+                                                                       'count' => $tag['count'] );
+               echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
+       }
        echo '</p><br class="clear" />';
 }
 
@@ -162,7 +169,7 @@ function install_search_form(){
                <select name="type" id="typeselector">
                        <option value="term"<?php selected('term', $type) ?>><?php _e('Term'); ?></option>
                        <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
-                       <option value="tag"<?php selected('tag', $type) ?>><?php echo _x('Tag', 'Plugin Installer'); ?></option>
+                       <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>
                </select>
                <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
                <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label>
@@ -182,7 +189,7 @@ 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);
+               wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 
@@ -197,6 +204,8 @@ add_action('install_plugins_popular', 'install_popular', 10, 1);
 function install_popular($page = 1) {
        $args = array('browse' => 'popular', 'page' => $page);
        $api = plugins_api('query_plugins', $args);
+       if ( is_wp_error($api) )
+               wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 
@@ -210,7 +219,7 @@ add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
 function install_plugins_upload( $page = 1 ) {
 ?>
        <h4><?php _e('Install a plugin in .zip format') ?></h4>
-       <p class="install-help"><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
+       <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>
        <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-plugin') ?>">
                <?php wp_nonce_field( 'plugin-upload') ?>
                <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
@@ -232,7 +241,7 @@ 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);
+               wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 add_action('install_plugins_updated', 'install_updated', 10, 1);
@@ -248,6 +257,8 @@ add_action('install_plugins_updated', 'install_updated', 10, 1);
 function install_updated($page = 1) {
        $args = array('browse' => 'updated', 'page' => $page);
        $api = plugins_api('query_plugins', $args);
+       if ( is_wp_error($api) )
+               wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 
@@ -302,7 +313,6 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                <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>
 
@@ -312,16 +322,15 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                <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) )
+                       if ( empty($plugins) )
                                echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>';
 
-                       foreach( (array) $plugins as $plugin ){
+                       foreach ( (array) $plugins as $plugin ){
                                if ( is_object($plugin) )
                                        $plugin = (array) $plugin;
 
@@ -342,23 +351,41 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                $name = strip_tags($title . ' ' . $version);
 
                                $author = $plugin['author'];
-                               if( ! empty($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="' . esc_attr($plugin['homepage']) . '">' . $title . '</a>';
-
                                $action_links = array();
                                $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
-                                                                       '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox onclick" title="' .
-                                                                       esc_attr($name) . '">' . __('Install') . '</a>';
+                                                                       '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
+                                                                       esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __('Details') . '</a>';
+
+                               if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) {
+                                       $status = install_plugin_install_status($plugin);
+
+                                       switch ( $status['status'] ) {
+                                               case 'install':
+                                                       if ( $status['url'] )
+                                                               $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __('Install Now') . '</a>';
+                                                       break;
+                                               case 'update_available':
+                                                       if ( $status['url'] )
+                                                               $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . sprintf( __('Update Now'), $status['version'] ) . '</a>';
+                                                       break;
+                                               case 'latest_installed':
+                                               case 'newer_installed':
+                                                       $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . __('Installed') . '</span>';
+                                                       break;
+                                       }
+                               }
 
-                               $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
+                               $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
                        ?>
                        <tr>
-                               <td class="name"><?php echo $title; ?></td>
+                               <td class="name"><strong><?php echo $title; ?></strong>
+                                       <div class="action-links"><?php if ( !empty($action_links) ) echo implode(' | ', $action_links); ?></div>
+                               </td>
                                <td class="vers"><?php echo $version; ?></td>
                                <td class="vers">
                                        <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])) ?>">
@@ -371,7 +398,6 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                        </div>
                                </td>
                                <td class="desc"><?php echo $description, $author; ?></td>
-                               <td class="action-links"><?php if ( !empty($action_links) )     echo implode(' | ', $action_links); ?></td>
                        </tr>
                        <?php
                        }
@@ -390,6 +416,69 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
 
 add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
 
+/**
+ * Determine the status we can perform on a plugin.
+ *
+ * @since 3.0.0
+ */
+function install_plugin_install_status($api, $loop = false) {
+       // this function is called recursivly, $loop prevents futhur loops.
+       if ( is_array($api) )
+               $api = (object) $api;
+
+       //Default to a "new" plugin
+       $status = 'install';
+       $url = false;
+
+       //Check to see if this plugin is known to be installed, and has an update awaiting it.
+       $update_plugins = get_site_transient('update_plugins');
+       if ( is_object( $update_plugins ) ) {
+               foreach ( (array)$update_plugins->response as $file => $plugin ) {
+                       if ( $plugin->slug === $api->slug ) {
+                               $status = 'update_available';
+                               $update_file = $file;
+                               $version = $plugin->new_version;
+                               if ( current_user_can('update_plugins') )
+                                       $url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
+                               break;
+                       }
+               }
+       }
+
+       if ( 'install' == $status ) {
+               if ( is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
+                       $installed_plugin = get_plugins('/' . $api->slug);
+                       if ( empty($installed_plugin) ) {
+                               if ( current_user_can('install_plugins') )
+                                       $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
+                       } else {
+                               $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'], '=') ){
+                                       $status = 'latest_installed';
+                               } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
+                                       $status = 'newer_installed';
+                                       $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
+                                       if ( ! $loop ) {
+                                               delete_site_transient('update_plugins');
+                                               wp_update_plugins();
+                                               return install_plugin_install_status($api, true);
+                                       }
+                               }
+                       }
+               } else {
+                       // "install" & no directory with that slug
+                       if ( current_user_can('install_plugins') )
+                               $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
+               }
+       }
+       if ( isset($_GET['from']) )
+               $url .= '&amp;from=' . urlencode(stripslashes($_GET['from']));
+
+       return compact('status', 'url', 'version');
+}
+
 /**
  * Display plugin information in dialog box form.
  *
@@ -416,7 +505,7 @@ function install_plugin_information() {
                $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 ]) )
+       if ( empty($section) || ! isset($api->sections[ $section ]) )
                $section = array_shift( $section_titles = array_keys((array)$api->sections) );
 
        iframe_header( __('Plugin Install') );
@@ -437,66 +526,30 @@ function install_plugin_information() {
        echo "</div>\n";
        ?>
        <div class="alignright fyi">
-               <?php if ( ! empty($api->download_link) ) : ?>
+               <?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>
                <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_transient('update_plugins');
-                       if ( is_object( $update_plugins ) ) {
-                               foreach ( (array)$update_plugins->response as $file => $plugin ) {
-                                       if ( $plugin->slug === $api->slug ) {
-                                               $type = 'update_available';
-                                               $update_file = $file;
-                                               break;
-                                       }
-                               }
-                       }
-                       if ( 'install' == $type && is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
-                               $installed_plugin = get_plugins('/' . $api->slug);
-                               if ( ! empty($installed_plugin) ) {
-                                       $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
-                                       if ( 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_transient('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('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
-                                       endif;
+               $status = install_plugin_install_status($api);
+               switch ( $status['status'] ) {
+                       case 'install':
+                               if ( $status['url'] )
+                                       echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
                                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;
+                       case 'update_available':
+                               if ( $status['url'] )
+                                       echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
                                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;
+                       case 'newer_installed':
+                               echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
                                break;
-                               case 'latest_installed':
-                                       if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
-                                       ?><a><?php _e('Latest Version Installed') ?></a><?php
-                                       endif;
+                       case 'latest_installed':
+                               echo '<a>' . __('Latest Version Installed') . '</a>';
                                break;
-                       endswitch; ?>
+               }
+               ?>
                </p>
                <?php endif; ?>
-               <h2 class="mainheader"><?php _e('FYI') ?></h2>
+               <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI') ?></h2>
                <ul>
 <?php if ( ! empty($api->version) ) : ?>
                        <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
index b09f610244b6a81905fe8df12bbb0c3014f151e2..2ff21f8c906211f4a6d88019e96954aa77048a1b 100644 (file)
@@ -29,6 +29,9 @@
  *             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.
+ * Network: Optional. Specify "Network: true" to require that a plugin is activated
+ *             across all sites in an installation. This will prevent a plugin from being
+ *             activated on a single site when Multisite is enabled.
  *  * / # Remove the space to close comment
  * </code>
  *
@@ -43,6 +46,7 @@
  *             'PluginURI' - Plugin web site address.
  *             'TextDomain' - Plugin's text domain for localization.
  *             'DomainPath' - Plugin's relative directory path to .mo files.
+ *             'Network' - Boolean. Whether the plugin can only be activated network wide.
  *
  * 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
  */
 function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
 
-       $default_headers = array( 
-               'Name' => 'Plugin Name', 
-               'PluginURI' => 'Plugin URI', 
-               'Version' => 'Version', 
-               'Description' => 'Description', 
-               'Author' => 'Author', 
-               'AuthorURI' => 'Author URI', 
-               'TextDomain' => 'Text Domain', 
-               'DomainPath' => 'Domain Path' 
-               );
+       $default_headers = array(
+               'Name' => 'Plugin Name',
+               'PluginURI' => 'Plugin URI',
+               'Version' => 'Version',
+               'Description' => 'Description',
+               'Author' => 'Author',
+               'AuthorURI' => 'Author URI',
+               'TextDomain' => 'Text Domain',
+               'DomainPath' => 'Domain Path',
+               'Network' => 'Network',
+               // Site Wide Only is deprecated in favor of Network.
+               '_sitewide' => 'Site Wide Only',
+       );
 
        $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' );
 
+       // Site Wide Only is the old header for Network
+       if ( empty( $plugin_data['Network'] ) && ! empty( $plugin_data['_sitewide'] ) ) {
+               _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The <code>%1$s</code> plugin header is deprecated. Use <code>%2$s</code> instead.' ), 'Site Wide Only: true', 'Network: true' ) );
+               $plugin_data['Network'] = $plugin_data['_sitewide'];
+       }
+       $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
+       unset( $plugin_data['_sitewide'] );
+
        //For backward compatibility by default Title is the same as Name.
        $plugin_data['Title'] = $plugin_data['Name'];
 
@@ -91,9 +106,9 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
 
 function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {
 
-       //Translate fields
-       if( $translate && ! empty($plugin_data['TextDomain']) ) {
-               if( ! empty( $plugin_data['DomainPath'] ) )
+       //Translate fields30
+       if ( $translate && ! empty($plugin_data['TextDomain']) ) {
+               if ( ! empty( $plugin_data['DomainPath'] ) )
                        load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']);
                else
                        load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
@@ -113,7 +128,7 @@ function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup =
                        $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']) )
+               if ( ! empty($plugin_data['Author']) )
                        $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
        }
 
@@ -198,7 +213,7 @@ function get_plugins($plugin_folder = '') {
 
        $wp_plugins = array ();
        $plugin_root = WP_PLUGIN_DIR;
-       if( !empty($plugin_folder) )
+       if ( !empty($plugin_folder) )
                $plugin_root .= $plugin_folder;
 
        // Files in wp-content/plugins directory
@@ -223,11 +238,14 @@ function get_plugins($plugin_folder = '') {
                                        $plugin_files[] = $file;
                        }
                }
+       } else {
+               return $wp_plugins;
        }
+
        @closedir( $plugins_dir );
        @closedir( $plugins_subdir );
 
-       if ( !$plugins_dir || empty($plugin_files) )
+       if ( empty($plugin_files) )
                return $wp_plugins;
 
        foreach ( $plugin_files as $plugin_file ) {
@@ -250,6 +268,126 @@ function get_plugins($plugin_folder = '') {
        return $wp_plugins;
 }
 
+/**
+ * Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.
+ *
+ * WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).
+ *
+ * @since 3.0.0
+ * @return array Key is the mu-plugin file path and the value is an array of the mu-plugin data.
+ */
+function get_mu_plugins() {
+       $wp_plugins = array();
+       // Files in wp-content/mu-plugins directory
+       $plugin_files = array();
+
+       if ( ! is_dir( WPMU_PLUGIN_DIR ) )
+               return $wp_plugins;
+       if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) {
+               while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
+                       if ( substr( $file, -4 ) == '.php' )
+                               $plugin_files[] = $file;
+               }
+       } else {
+               return $wp_plugins;
+       }
+
+       @closedir( $plugins_dir );
+
+       if ( empty($plugin_files) )
+               return $wp_plugins;
+
+       foreach ( $plugin_files as $plugin_file ) {
+               if ( !is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) )
+                       continue;
+
+               $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.
+
+               if ( empty ( $plugin_data['Name'] ) )
+                       $plugin_data['Name'] = $plugin_file;
+
+               $wp_plugins[ $plugin_file ] = $plugin_data;
+       }
+
+       if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden
+               unset( $wp_plugins['index.php'] );
+
+       uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
+
+       return $wp_plugins;
+}
+
+/**
+ * Check the wp-content directory and retrieve all drop-ins with any plugin data.
+ *
+ * @since 3.0.0
+ * @return array Key is the file path and the value is an array of the plugin data.
+ */
+function get_dropins() {
+       $dropins = array();
+       $plugin_files = array();
+
+       $_dropins = _get_dropins();
+
+       // These exist in the wp-content directory
+       if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) {
+               while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
+                       if ( isset( $_dropins[ $file ] ) )
+                               $plugin_files[] = $file;
+               }
+       } else {
+               return $dropins;
+       }
+
+       @closedir( $plugins_dir );
+
+       if ( empty($plugin_files) )
+               return $dropins;
+
+       foreach ( $plugin_files as $plugin_file ) {
+               if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) )
+                       continue;
+               $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.
+               if ( empty( $plugin_data['Name'] ) )
+                       $plugin_data['Name'] = $plugin_file;
+               $dropins[ $plugin_file ] = $plugin_data;
+       }
+
+       uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' ));
+
+       return $dropins;
+}
+
+/**
+ * Returns drop-ins that WordPress uses.
+ *
+ * Includes Multisite drop-ins only when is_multisite()
+ *
+ * @since 3.0.0
+ * @return array Key is file name. The value is an array, with the first value the
+ *     purpose of the drop-in and the second value the name of the constant that must be
+ *     true for the drop-in to be used, or true if no constant is required.
+ */
+function _get_dropins() {
+       $dropins = array(
+               'advanced-cache.php' => array( __( 'Advanced caching plugin.'       ), 'WP_CACHE' ), // WP_CACHE
+               'db.php'             => array( __( 'Custom database class.'         ), true ), // auto on load
+               'db-error.php'       => array( __( 'Custom database error message.' ), true ), // auto on error
+               'install.php'        => array( __( 'Custom install script.'         ), true ), // auto on install
+               'maintenance.php'    => array( __( 'Custom maintenance message.'    ), true ), // auto on maintenance
+               'object-cache.php'   => array( __( 'External object cache.'         ), true ), // auto on load
+       );
+
+       if ( is_multisite() ) {
+               $dropins['sunrise.php'       ] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); // SUNRISE
+               $dropins['blog-deleted.php'  ] = array( __( 'Custom site deleted message.'   ), true ); // auto on deleted blog
+               $dropins['blog-inactive.php' ] = array( __( 'Custom site inactive message.'  ), true ); // auto on inactive blog
+               $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // auto on archived or spammed blog
+       }
+
+       return $dropins;
+}
+
 /**
  * Check whether the plugin is active by checking the active_plugins list.
  *
@@ -258,8 +396,46 @@ function get_plugins($plugin_folder = '') {
  * @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, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
+function is_plugin_active( $plugin ) {
+       return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
+}
+
+/**
+ * Check whether the plugin is active for the entire network.
+ *
+ * @since 3.0.0
+ *
+ * @param string $plugin Base plugin path from plugins directory.
+ * @return bool True, if active for the network, otherwise false.
+ */
+function is_plugin_active_for_network( $plugin ) {
+       if ( !is_multisite() )
+               return false;
+
+       $plugins = get_site_option( 'active_sitewide_plugins');
+       if ( isset($plugins[$plugin]) )
+               return true;
+
+       return false;
+}
+
+/**
+ * Checks for "Network: true" in the plugin header to see if this should
+ * be activated only as a network wide plugin. The plugin would also work
+ * when Multisite is not enabled.
+ *
+ * Checks for "Site Wide Only: true" for backwards compatibility.
+ *
+ * @since 3.0.0
+ *
+ * @param $file Plugin to check
+ * $return bool True if plugin is network only, false otherwise.
+ */
+function is_network_only_plugin( $plugin ) {
+       $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
+       if ( $plugin_data )
+               return $plugin_data['Network'];
+       return false;
 }
 
 /**
@@ -284,11 +460,18 @@ function is_plugin_active($plugin) {
  *
  * @param string $plugin Plugin path to main plugin file with plugin data.
  * @param string $redirect Optional. URL to redirect to.
+ * @param bool $network_wide Whether to enable the plugin for all sites in the network or just the current site.  Multisite only. Default is false.
  * @return WP_Error|null WP_Error on invalid file or null on success.
  */
-function activate_plugin($plugin, $redirect = '') {
-       $current = get_option('active_plugins');
-       $plugin = plugin_basename(trim($plugin));
+function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
+       $plugin  = plugin_basename( trim( $plugin ) );
+
+       if ( is_multisite() && ( $network_wide || is_network_only_plugin($plugin) ) ) {
+               $network_wide = true;
+               $current = get_site_option( 'active_sitewide_plugins', array() );
+       } else {
+               $current = get_option( 'active_plugins', array() );
+       }
 
        $valid = validate_plugin($plugin);
        if ( is_wp_error($valid) )
@@ -298,13 +481,22 @@ function activate_plugin($plugin, $redirect = '') {
                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);
+               include(WP_PLUGIN_DIR . '/' . $plugin);
                do_action( 'activate_plugin', trim( $plugin) );
-               update_option('active_plugins', $current);
+               if ( $network_wide ) {
+                       $current[$plugin] = time();
+                       update_site_option( 'active_sitewide_plugins', $current );
+               } else {
+                       $current[] = $plugin;
+                       sort($current);
+                       update_option('active_plugins', $current);
+               }
                do_action( 'activate_' . trim( $plugin ) );
                do_action( 'activated_plugin', trim( $plugin) );
+               if ( ob_get_length() > 0 ) {
+                       $output = ob_get_clean();
+                       return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
+               }
                ob_end_clean();
        }
 
@@ -322,23 +514,30 @@ function activate_plugin($plugin, $redirect = '') {
  * @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 ) {
+       $network_current = get_site_option( 'active_sitewide_plugins', array() );
+       $current = get_option( 'active_plugins', array() );
+       $do_blog = $do_network = false;
 
-       if ( !is_array($plugins) )
-               $plugins = array($plugins);
-
-       foreach ( $plugins as $plugin ) {
+       foreach ( (array) $plugins as $plugin ) {
                $plugin = plugin_basename($plugin);
-               if( ! is_plugin_active($plugin) )
+               if ( ! is_plugin_active($plugin) )
                        continue;
                if ( ! $silent )
                        do_action( 'deactivate_plugin', trim( $plugin ) );
 
-               $key = array_search( $plugin, (array) $current );
-
-               if ( false !== $key )
-                       array_splice( $current, $key, 1 );
+               if ( is_plugin_active_for_network($plugin) ) {
+                       // Deactivate network wide
+                       $do_network = true;
+                       unset( $network_current[ $plugin ] );
+               } else {
+                       // Deactivate for this blog only
+                       $key = array_search( $plugin, (array) $current );
+                       if ( false !== $key ) {
+                               $do_blog = true;
+                               array_splice( $current, $key, 1 );
+                       }
+               }
 
                //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.
                if ( ! $silent ) {
@@ -347,7 +546,10 @@ function deactivate_plugins($plugins, $silent= false) {
                }
        }
 
-       update_option('active_plugins', $current);
+       if ( $do_blog )
+               update_option('active_plugins', $current);
+       if ( $do_network )
+               update_site_option( 'active_sitewide_plugins', $network_current );
 }
 
 /**
@@ -362,9 +564,10 @@ function deactivate_plugins($plugins, $silent= false) {
  *
  * @param string|array $plugins
  * @param string $redirect Redirect to page after successful activation.
+ * @param bool $network_wide Whether to enable the plugin for all sites in the network.
  * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
  */
-function activate_plugins($plugins, $redirect = '') {
+function activate_plugins($plugins, $redirect = '', $network_wide) {
        if ( !is_array($plugins) )
                $plugins = array($plugins);
 
@@ -372,7 +575,7 @@ function activate_plugins($plugins, $redirect = '') {
        foreach ( (array) $plugins as $plugin ) {
                if ( !empty($redirect) )
                        $redirect = add_query_arg('plugin', $plugin, $redirect);
-               $result = activate_plugin($plugin, $redirect);
+               $result = activate_plugin($plugin, $redirect, $network_wide);
                if ( is_wp_error($result) )
                        $errors[$plugin] = $result;
        }
@@ -398,7 +601,7 @@ function activate_plugins($plugins, $redirect = '') {
 function delete_plugins($plugins, $redirect = '' ) {
        global $wp_filesystem;
 
-       if( empty($plugins) )
+       if ( empty($plugins) )
                return false;
 
        $checked = array();
@@ -410,7 +613,7 @@ function delete_plugins($plugins, $redirect = '' ) {
        if ( false === ($credentials = request_filesystem_credentials($url)) ) {
                $data = ob_get_contents();
                ob_end_clean();
-               if( ! empty($data) ){
+               if ( ! empty($data) ){
                        include_once( ABSPATH . 'wp-admin/admin-header.php');
                        echo $data;
                        include( ABSPATH . 'wp-admin/admin-footer.php');
@@ -423,7 +626,7 @@ function delete_plugins($plugins, $redirect = '' ) {
                request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
                $data = ob_get_contents();
                ob_end_clean();
-               if( ! empty($data) ){
+               if ( ! empty($data) ){
                        include_once( ABSPATH . 'wp-admin/admin-header.php');
                        echo $data;
                        include( ABSPATH . 'wp-admin/admin-footer.php');
@@ -436,7 +639,7 @@ function delete_plugins($plugins, $redirect = '' ) {
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
        if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
+               return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors);
 
        //Get the base plugin folder
        $plugins_dir = $wp_filesystem->wp_plugins_dir();
@@ -464,37 +667,50 @@ function delete_plugins($plugins, $redirect = '' ) {
        }
 
        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
-       if ( $current = get_transient('update_plugins') ) {
+       if ( $current = get_site_transient('update_plugins') ) {
                unset( $current->response[ $plugin_file ] );
-               set_transient('update_plugins', $current);
+               set_site_transient('update_plugins', $current);
        }
 
        return true;
 }
 
+/**
+ * Validate active plugins
+ *
+ * Validate all active plugins, deactivates invalid and
+ * returns an array of deactivated ones.
+ *
+ * @since unknown
+ * @return array invalid plugins, plugin as key, error as value
+ */
 function validate_active_plugins() {
-       $check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') );
+       $plugins = get_option( 'active_plugins', array() );
+       // validate vartype: array
+       if ( ! is_array( $plugins ) ) {
+               update_option( 'active_plugins', array() );
+               $plugins = array();
+       }
 
-       // Sanity check.  If the active plugin list is not an array, make it an
-       // empty array.
-       if ( !is_array($check_plugins) ) {
-               update_option('active_plugins', array());
-               return;
+       if ( is_multisite() && is_super_admin() ) {
+               $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
+               $plugins = array_merge( $plugins, array_keys( $network_plugins ) );
        }
 
-       //Invalid is any plugin that is deactivated due to error.
+       if ( empty( $plugins ) )
+               return;
+
        $invalid = array();
 
-       // If a plugin file does not exist, remove it from the list of active
-       // plugins.
-       foreach ( $check_plugins as $check_plugin ) {
-               $result = validate_plugin($check_plugin);
+       // invalid plugins get deactivated
+       foreach ( $plugins as $plugin ) {
+               $result = validate_plugin( $plugin );
                if ( is_wp_error( $result ) ) {
-                       $invalid[$check_plugin] = $result;
-                       deactivate_plugins( $check_plugin, true);
+                       $invalid[$plugin] = $result;
+                       deactivate_plugins( $plugin, true );
                }
        }
        return $invalid;
@@ -583,67 +799,135 @@ function uninstall_plugin($plugin) {
 // Menu
 //
 
-function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '', $position = NULL ) {
-       global $menu, $admin_page_hooks, $_registered_pages;
+/**
+ * Add a top level menu page
+ *
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ * @param string $icon_url The url to the icon to be used for this menu
+ * @param int $position The position in the menu order this one should appear
+ */
+function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) {
+       global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
+
+       $menu_slug = plugin_basename( $menu_slug );
 
-       $file = plugin_basename( $file );
+       $admin_page_hooks[$menu_slug] = sanitize_title( $menu_title );
 
-       $admin_page_hooks[$file] = sanitize_title( $menu_title );
+       $hookname = get_plugin_page_hookname( $menu_slug, '' );
 
-       $hookname = get_plugin_page_hookname( $file, '' );
-       if (!empty ( $function ) && !empty ( $hookname ) && current_user_can( $access_level ) )
+       if ( !empty( $function ) && !empty( $hookname ) && current_user_can( $capability ) )
                add_action( $hookname, $function );
 
-       if ( empty($icon_url) ) {
-               $icon_url = 'images/generic.png';
-       } elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) {
+       if ( empty($icon_url) )
+               $icon_url = esc_url( admin_url( 'images/generic.png' ) );
+       elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )
                $icon_url = 'https://' . substr($icon_url, 7);
-       }
 
-       $new_menu = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
+       $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
-       if ( NULL === $position  ) {
+       if ( null === $position  )
                $menu[] = $new_menu;
-       } else {
+       else
                $menu[$position] = $new_menu;
-       }
 
        $_registered_pages[$hookname] = true;
 
+       // No parent as top level
+       $_parent_pages[$menu_slug] = false;
+
        return $hookname;
 }
 
-function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
+/**
+ * Add a top level menu page in the 'objects' section
+ *
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ * @param string $icon_url The url to the icon to be used for this menu
+ */
+function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
        global $_wp_last_object_menu;
 
        $_wp_last_object_menu++;
 
-       return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_object_menu);
+       return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
 }
 
-function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
+/**
+ * Add a top level menu page in the 'utility' section
+ *
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ * @param string $icon_url The url to the icon to be used for this menu
+ */
+function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
        global $_wp_last_utility_menu;
 
        $_wp_last_utility_menu++;
 
-       return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_utility_menu);
+       return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
 }
 
-function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
+/**
+ * Add a sub menu page
+ *
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page)
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
        global $submenu;
        global $menu;
        global $_wp_real_parent_file;
        global $_wp_submenu_nopriv;
        global $_registered_pages;
+       global $_parent_pages;
 
-       $file = plugin_basename( $file );
+       $menu_slug = plugin_basename( $menu_slug );
+       $parent_slug = plugin_basename( $parent_slug);
 
-       $parent = plugin_basename( $parent);
-       if ( isset( $_wp_real_parent_file[$parent] ) )
-               $parent = $_wp_real_parent_file[$parent];
+       if ( isset( $_wp_real_parent_file[$parent_slug] ) )
+               $parent_slug = $_wp_real_parent_file[$parent_slug];
 
-       if ( !current_user_can( $access_level ) ) {
-               $_wp_submenu_nopriv[$parent][$file] = true;
+       if ( !current_user_can( $capability ) ) {
+               $_wp_submenu_nopriv[$parent_slug][$menu_slug] = true;
                return false;
        }
 
@@ -651,79 +935,272 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
        // as the first item in the submenu.  If the submenu file is the same as the
        // parent file someone is trying to link back to the parent manually.  In
        // this case, don't automatically add a link back to avoid duplication.
-       if (!isset( $submenu[$parent] ) && $file != $parent  ) {
+       if (!isset( $submenu[$parent_slug] ) && $menu_slug != $parent_slug  ) {
                foreach ( (array)$menu as $parent_menu ) {
-                       if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
-                               $submenu[$parent][] = $parent_menu;
+                       if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) )
+                               $submenu[$parent_slug][] = $parent_menu;
                }
        }
 
-       $submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title );
+       $submenu[$parent_slug][] = array ( $menu_title, $capability, $menu_slug, $page_title );
 
-       $hookname = get_plugin_page_hookname( $file, $parent);
+       $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug);
        if (!empty ( $function ) && !empty ( $hookname ))
                add_action( $hookname, $function );
 
        $_registered_pages[$hookname] = true;
        // backwards-compatibility for plugins using add_management page.  See wp-admin/admin.php for redirect from edit.php to tools.php
-       if ( 'tools.php' == $parent )
-               $_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
+       if ( 'tools.php' == $parent_slug )
+               $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true;
+
+       // No parent as top level
+       $_parent_pages[$menu_slug] = $parent_slug;
 
        return $hookname;
 }
 
 /**
  * Add sub menu page to the tools main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the 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
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
  */
-function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
-       return add_submenu_page( 'tools.php', $page_title, $menu_title, $access_level, $file, $function );
+function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function );
 }
 
-function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
-       return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function );
+/**
+ * Add sub menu page to the options main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function );
 }
 
-function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
-       return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
+/**
+ * Add sub menu page to the themes main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
+}
+
+/**
+ * Add sub menu page to the plugins main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function );
 }
 
-function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+/**
+ * Add sub menu page to the Users/Profile main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
        if ( current_user_can('edit_users') )
                $parent = 'users.php';
        else
                $parent = 'profile.php';
-       return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
+       return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function );
+}
+/**
+ * Add sub menu page to the Dashboard main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Add sub menu page to the posts main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Add sub menu page to the media main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Add sub menu page to the links main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Add sub menu page to the pages main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Add sub menu page to the comments main menu.
+*
+ * This function takes a capability which will be used to determine whether
+ * or not a page is included in the menu.
+ *
+ * The function which is hooked in to handle the output of the page must check
+ * that the user has the required capability as well.
+ *
+ * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
+ * @param string $menu_title The text to be used for the menu
+ * @param string $capability The capability required for this menu to be displayed to the user.
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param callback $function The function to be called to output the content for this page.
+ */
+function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
+       return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $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 );
+/**
+ * Get the url to access a particular menu page based on the slug it was registered with.
+ *
+ * If the slug hasn't been registered properly no url will be returned
+ *
+ * @since 3.0
+ *
+ * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
+ * @param bool $echo Whether or not to echo the url - default is true
+ * @return string the url
+ */
+function menu_page_url($menu_slug, $echo = true) {
+       global $_parent_pages;
+
+       if ( isset( $_parent_pages[$menu_slug] ) ) {
+               if ( $_parent_pages[$menu_slug] ) {
+                       $url = admin_url( add_query_arg( 'page', $menu_slug, $_parent_pages[$menu_slug] ) );
+               } else {
+                       $url = admin_url('admin.php?page=' . $menu_slug);
+               }
+       } else {
+               $url = '';
+       }
+
+       $url = esc_url($url);
+
+       if ( $echo )
+               echo $url;
+
+       return $url;
 }
 
 //
@@ -735,6 +1212,7 @@ function get_admin_page_parent( $parent = '' ) {
        global $menu;
        global $submenu;
        global $pagenow;
+       global $typenow;
        global $plugin_page;
        global $_wp_real_parent_file;
        global $_wp_menu_nopriv;
@@ -745,14 +1223,15 @@ function get_admin_page_parent( $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 ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
                foreach ( (array)$menu as $parent_menu ) {
@@ -782,7 +1261,10 @@ function get_admin_page_parent( $parent = '' ) {
                foreach ( $submenu[$parent] as $submenu_array ) {
                        if ( isset( $_wp_real_parent_file[$parent] ) )
                                $parent = $_wp_real_parent_file[$parent];
-                       if ( $submenu_array[2] == $pagenow ) {
+                       if ( !empty($typenow) && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) {
+                               $parent_file = $parent;
+                               return $parent;
+                       } elseif ( $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
                                $parent_file = $parent;
                                return $parent;
                        } else
@@ -804,10 +1286,10 @@ function get_admin_page_title() {
        global $submenu;
        global $pagenow;
        global $plugin_page;
+       global $typenow;
 
-       if ( isset( $title ) && !empty ( $title ) ) {
+       if ( ! empty ( $title ) )
                return $title;
-       }
 
        $hook = get_plugin_page_hook( $plugin_page, $pagenow );
 
@@ -830,11 +1312,17 @@ function get_admin_page_title() {
                        }
                }
        } else {
-               foreach (array_keys( $submenu ) as $parent) {
+               foreach ( array_keys( $submenu ) as $parent ) {
                        foreach ( $submenu[$parent] as $submenu_array ) {
                                if ( isset( $plugin_page ) &&
-                                       ($plugin_page == $submenu_array[2] ) &&
-                                       (($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
+                                       ( $plugin_page == $submenu_array[2] ) &&
+                                       (
+                                               ( $parent == $pagenow ) ||
+                                               ( $parent == $plugin_page ) ||
+                                               ( $plugin_page == $hook ) ||
+                                               ( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) ||
+                                               ( !empty($typenow) && $parent == $pagenow . '?post_type=' . $typenow)
+                                       )
                                        ) {
                                                $title = $submenu_array[3];
                                                return $submenu_array[3];
@@ -852,12 +1340,12 @@ function get_admin_page_title() {
                                }
                        }
                }
-               if ( !isset($title) || empty ( $title ) ) {
+               if ( empty ( $title ) ) {
                        foreach ( $menu as $menu_array ) {
                                if ( isset( $plugin_page ) &&
-                                       ($plugin_page == $menu_array[2] ) &&
-                                       ($pagenow == 'admin.php' ) &&
-                                       ($parent1 == $menu_array[2] ) )
+                                       ( $plugin_page == $menu_array[2] ) &&
+                                       ( $pagenow == 'admin.php' ) &&
+                                       ( $parent1 == $menu_array[2] ) )
                                        {
                                                $title = $menu_array[3];
                                                return $menu_array[3];
@@ -895,7 +1383,7 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
 
        $plugin_name = preg_replace( '!\.php!', '', $plugin_page );
 
-       return $page_type.'_page_'.$plugin_name;
+       return $page_type . '_page_' . $plugin_name;
 }
 
 function user_can_access_admin_page() {
@@ -917,6 +1405,7 @@ function user_can_access_admin_page() {
                        return false;
 
                $hookname = get_plugin_page_hookname($plugin_page, $parent);
+
                if ( !isset($_registered_pages[$hookname]) )
                        return false;
        }
@@ -983,51 +1472,37 @@ function user_can_access_admin_page() {
  * @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);
-}
+function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
+       global $new_whitelist_options;
 
-/**
- * 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);
-}
+       if ( 'misc' == $option_group ) {
+               _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
+               $option_group = 'general';
+       }
 
-/**
- * {@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}}
+ * Unregister a setting
  *
- * @since unknown
+ * @since 2.7.0
  *
  * @param unknown_type $option_group
  * @param unknown_type $option_name
  * @param unknown_type $sanitize_callback
+ * @return unknown
  */
-function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
+function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
        global $new_whitelist_options;
+
+       if ( 'misc' == $option_group ) {
+               _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
+               $option_group = 'general';
+       }
+
        $pos = array_search( $option_name, (array) $new_whitelist_options );
        if ( $pos !== false )
                unset( $new_whitelist_options[ $option_group ][ $pos ] );
@@ -1063,13 +1538,13 @@ add_filter( 'whitelist_options', 'option_update_filter' );
  * @return unknown
  */
 function add_option_whitelist( $new_options, $options = '' ) {
-       if( $options == '' ) {
+       if ( $options == '' )
                global $whitelist_options;
-       } else {
+       else
                $whitelist_options = $options;
-       }
-       foreach( $new_options as $page => $keys ) {
-               foreach( $keys as $key ) {
+
+       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;
@@ -1080,6 +1555,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
                        }
                }
        }
+
        return $whitelist_options;
 }
 
@@ -1093,20 +1569,21 @@ function add_option_whitelist( $new_options, $options = '' ) {
  * @return unknown
  */
 function remove_option_whitelist( $del_options, $options = '' ) {
-       if( $options == '' ) {
+       if ( $options == '' )
                global $whitelist_options;
-       } else {
+       else
                $whitelist_options = $options;
-       }
-       foreach( $del_options as $page => $keys ) {
-               foreach( $keys as $key ) {
+
+       foreach ( $del_options as $page => $keys ) {
+               foreach ( $keys as $key ) {
                        if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) {
                                $pos = array_search( $key, $whitelist_options[ $page ] );
-                               if( $pos !== false )
+                               if ( $pos !== false )
                                        unset( $whitelist_options[ $page ][ $pos ] );
                        }
                }
        }
+
        return $whitelist_options;
 }
 
index e5924f1dd904f84515a59c1ac8f3334c04bfd33c..5f8b6fd0f2fedeeacd104ea7a64c4e59c58244c8 100644 (file)
@@ -31,6 +31,9 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
        if ( isset($post_data['trackback_url']) )
                $post_data['to_ping'] = $post_data['trackback_url'];
 
+       if ( !isset($post_data['user_ID']) )
+               $post_data['user_ID'] = $GLOBALS['user_ID'];
+
        if (!empty ( $post_data['post_author_override'] ) ) {
                $post_data['post_author'] = (int) $post_data['post_author_override'];
        } else {
@@ -41,16 +44,15 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
                }
        }
 
+       $ptype = get_post_type_object( $post_data['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' ) ) {
+               if ( !current_user_can( $ptype->cap->edit_others_posts ) ) {
+                       if ( 'page' == $post_data['post_type'] ) {
                                return new WP_Error( 'edit_others_pages', $update ?
                                        __( 'You are not allowed to edit pages as this user.' ) :
                                        __( 'You are not allowed to create pages as this user.' )
                                );
-                       }
-               } else {
-                       if ( !current_user_can( 'edit_others_posts' ) ) {
+                       } else {
                                return new WP_Error( 'edit_others_posts', $update ?
                                        __( 'You are not allowed to edit posts as this user.' ) :
                                        __( 'You are not allowed to post as this user.' )
@@ -64,26 +66,23 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
                $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' ) )
+       if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( !isset($post_data['post_status']) || $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']);
+       if ( isset( $post_data['ID'] ) )
+               $post_id = $post_data['ID'];
+       else
+               $post_id = false;
+       $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;
 
        // 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.
-       if ( 'page' == $post_data['post_type'] ) {
-               $publish_cap = 'publish_pages';
-               $edit_cap = 'edit_published_pages';
-       } else {
-               $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 ) )
+       if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $ptype->cap->publish_posts )) )
+               if ( $previous_status != 'publish' || !current_user_can( 'edit_post', $post_id ) )
                        $post_data['post_status'] = 'pending';
 
        if ( ! isset($post_data['post_status']) )
@@ -138,11 +137,11 @@ function edit_post( $post_data = null ) {
 
        $post_ID = (int) $post_data['post_ID'];
 
-       if ( 'page' == $post_data['post_type'] ) {
-               if ( !current_user_can( 'edit_page', $post_ID ) )
+       $ptype = get_post_type_object($post_data['post_type']);
+       if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) {
+               if ( 'page' == $post_data['post_type'] )
                        wp_die( __('You are not allowed to edit this page.' ));
-       } else {
-               if ( !current_user_can( 'edit_post', $post_ID ) )
+               else
                        wp_die( __('You are not allowed to edit this post.' ));
        }
 
@@ -157,6 +156,8 @@ function edit_post( $post_data = null ) {
        }
 
        $post_data = _wp_translate_postdata( true, $post_data );
+       if ( 'autosave' != $post_data['action']  && 'auto-draft' == $post_data['post_status'] )
+               $post_data['post_status'] = 'draft';
        if ( is_wp_error($post_data) )
                wp_die( $post_data->get_error_message() );
 
@@ -189,6 +190,8 @@ function edit_post( $post_data = null ) {
 
        add_meta( $post_ID );
 
+       update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
+
        wp_update_post( $post_data );
 
        // Reunite any orphaned attachments with their parent
@@ -213,13 +216,14 @@ function edit_post( $post_data = null ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Process the post data for the bulk editing of posts.
  *
  * 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
+ * @since 2.7.0
  *
+ * @param array $post_data Optional, the array of post data to process if not provided will use $_POST superglobal.
  * @return array
  */
 function bulk_edit_posts( $post_data = null ) {
@@ -228,12 +232,16 @@ function bulk_edit_posts( $post_data = null ) {
        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.') );
+       if ( isset($post_data['post_type']) )
+               $ptype = get_post_type_object($post_data['post_type']);
+       else
+               $ptype = get_post_type_object('post');
+
+       if ( !current_user_can( $ptype->cap->edit_posts ) ) {
+               if ( 'page' == $ptype->name )
+                       wp_die( __('You are not allowed to edit pages.'));
+               else
+                       wp_die( __('You are not allowed to edit posts.'));
        }
 
        if ( -1 == $post_data['_status'] ) {
@@ -246,7 +254,7 @@ function bulk_edit_posts( $post_data = null ) {
 
        $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' );
+       $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' );
        foreach ( $reset as $field ) {
                if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
                        unset($post_data[$field]);
@@ -259,9 +267,18 @@ function bulk_edit_posts( $post_data = null ) {
                        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);
+       $tax_input = array();
+       if ( isset($post_data['tax_input'])) {
+               foreach ( $post_data['tax_input'] as $tax_name => $terms ) {
+                       if ( empty($terms) )
+                               continue;
+                       if ( is_taxonomy_hierarchical( $tax_name ) )
+                               $tax_input[$tax_name] = array_map( 'absint', $terms );
+                       else {
+                               $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) );
+                               $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]);
+                       }
+               }
        }
 
        if ( isset($post_data['post_parent']) && ($parent = (int) $post_data['post_parent']) ) {
@@ -282,8 +299,9 @@ function bulk_edit_posts( $post_data = null ) {
 
        $updated = $skipped = $locked = array();
        foreach ( $post_IDs as $post_ID ) {
+               $post_type_object = get_post_type_object( get_post_type( $post_ID ) );
 
-               if ( isset($children) && in_array($post_ID, $children) ) {
+               if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) {
                        $skipped[] = $post_ID;
                        continue;
                }
@@ -293,14 +311,26 @@ function bulk_edit_posts( $post_data = null ) {
                        continue;
                }
 
-               if ( isset($new_cats) ) {
-                       $cats = (array) wp_get_post_categories($post_ID);
-                       $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
+               $tax_names = get_object_taxonomies( get_post($post_ID) );
+               foreach ( $tax_names as $tax_name ) {
+                       $taxonomy_obj = get_taxonomy($tax_name);
+                       if (  isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) )
+                               $new_terms = $tax_input[$tax_name];
+                       else
+                               $new_terms = array();
+
+                       if ( $taxonomy_obj->hierarchical )
+                               $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'ids') );
+                       else
+                               $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'names') );
+
+                       $post_data['tax_input'][$tax_name] = array_merge( $current_terms, $new_terms );
                }
 
-               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) );
+               if ( isset($new_cats) && in_array( 'category', $tax_names ) ) {
+                       $cats = (array) wp_get_post_categories($post_ID);
+                       $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
+                       unset( $post_data['tax_input']['category'] );
                }
 
                $post_data['ID'] = $post_ID;
@@ -323,9 +353,11 @@ function bulk_edit_posts( $post_data = null ) {
  *
  * @since unknown
  *
- * @return unknown
+ *@param string A post type string, defaults to 'post'.
+ * @return object stdClass object containing all the default post data as attributes
  */
-function get_default_post_to_edit() {
+function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
+       global $wpdb;
 
        $post_title = '';
        if ( !empty( $_REQUEST['post_title'] ) )
@@ -339,36 +371,45 @@ function get_default_post_to_edit() {
        if ( !empty( $_REQUEST['excerpt'] ) )
                $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
 
-       $post->ID = 0;
+       if ( $create_in_db ) {
+               // Cleanup old auto-drafts more than 7 days old
+               $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
+               foreach ( (array) $old_posts as $delete )
+                       wp_delete_post( $delete, true ); // Force delete
+               $post = get_post( wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ) );
+       } else {
+               $post->ID = 0;
+               $post->post_author = '';
+               $post->post_date = '';
+               $post->post_date_gmt = '';
+               $post->post_password = '';
+               $post->post_type = $post_type;
+               $post->post_status = 'draft';
+               $post->to_ping = '';
+               $post->pinged = '';
+               $post->comment_status = get_option( 'default_comment_status' );
+               $post->ping_status = get_option( 'default_ping_status' );
+               $post->post_pingback = get_option( 'default_pingback_flag' );
+               $post->post_category = get_option( 'default_category' );
+               $post->page_template = 'default';
+               $post->post_parent = 0;
+               $post->menu_order = 0;
+       }
+
+       $post->post_content = apply_filters( 'default_content', $post_content, $post );
+       $post->post_title   = apply_filters( 'default_title',   $post_title, $post   );
+       $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
        $post->post_name = '';
-       $post->post_author = '';
-       $post->post_date = '';
-       $post->post_date_gmt = '';
-       $post->post_password = '';
-       $post->post_status = 'draft';
-       $post->post_type = 'post';
-       $post->to_ping = '';
-       $post->pinged = '';
-       $post->comment_status = get_option( 'default_comment_status' );
-       $post->ping_status = get_option( 'default_ping_status' );
-       $post->post_pingback = get_option( 'default_pingback_flag' );
-       $post->post_category = get_option( 'default_category' );
-       $post->post_content = apply_filters( 'default_content', $post_content);
-       $post->post_title = apply_filters( 'default_title', $post_title );
-       $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
-       $post->page_template = 'default';
-       $post->post_parent = 0;
-       $post->menu_order = 0;
 
        return $post;
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get the default page information to use.
  *
- * @since unknown
+ * @since 2.5.0
  *
- * @return unknown
+ * @return object stdClass object containing all the default post data as attributes
  */
 function get_default_page_to_edit() {
        $page = get_default_post_to_edit();
@@ -445,16 +486,21 @@ function post_exists($title, $content = '', $date = '') {
 function wp_write_post() {
        global $user_ID;
 
-       if ( 'page' == $_POST['post_type'] ) {
-               if ( !current_user_can( 'edit_pages' ) )
-                       return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
-       } else {
-               if ( !current_user_can( 'edit_posts' ) )
-                       return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
-       }
 
+       if ( isset($_POST['post_type']) )
+               $ptype = get_post_type_object($_POST['post_type']);
+       else
+               $ptype = get_post_type_object('post');
+
+       if ( !current_user_can( $ptype->cap->edit_posts ) ) {
+               if ( 'page' == $ptype->name )
+                       return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this site.' ) );
+               else
+                       return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this site.' ) );
+       }
 
        // Check for autosave collisions
+       // Does this need to be updated? ~ Mark
        $temp_id = false;
        if ( isset($_POST['temp_ID']) ) {
                $temp_id = (int) $_POST['temp_ID'];
@@ -502,7 +548,10 @@ function wp_write_post() {
 
        add_meta( $post_ID );
 
+       add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
+
        // Reunite any orphaned attachments with their parent
+       // Does this need to be udpated? ~ Mark
        if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
                $draft_ids = array();
        if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
@@ -533,7 +582,7 @@ function wp_write_post() {
  */
 function write_post() {
        $result = wp_write_post();
-       if( is_wp_error( $result ) )
+       if ( is_wp_error( $result ) )
                wp_die( $result->get_error_message() );
        else
                return $result;
@@ -577,8 +626,7 @@ function add_meta( $post_ID ) {
                        return false;
 
                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->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) );
                do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue );
 
                return $wpdb->insert_id;
@@ -670,8 +718,8 @@ function has_meta( $postid ) {
  * @since unknown
  *
  * @param unknown_type $meta_id
- * @param unknown_type $meta_key
- * @param unknown_type $meta_value
+ * @param unknown_type $meta_key Expect Slashed
+ * @param unknown_type $meta_value Expect Slashed
  * @return unknown
  */
 function update_meta( $meta_id, $meta_key, $meta_value ) {
@@ -679,6 +727,8 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
 
        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
 
+       $meta_key = stripslashes($meta_key);
+
        if ( in_array($meta_key, $protected) )
                return false;
 
@@ -738,8 +788,8 @@ function _fix_attachment_links( $post_ID ) {
                if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
                        $attachment['post_parent'] = $post_ID;
                        // Escape data pulled from DB.
-                       $attachment = add_magic_quotes( $attachment);
-                       wp_update_post( $attachment);
+                       $attachment = add_magic_quotes( $attachment );
+                       wp_update_post( $attachment );
                }
 
                $post_search[$i] = $anchor;
@@ -789,12 +839,12 @@ function _relocate_children( $old_ID, $new_ID ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get all the possible statuses for a post_type
  *
- * @since unknown
+ * @since 2.5.0
  *
- * @param unknown_type $type
- * @return unknown
+ * @param string $type The post_type you want the statuses for
+ * @return array As array of all the statuses for the supplied post type
  */
 function get_available_post_statuses($type = 'post') {
        $stati = wp_count_posts($type);
@@ -803,35 +853,30 @@ function get_available_post_statuses($type = 'post') {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Run the wp query to fetch the posts for listing on the edit posts page
  *
- * @since unknown
+ * @since 2.5.0
  *
- * @param unknown_type $q
- * @return unknown
+ * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
+ * @return array
  */
 function wp_edit_posts_query( $q = false ) {
        if ( false === $q )
                $q = $_GET;
-       $q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
+       $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
        $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
-       $post_stati  = array(   //      array( adj, noun )
-                               'publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')),
-                               'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')),
-                               'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
-                               'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
-                               'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
-                               'trash' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')),
-                       );
-
-       $post_stati = apply_filters('post_stati', $post_stati);
-
-       $avail_post_stati = get_available_post_statuses('post');
-
-       $post_status_q = '';
-       if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
-               $post_status_q = '&post_status=' . $q['post_status'];
-               $post_status_q .= '&perm=readable';
+       $post_stati  = get_post_stati();
+
+       if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types() ) )
+               $post_type = $q['post_type'];
+       else
+               $post_type = 'post';
+
+       $avail_post_stati = get_available_post_statuses($post_type);
+
+       if ( isset($q['post_status']) && in_array( $q['post_status'], $post_stati ) ) {
+               $post_status = $q['post_status'];
+               $perm = 'readable';
        }
 
        if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
@@ -845,14 +890,26 @@ function wp_edit_posts_query( $q = false ) {
                $orderby = 'date';
        }
 
-       $posts_per_page = (int) get_user_option( 'edit_per_page', 0, false );
+       $per_page = 'edit_' . $post_type . '_per_page';
+       $posts_per_page = (int) get_user_option( $per_page );
        if ( empty( $posts_per_page ) || $posts_per_page < 1 )
                $posts_per_page = 15;
-       $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );
+       $posts_per_page = apply_filters( $per_page, $posts_per_page );
+
 
-       wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
+       $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
 
-       return array($post_stati, $avail_post_stati);
+       // Hierarchical types require special args.
+       if ( is_post_type_hierarchical( $post_type ) ) {
+               $query['orderby'] = 'menu_order title';
+               $query['order'] = 'asc';
+               $query['posts_per_page'] = -1;
+               $query['posts_per_archive_page'] = -1;
+       }
+
+       wp( $query );
+
+       return $avail_post_stati;
 }
 
 /**
@@ -903,7 +960,7 @@ function wp_edit_attachments_query( $q = false ) {
        $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
        $q['post_type'] = 'attachment';
        $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'inherit';
-       $media_per_page = (int) get_user_option( 'upload_per_page', 0, false );
+       $media_per_page = (int) get_user_option( 'upload_per_page' );
        if ( empty( $media_per_page ) || $media_per_page < 1 )
                $media_per_page = 20;
        $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page );
@@ -922,6 +979,7 @@ function wp_edit_attachments_query( $q = false ) {
 /**
  * {@internal Missing Short Description}}
  *
+ * @uses get_user_option()
  * @since unknown
  *
  * @param unknown_type $id
@@ -931,9 +989,11 @@ function wp_edit_attachments_query( $q = false ) {
 function postbox_classes( $id, $page ) {
        if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
                return '';
-       $current_user = wp_get_current_user();
-       if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
-               if ( !is_array( $closed ) ) return '';
+
+       if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
+               if ( !is_array( $closed ) ) {
+                       return '';
+               }
                return in_array( $id, $closed )? 'closed' : '';
        } else {
                return '';
@@ -945,47 +1005,51 @@ function postbox_classes( $id, $page ) {
  *
  * @since unknown
  *
- * @param int|object $id    Post ID or post object. 
- * @param string $title (optional) Title 
- * @param string $name (optional) Name 
- * @return array With two entries of type string 
+ * @param int|object $id    Post ID or post object.
+ * @param string $title (optional) Title
+ * @param string $name (optional) Name
+ * @return array With two entries of type string
  */
 function get_sample_permalink($id, $title = null, $name = null) {
        $post = &get_post($id);
-       if (!$post->ID) {
+       if ( !$post->ID )
                return array('', '');
-       }
+
+       $ptype = get_post_type_object($post->post_type);
+
        $original_status = $post->post_status;
        $original_date = $post->post_date;
        $original_name = $post->post_name;
 
        // Hack: get_permalink would return ugly permalink for
        // drafts, so we will fake, that our post is published
-       if (in_array($post->post_status, array('draft', 'pending'))) {
+       if ( in_array($post->post_status, array('draft', 'pending')) ) {
                $post->post_status = 'publish';
                $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
        }
 
-       $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
-
        // If the user wants to set a new name -- override the current one
        // Note: if empty name is supplied -- use the title instead, see #6072
-       if (!is_null($name)) {
+       if ( !is_null($name) )
                $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
-       }
+
+       $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
 
        $post->filter = 'sample';
 
        $permalink = get_permalink($post, true);
 
+       // Replace custom post_type Token with generic pagename token for ease of use.
+       $permalink = str_replace("%$post->post_type%", '%pagename%', $permalink);
+
        // Handle page hierarchy
-       if ( 'page' == $post->post_type ) {
-               $uri = get_page_uri($post->ID);
+       if ( $ptype->hierarchical ) {
+               $uri = get_page_uri($post);
                $uri = untrailingslashit($uri);
                $uri = strrev( stristr( strrev( $uri ), '/' ) );
                $uri = untrailingslashit($uri);
                if ( !empty($uri) )
-                       $uri .='/';
+                       $uri .= '/';
                $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
        }
 
@@ -1002,20 +1066,23 @@ function get_sample_permalink($id, $title = null, $name = null) {
  * sample permalink html
  *
  * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
- * 
+ *
  * @since unknown
  *
- * @param int|object $id Post ID or post object. 
- * @param string $new_title (optional) New title  
- * @param string $new_slug (optional) New slug 
- * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 
+ * @param int|object $id Post ID or post object.
+ * @param string $new_title (optional) New title
+ * @param string $new_slug (optional) New slug
+ * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
  */
 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
+       global $wpdb;
        $post = &get_post($id);
+
        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
 
        if ( 'publish' == $post->post_status ) {
-               $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
+               $ptype = get_post_type_object($post->post_type);
+               $view_post = $ptype->labels->view_item;
                $title = __('Click to edit this part of the permalink');
        } else {
                $title = __('Temporary permalink. Click to edit this part.');
@@ -1050,7 +1117,9 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
-       $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
+       $return =  '<strong>' . __('Permalink:') . "</strong>\n";
+       $return .= '<span id="sample-permalink">' . $display_link . "</span>\n";
+       $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
        if ( isset($view_post) )
@@ -1070,8 +1139,9 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
  * @return string html
  */
 function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
-       global $content_width, $_wp_additional_image_sizes;
-       $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
+       global $content_width, $_wp_additional_image_sizes, $post_ID;
+       $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
+       $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
 
        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
                $old_content_width = $content_width;
@@ -1081,8 +1151,9 @@ function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
                else
                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
                if ( !empty( $thumbnail_html ) ) {
-                       $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
-                       $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
+                       $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ID" );
+                       $content = sprintf($set_thumbnail_link, $thumbnail_html);
+                       $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
                }
                $content_width = $old_content_width;
        }
@@ -1131,10 +1202,7 @@ function wp_set_post_lock( $post_id ) {
 
        $now = time();
 
-       if ( !add_post_meta( $post->ID, '_edit_lock', $now, true ) )
-               update_post_meta( $post->ID, '_edit_lock', $now );
-       if ( !add_post_meta( $post->ID, '_edit_last', $current_user->ID, true ) )
-               update_post_meta( $post->ID, '_edit_last', $current_user->ID );
+       update_post_meta( $post->ID, '_edit_lock', $now );
 }
 
 /**
@@ -1172,6 +1240,8 @@ function _admin_notice_post_locked() {
  *
  * @uses _wp_translate_postdata()
  * @uses _wp_post_revision_fields()
+ *
+ * @return unknown
  */
 function wp_create_post_autosave( $post_id ) {
        $translated = _wp_translate_postdata( true );
@@ -1198,7 +1268,7 @@ function wp_create_post_autosave( $post_id ) {
  * Save draft or manually autosave for showing preview.
  *
  * @package WordPress
- * @since 2.7
+ * @since 2.7.0
  *
  * @uses wp_write_post()
  * @uses edit_post()
@@ -1211,7 +1281,8 @@ function wp_create_post_autosave( $post_id ) {
 function post_preview() {
 
        $post_ID = (int) $_POST['post_ID'];
-       if ( $post_ID < 1 )
+       $status = get_post_status( $post_ID );
+       if ( 'auto-draft' == $status )
                wp_die( __('Preview not available. Please save as a draft first.') );
 
        if ( isset($_POST['catslist']) )
@@ -1259,7 +1330,7 @@ function post_preview() {
  * Adds the TinyMCE editor used on the Write and Edit screens.
  *
  * @package WordPress
- * @since 2.7
+ * @since 2.7.0
  *
  * TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated
  * and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded
@@ -1270,7 +1341,7 @@ function post_preview() {
  * @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings.
  */
 function wp_tiny_mce( $teeny = false, $settings = false ) {
-       global $concatenate_scripts, $compress_scripts, $tinymce_version;
+       global $concatenate_scripts, $compress_scripts, $tinymce_version, $editor_styles;
 
        if ( ! user_can_richedit() )
                return;
@@ -1382,7 +1453,10 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
                $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 = array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );
+               if ( is_multisite() )
+                       unset( $mce_buttons_2[ array_search( 'media', $mce_buttons_2 ) ] );
+               $mce_buttons_2 = apply_filters('mce_buttons_2', $mce_buttons_2);
                $mce_buttons_2 = implode($mce_buttons_2, ',');
 
                $mce_buttons_3 = apply_filters('mce_buttons_3', array());
@@ -1391,7 +1465,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
                $mce_buttons_4 = apply_filters('mce_buttons_4', array());
                $mce_buttons_4 = implode($mce_buttons_4, ',');
        }
-       $no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
+       $no_captions = (bool) apply_filters( 'disable_captions', '' );
 
        // TinyMCE init settings
        $initArray = array (
@@ -1400,12 +1474,12 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
                '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_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',
@@ -1426,13 +1500,35 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
                'paste_remove_spans' => true,
                'paste_strip_class_attributes' => 'all',
                'wpeditimage_disable_captions' => $no_captions,
-               'plugins' => "$plugins"
+               'plugins' => $plugins
        );
 
-       $mce_css = trim(apply_filters('mce_css', ''), ' ,');
+       if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
+               $mce_css = array();
+               $style_uri = get_stylesheet_directory_uri();
+               if ( TEMPLATEPATH == STYLESHEETPATH ) {
+                       foreach ( $editor_styles as $file )
+                               $mce_css[] = "$style_uri/$file";
+               } else {
+                       $style_dir    = get_stylesheet_directory();
+                       $template_uri = get_template_directory_uri();
+                       $template_dir = get_template_directory();
+                       foreach ( $editor_styles as $file ) {
+                               if ( file_exists( "$style_dir/$file" ) )
+                                       $mce_css[] = "$style_uri/$file";
+                               if ( file_exists( "$template_dir/$file" ) )
+                                       $mce_css[] = "$template_uri/$file";
+                       }
+               }
+               $mce_css = implode( ',', $mce_css );
+       } else {
+               $mce_css = '';
+       }
+
+       $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
 
        if ( ! empty($mce_css) )
-               $initArray['content_css'] = "$mce_css";
+               $initArray['content_css'] = $mce_css;
 
        if ( is_array($settings) )
                $initArray = array_merge($initArray, $settings);
@@ -1456,7 +1552,9 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
                script_concat_settings();
 
        $language = $initArray['language'];
-       $zip = $compress_scripts ? 1 : 0;
+
+       $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
+               && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip');
 
        /**
         * Deprecated
@@ -1490,8 +1588,8 @@ tinyMCEPreInit = {
 </script>
 
 <?php
-       if ( $concatenate_scripts )
-               echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=$zip&amp;$version'></script>\n";
+       if ( $compressed )
+               echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=1&amp;$version'></script>\n";
        else
                echo "<script type='text/javascript' src='$baseurl/tiny_mce.js?$version'></script>\n";
 
@@ -1504,7 +1602,7 @@ tinyMCEPreInit = {
 <script type="text/javascript">
 /* <![CDATA[ */
 <?php if ( $ext_plugins ) echo "$ext_plugins\n"; ?>
-<?php if ( $concatenate_scripts ) { ?>
+<?php if ( $compressed ) { ?>
 tinyMCEPreInit.go();
 <?php } else { ?>
 (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.mceInit.language,th=t.mceInit.theme,pl=t.mceInit.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
@@ -1513,4 +1611,4 @@ tinyMCE.init(tinyMCEPreInit.mceInit);
 /* ]]> */
 </script>
 <?php
-}
+}
\ No newline at end of file
index e7d37f4c7532df746cf711dacb8ee8a5fa971d7a..632681b60c04a2d40f32ea7fcc64d5584b4e261b 100644 (file)
@@ -81,7 +81,8 @@ CREATE TABLE $wpdb->comments (
   KEY comment_approved (comment_approved),
   KEY comment_post_ID (comment_post_ID),
   KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
-  KEY comment_date_gmt (comment_date_gmt)
+  KEY comment_date_gmt (comment_date_gmt),
+  KEY comment_parent (comment_parent)
 ) $charset_collate;
 CREATE TABLE $wpdb->links (
   link_id bigint(20) unsigned NOT NULL auto_increment,
@@ -145,7 +146,8 @@ CREATE TABLE $wpdb->posts (
   PRIMARY KEY  (ID),
   KEY post_name (post_name),
   KEY type_status_date (post_type,post_status,post_date,ID),
-  KEY post_parent (post_parent)
+  KEY post_parent (post_parent),
+  KEY post_author (post_author)
 ) $charset_collate;
 CREATE TABLE $wpdb->users (
   ID bigint(20) unsigned NOT NULL auto_increment,
@@ -180,7 +182,7 @@ CREATE TABLE $wpdb->usermeta (
  * @uses $wp_db_version
  */
 function populate_options() {
-       global $wpdb, $wp_db_version;
+       global $wpdb, $wp_db_version, $current_site;
 
        $guessurl = wp_guess_url();
 
@@ -195,8 +197,9 @@ function populate_options() {
 
        $options = array(
        'siteurl' => $guessurl,
-       'blogname' => __('My Blog'),
-       'blogdescription' => __('Just another WordPress weblog'),
+       'blogname' => __('My Site'),
+       /* translators: blog tagline */
+       'blogdescription' => __('Just another WordPress site'),
        'users_can_register' => 0,
        'admin_email' => 'you@example.com',
        'start_of_week' => 1,
@@ -243,9 +246,8 @@ function populate_options() {
        // 1.5
        'default_email_category' => 1,
        'recently_edited' => '',
-       'use_linksupdate' => 0,
-       'template' => 'default',
-       'stylesheet' => 'default',
+       'template' => WP_DEFAULT_THEME,
+       'stylesheet' => WP_DEFAULT_THEME,
        'comment_whitelist' => 1,
        'blacklist_keys' => '',
        'comment_registration' => 0,
@@ -263,9 +265,6 @@ function populate_options() {
        'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders,
        'upload_path' => '',
 
-       // 2.0.3
-       'secret' => wp_generate_password(64),
-
        // 2.1
        'blog_public' => '1',
        'default_link_category' => 2,
@@ -297,9 +296,9 @@ function populate_options() {
        'image_default_align' => '',
        'close_comments_for_old_posts' => 0,
        'close_comments_days_old' => 14,
-       'thread_comments' => 0,
+       'thread_comments' => 1,
        'thread_comments_depth' => 5,
-       'page_comments' => 1,
+       'page_comments' => 0,
        'comments_per_page' => 50,
        'default_comments_page' => 'newest',
        'comment_order' => 'asc',
@@ -315,8 +314,19 @@ function populate_options() {
        'embed_autourls' => 1,
        'embed_size_w' => '',
        'embed_size_h' => 600,
+
+       // 3.0
+       'page_for_posts' => 0,
+       'page_on_front' => 0,
        );
 
+       // 3.0 multisite
+       if ( is_multisite() ) {
+               /* translators: blog tagline */
+               $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name );
+               $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/';
+       }
+
        // Set autoload to no for these options
        $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
 
@@ -348,10 +358,10 @@ function populate_options() {
 
        // Delete unused options
        $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts',
-               'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length');
+               'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page' );
        foreach ($unusedoptions as $option)
                delete_option($option);
-       
+
        // delete obsolete magpie stuff
        $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'");
 }
@@ -369,6 +379,7 @@ function populate_roles() {
        populate_roles_260();
        populate_roles_270();
        populate_roles_280();
+       populate_roles_300();
 }
 
 /**
@@ -590,4 +601,181 @@ function populate_roles_280() {
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 3.0.
+ *
+ * @since 3.0.0
+ */
+function populate_roles_300() {
+       $role =& get_role( 'administrator' );
+
+       if ( !empty( $role ) ) {
+               $role->add_cap( 'update_core' );
+               $role->add_cap( 'list_users' );
+               $role->add_cap( 'remove_users' );
+               $role->add_cap( 'add_users' );
+               $role->add_cap( 'promote_users' );
+               $role->add_cap( 'edit_theme_options' );
+               $role->add_cap( 'delete_themes' );
+               $role->add_cap( 'export' );
+       }
+}
+
+/**
+ * populate network settings
+ *
+ * @since 3.0.0
+ *
+ * @param int $network_id id of network to populate
+ * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful,
+ *     so the error code must be checked) or failure.
+ */
+function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
+       global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
+
+       $errors = new WP_Error();
+       if ( '' == $domain )
+               $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
+       if ( '' == $site_name )
+               $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
+
+       // check for network collision
+       if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) )
+               $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
+
+       $site_user = get_user_by_email( $email );
+       if ( ! is_email( $email ) )
+               $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) );
+
+       if ( $errors->get_error_code() )
+               return $errors;
+
+       // set up site tables
+       $template = get_option( 'template' );
+       $stylesheet = get_option( 'stylesheet' );
+       $allowed_themes = array( $stylesheet => true );
+       if ( $template != $stylesheet )
+               $allowed_themes[ $template ] = true;
+       if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template )
+               $allowed_themes[ WP_DEFAULT_THEME ] = true;
+
+       if ( 1 == $network_id ) {
+               $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) );
+               $network_id = $wpdb->insert_id;
+       } else {
+               $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id ) );
+       }
+
+       if ( !is_multisite() ) {
+               $site_admins = array( $site_user->user_login );
+               $users = get_users_of_blog();
+               if ( $users ) {
+                       foreach ( $users as $user ) {
+                               if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) )
+                                       $site_admins[] = $user->user_login;
+                       }
+               }
+       } else {
+               $site_admins = get_site_option( 'site_admins' );
+       }
+
+       $welcome_email = __( 'Dear User,
+
+Your new SITE_NAME site has been successfully set up at:
+BLOG_URL
+
+You can log in to the administrator account with the following information:
+Username: USERNAME
+Password: PASSWORD
+Login Here: BLOG_URLwp-login.php
+
+We hope you enjoy your new site.
+Thanks!
+
+--The Team @ SITE_NAME' );
+
+       $sitemeta = array(
+               'site_name' => $site_name,
+               'admin_email' => $site_user->user_email,
+               'admin_user_id' => $site_user->ID,
+               'registration' => 'none',
+               'upload_filetypes' => 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf',
+               'blog_upload_space' => 10,
+               'fileupload_maxk' => 1500,
+               'site_admins' => $site_admins,
+               'allowedthemes' => $allowed_themes,
+               'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
+               'wpmu_upgrade_site' => $wp_db_version,
+               'welcome_email' => $welcome_email,
+               'first_post' => __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ),
+               // @todo - network admins should have a method of editing the network siteurl (used for cookie hash)
+               'siteurl' => get_option( 'siteurl' ) . '/',
+               'add_new_users' => '0',
+               'upload_space_check_disabled' => '0',
+               'subdomain_install' => intval( $subdomain_install ),
+               'global_terms_enabled' => global_terms_enabled() ? '1' : '0'
+       );
+       if ( !intval( $subdomain_install ) )
+               $sitemeta['illegal_names'][] = 'blog';
+
+       $insert = '';
+       foreach ( $sitemeta as $meta_key => $meta_value ) {
+               $meta_key = $wpdb->escape( $meta_key );
+               if ( is_array( $meta_value ) )
+                       $meta_value = serialize( $meta_value );
+               $meta_value = $wpdb->escape( $meta_value );
+               if ( !empty( $insert ) )
+                       $insert .= ', ';
+               $insert .= "( $network_id, '$meta_key', '$meta_value')";
+       }
+       $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
+
+       $current_site->domain = $domain;
+       $current_site->path = $path;
+       $current_site->site_name = ucfirst( $domain );
+
+       if ( !is_multisite() ) {
+               $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) );
+               $blog_id = $wpdb->insert_id;
+               update_user_meta( $site_user->ID, 'source_domain', $domain );
+               update_user_meta( $site_user->ID, 'primary_blog', $blog_id );
+               if ( !$upload_path = get_option( 'upload_path' ) ) {
+                       $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads';
+                       update_option( 'upload_path', $upload_path );
+               }
+               update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' . $upload_path );
+       }
+
+       if ( $subdomain_install )
+               update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
+       else
+               update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
+
+       $wp_rewrite->flush_rules();
+
+       if ( $subdomain_install ) {
+               $vhost_ok = false;
+               $errstr = '';
+               $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
+               $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) );
+               if ( is_wp_error( $page ) )
+                       $errstr = $page->get_error_message();
+               elseif ( 200 == $page['response']['code'] )
+                               $vhost_ok = true;
+
+               if ( ! $vhost_ok ) {
+                       $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
+                       $msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname );
+                       if ( ! empty ( $errstr ) )
+                               $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
+                       $msg .= '</p>';
+                       $msg .= '<p>' . _e( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>';
+                       $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>';
+                       return new WP_Error( 'no_wildcard_dns', $msg );
+               }
+       }
+
+       return true;
+}
+
 ?>
index 5f104d630feef124323f517289c14141d15753e8..b371ec2417ddc505e846c49a87f6285f2679893a 100644 (file)
@@ -19,7 +19,7 @@
  * @return unknown
  */
 function category_exists($cat_name, $parent = 0) {
-       $id = is_term($cat_name, 'category', $parent);
+       $id = term_exists($cat_name, 'category', $parent);
        if ( is_array($id) )
                $id = $id['term_id'];
        return $id;
@@ -48,7 +48,7 @@ function get_category_to_edit( $id ) {
  * @return unknown
  */
 function wp_create_category( $cat_name, $parent = 0 ) {
-       if ( $id = category_exists($cat_name) )
+       if ( $id = category_exists($cat_name, $parent) )
                return $id;
 
        return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
@@ -73,19 +73,19 @@ function wp_create_categories($categories, $post_id = '') {
                                $cat_ids[] = $id;
        }
 
-       if ($post_id)
+       if ( $post_id )
                wp_set_post_categories($post_id, $cat_ids);
 
        return $cat_ids;
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Deletes one existing category.
  *
- * @since unknown
+ * @since 2.0.0
  *
- * @param unknown_type $cat_ID
- * @return unknown
+ * @param int $cat_ID
+ * @return mixed Returns true if completes delete action; false if term doesnt exist; Zero on attempted deletion of default Category; WP_Error object is also a possibility.
  */
 function wp_delete_category($cat_ID) {
        $cat_ID = (int) $cat_ID;
@@ -99,16 +99,16 @@ function wp_delete_category($cat_ID) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Updates an existing Category or creates a new Category.
  *
- * @since unknown
+ * @since 2.0.0
  *
- * @param unknown_type $catarr
- * @param unknown_type $wp_error
- * @return unknown
+ * @param mixed $catarr See defaults below. Set 'cat_ID' to a non-zero value to update an existing category. The 'taxonomy' key was added in 3.0.0.
+ * @param bool $wp_error Optional, since 2.5.0. Set this to true if the caller handles WP_Error return values.
+ * @return int|object The ID number of the new or updated Category on success.  Zero or a WP_Error on failure, depending on param $wp_error.
  */
 function wp_insert_category($catarr, $wp_error = false) {
-       $cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
+       $cat_defaults = array('cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
        $catarr = wp_parse_args($catarr, $cat_defaults);
        extract($catarr, EXTR_SKIP);
 
@@ -142,9 +142,9 @@ function wp_insert_category($catarr, $wp_error = false) {
        $args = compact('name', 'slug', 'parent', 'description');
 
        if ( $update )
-               $cat_ID = wp_update_term($cat_ID, 'category', $args);
+               $cat_ID = wp_update_term($cat_ID, $taxonomy, $args);
        else
-               $cat_ID = wp_insert_term($cat_name, 'category', $args);
+               $cat_ID = wp_insert_term($cat_name, $taxonomy, $args);
 
        if ( is_wp_error($cat_ID) ) {
                if ( $wp_error )
@@ -157,12 +157,15 @@ function wp_insert_category($catarr, $wp_error = false) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Aliases wp_insert_category() with minimal args.
  *
- * @since unknown
+ * If you want to update only some fields of an existing category, call this
+ * function with only the new values set inside $catarr.
  *
- * @param unknown_type $catarr
- * @return unknown
+ * @since 2.0.0
+ *
+ * @param array $catarr The 'cat_ID' value is required.  All other keys are optional.
+ * @return int|bool The ID number of the new or updated Category on success. Zero or FALSE on failure.
  */
 function wp_update_category($catarr) {
        $cat_ID = (int) $catarr['cat_ID'];
@@ -237,7 +240,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
  * @return unknown
  */
 function tag_exists($tag_name) {
-       return is_term($tag_name, 'post_tag');
+       return term_exists($tag_name, 'post_tag');
 }
 
 /**
@@ -261,7 +264,7 @@ function wp_create_tag($tag_name) {
  * @return unknown
  */
 function wp_create_term($tag_name, $taxonomy = 'post_tag') {
-       if ( $id = is_term($tag_name, $taxonomy) )
+       if ( $id = term_exists($tag_name, $taxonomy) )
                return $id;
 
        return wp_insert_term($tag_name, $taxonomy);
index 39f703a252891591c551da2e304abbfb26d8b2c5..e3981f221c3d3411de9df2a06ede35e9bf6e3c0d 100644 (file)
  * @subpackage Administration
  */
 
-// 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;
-
-       if ( empty($categories) ) {
-
-               $args = array('hide_empty' => 0);
-               if ( !empty($_GET['s']) )
-                       $args['search'] = $_GET['s'];
-
-               $categories = get_categories( $args );
-
-               if ( empty($categories) )
-                       return false;
-       }
-
-       $children = _get_term_hierarchy('category');
-
-       _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count );
-
-}
-
-/**
- * {@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( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count ) {
-
-       $start = ($page - 1) * $per_page;
-       $end = $start + $per_page;
-       ob_start();
-
-       foreach ( $categories as $key => $category ) {
-               if ( $count >= $end )
-                       break;
-
-               if ( $category->parent != $parent && empty($_GET['s']) )
-                       continue;
-
-               // If the page starts in a subtree, print the parents.
-               if ( $count == $start && $category->parent > 0 ) {
-
-                       $my_parents = array();
-                       $p = $category->parent;
-                       while ( $p ) {
-                               $my_parent = get_category( $p );
-                               $my_parents[] = $my_parent;
-                               if ( $my_parent->parent == 0 )
-                                       break;
-                               $p = $my_parent->parent;
-                       }
-
-                       $num_parents = count($my_parents);
-                       while( $my_parent = array_pop($my_parents) ) {
-                               echo "\t" . _cat_row( $my_parent, $level - $num_parents );
-                               $num_parents--;
-                       }
-               }
-
-               if ( $count >= $start )
-                       echo "\t" . _cat_row( $category, $level );
-
-               unset( $categories[ $key ] );
-
-               $count++;
-
-               if ( isset($children[$category->term_id]) )
-                       _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count );
-       }
-
-       $output = ob_get_contents();
-       ob_end_clean();
-
-       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 ) {
-       static $row_class = '';
-
-       $category = get_category( $category, OBJECT, 'display' );
-
-       $default_cat_id = (int) get_option( 'default_category' );
-       $pad = str_repeat( '&#8212; ', max(0, $level) );
-       $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
-       $edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
-       if ( current_user_can( 'manage_categories' ) ) {
-               $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $category->name)) . "'>" . esc_attr( $name ) . '</a><br />';
-               $actions = array();
-               $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
-               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-               if ( $default_cat_id != $category->term_id )
-                       $actions['delete'] = "<a class='delete:the-list:cat-$category->term_id submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
-               $actions = apply_filters('cat_row_actions', $actions, $category);
-               $action_count = count($actions);
-               $i = 0;
-               $edit .= '<div class="row-actions">';
-               foreach ( $actions as $action => $link ) {
-                       ++$i;
-                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
-                       $edit .= "<span class='$action'>$link$sep</span>";
-               }
-               $edit .= '</div>';
-       } else {
-               $edit = $name;
-       }
-
-       $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;
-       $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">' . apply_filters('editable_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>" . apply_filters('editable_slug', $category->slug) . "</td>";
-                               break;
-                       case 'posts':
-                               $attributes = 'class="posts column-posts num"' . $style;
-                               $output .= "<td $attributes>$posts_count</td>\n";
-                               break;
-                       default:
-                               $output .= "<td $attributes>";
-                               $output .= apply_filters('manage_categories_custom_column', '', $column_name, $category->term_id);
-                               $output .= "</td>";
-               }
-       }
-       $output .= '</tr>';
-
-       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.
+ * Outputs the HTML for the hidden table rows used in Categories, Link Categories and Tags quick edit.
  *
- * @param string $type "tag", "category" or "link-category"
+ * @param string $type "edit-tags", "categoried" or "edit-link-categories"
+ * @param string $taxonomy The taxonomy of the row.
  * @return
  */
-function inline_edit_term_row($type) {
+function inline_edit_term_row($type, $taxonomy) {
 
-       if ( ! current_user_can( 'manage_categories' ) )
+       $tax = get_taxonomy($taxonomy);
+       if ( ! current_user_can( $tax->cap->edit_terms ) )
                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);
@@ -232,20 +40,12 @@ function inline_edit_term_row($type) {
                                <span class="title"><?php _e( 'Name' ); ?></span>
                                <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
                        </label>
-
+<?php if ( !is_multisite() ) { ?>
                        <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 ?>
+<?php } ?>
 
                </div></fieldset>
 
@@ -256,18 +56,19 @@ function inline_edit_term_row($type) {
        foreach ( $columns as $column_name => $column_display_name ) {
                if ( isset( $core_columns[$column_name] ) )
                        continue;
-               do_action( 'quick_edit_custom_box', $column_name, $type );
+               do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );
        }
 
 ?>
 
        <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' ); ?>
+               <?php $update_text = $tax->labels->update_item; ?>
                <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
-               <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
+               <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
                <span class="error" style="display:none;"></span>
                <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
+               <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $tax->name ); ?>" />
                <br class="clear" />
        </p>
        </td></tr>
@@ -371,81 +172,10 @@ function link_cat_row( $category, $name_override = false ) {
        return $output;
 }
 
-/**
- * Outputs the html checked attribute.
- *
- * Compares the first two arguments and if identical marks as checked
- *
- * @since 1.0
- *
- * @param any $checked One of the values to compare
- * @param any $current (true) The other value to compare if not just true
- * @param bool $echo Whether or not to echo or just return the string
- */
-function checked( $checked, $current = true, $echo = true) {
-       return __checked_selected_helper( $checked, $current, $echo, 'checked' );
-}
-
-/**
- * Outputs the html selected attribute.
- *
- * Compares the first two arguments and if identical marks as selected
- *
- * @since 1.0
- *
- * @param any selected One of the values to compare
- * @param any $current (true) The other value to compare if not just true
- * @param bool $echo Whether or not to echo or just return the string
- */
-function selected( $selected, $current = true, $echo = true) {
-       return __checked_selected_helper( $selected, $current, $echo, 'selected' );
-}
-
-/**
- * Private helper function for checked and selected.
- *
- * Compares the first two arguments and if identical marks as $type
- *
- * @since 2.8
- * @access private
- *
- * @param any $helper One of the values to compare
- * @param any $current (true) The other value to compare if not just true
- * @param bool $echo Whether or not to echo or just return the string
- * @param string $type The type of checked|selected we are doing.
- */
-function __checked_selected_helper( $helper, $current, $echo, $type) {
-       if ( (string) $helper === (string) $current)
-               $result = " $type='$type'";
-       else
-               $result = '';
-
-       if ($echo)
-               echo $result;
-
-       return $result;
-}
-
 //
 // Category Checklists
 //
 
-/**
- * {@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);
-}
-
 /**
  * {@internal Missing Short Description}}
  *
@@ -467,9 +197,16 @@ class Walker_Category_Checklist extends Walker {
 
        function start_el(&$output, $category, $depth, $args) {
                extract($args);
+               if ( empty($taxonomy) )
+                       $taxonomy = 'category';
+
+               if ( $taxonomy == 'category' )
+                       $name = 'post_category';
+               else
+                       $name = 'tax_input['.$taxonomy.']';
 
                $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
-               $output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
+               $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
        }
 
        function end_el(&$output, $category, $depth, $args) {
@@ -488,31 +225,62 @@ class Walker_Category_Checklist extends Walker {
  * @param unknown_type $popular_cats
  */
 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
+       wp_terms_checklist($post_id,
+               array(
+                       'taxonomy' => 'category',
+                       'descendants_and_self' => $descendants_and_self,
+                       'selected_cats' => $selected_cats,
+                       'popular_cats' => $popular_cats,
+                       'walker' => $walker,
+                       'checked_ontop' => $checked_ontop
+  ));
+}
+
+/**
+ * Taxonomy independent version of wp_category_checklist
+ *
+ * @param int $post_id
+ * @param array $args
+ */
+function wp_terms_checklist($post_id = 0, $args = array()) {
+       $defaults = array(
+               'descendants_and_self' => 0,
+               'selected_cats' => false,
+               'popular_cats' => false,
+               'walker' => null,
+               'taxonomy' => 'category',
+               'checked_ontop' => true
+       );
+       extract( wp_parse_args($args, $defaults), EXTR_SKIP );
+
        if ( empty($walker) || !is_a($walker, 'Walker') )
                $walker = new Walker_Category_Checklist;
 
        $descendants_and_self = (int) $descendants_and_self;
 
-       $args = array();
+       $args = array('taxonomy' => $taxonomy);
+
+       $tax = get_taxonomy($taxonomy);
+       $args['disabled'] = !current_user_can($tax->cap->assign_terms);
 
        if ( is_array( $selected_cats ) )
                $args['selected_cats'] = $selected_cats;
        elseif ( $post_id )
-               $args['selected_cats'] = wp_get_post_categories($post_id);
+               $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
        else
                $args['selected_cats'] = array();
 
        if ( is_array( $popular_cats ) )
                $args['popular_cats'] = $popular_cats;
        else
-               $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
+               $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
 
        if ( $descendants_and_self ) {
-               $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
-               $self = get_category( $descendants_and_self );
+               $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
+               $self = get_term( $descendants_and_self, $taxonomy );
                array_unshift( $categories, $self );
        } else {
-               $categories = get_categories('get=all');
+               $categories = (array) get_terms($taxonomy, array('get' => 'all'));
        }
 
        if ( $checked_ontop ) {
@@ -549,25 +317,31 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
        global $post_ID;
 
        if ( $post_ID )
-               $checked_categories = wp_get_post_categories($post_ID);
+               $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids'));
        else
-               $checked_categories = array();
+               $checked_terms = array();
+
+       $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
 
-       $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
+       $tax = get_taxonomy($taxonomy);
+       if ( ! current_user_can($tax->cap->assign_terms) )
+               $disabled = 'disabled="disabled"';
+       else
+               $disabled = '';
 
        $popular_ids = array();
-       foreach ( (array) $categories as $category ) {
-               $popular_ids[] = $category->term_id;
+       foreach ( (array) $terms as $term ) {
+               $popular_ids[] = $term->term_id;
                if ( !$echo ) // hack for AJAX use
                        continue;
-               $id = "popular-category-$category->term_id";
-               $checked = in_array( $category->term_id, $checked_categories ) ? 'checked="checked"' : '';
+               $id = "popular-$taxonomy-$term->term_id";
+               $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
                ?>
 
                <li id="<?php echo $id; ?>" class="popular-category">
                        <label class="selectit">
-                       <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $category->term_id; ?>" />
-                               <?php echo esc_html( apply_filters( 'the_category', $category->name ) ); ?>
+                       <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
+                               <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
                        </label>
                </li>
 
@@ -576,21 +350,6 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
        return $popular_ids;
 }
 
-/**
- * {@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);
-}
-
 /**
  * {@internal Missing Short Description}}
  *
@@ -602,26 +361,24 @@ function wp_link_category_checklist( $link_id = 0 ) {
        $default = 1;
 
        if ( $link_id ) {
-               $checked_categories = wp_get_link_cats($link_id);
-
-               if ( count( $checked_categories ) == 0 ) {
-                       // No selected categories, strange
+               $checked_categories = wp_get_link_cats( $link_id );
+               // No selected categories, strange
+               if ( ! count( $checked_categories ) )
                        $checked_categories[] = $default;
-               }
        } else {
                $checked_categories[] = $default;
        }
 
-       $categories = get_terms('link_category', 'orderby=count&hide_empty=0');
+       $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
 
-       if ( empty($categories) )
+       if ( empty( $categories ) )
                return;
 
        foreach ( $categories as $category ) {
                $cat_id = $category->term_id;
-               $name = esc_html( apply_filters('the_category', $category->name));
-               $checked = in_array( $cat_id, $checked_categories );
-               echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
+               $name = esc_html( apply_filters( 'the_category', $category->name ) );
+               $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+               echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
        }
 }
 
@@ -638,18 +395,36 @@ function wp_link_category_checklist( $link_id = 0 ) {
  * @param unknown_type $class
  * @return unknown
  */
-function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
+function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
+               global $post_type, $current_screen;
+               static $row_class = '';
+               $row_class = ($row_class == '' ? ' class="alternate"' : '');
+
                $count = number_format_i18n( $tag->count );
-               $tagsel = ($taxonomy == 'post_tag' ? 'tag' : $taxonomy);
-               $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count;
+               $tax = get_taxonomy($taxonomy);
+
+               if ( 'post_tag' == $taxonomy ) {
+                       $tagsel = 'tag';
+               } elseif ( 'category' == $taxonomy ) {
+                       $tagsel = 'category_name';
+               } elseif ( ! empty($tax->query_var) ) {
+                       $tagsel = $tax->query_var;
+               } else {
+                       $tagsel = $taxonomy;
+               }
 
-               $name = apply_filters( 'term_name', $tag->name );
+               $pad = str_repeat( '&#8212; ', max(0, $level) );
+               $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
                $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
-               $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
+               $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;post_type=$post_type&amp;tag_ID=$tag->term_id";
+
                $out = '';
-               $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
-               $columns = get_column_headers('edit-tags');
-               $hidden = get_hidden_columns('edit-tags');
+               $out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
+
+
+               $columns = get_column_headers($current_screen);
+               $hidden = get_hidden_columns($current_screen);
+               $default_term = get_option('default_' . $taxonomy);
                foreach ( $columns as $column_name => $column_display_name ) {
                        $class = "class=\"$column_name column-$column_name\"";
 
@@ -661,15 +436,24 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
 
                        switch ($column_name) {
                                case 'cb':
-                                       $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
+                                       if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
+                                               $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
+                                       else
+                                               $out .= '<th scope="row" class="check-column">&nbsp;</th>';
                                        break;
                                case 'name':
                                        $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
                                        $actions = array();
-                                       $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
-                                       $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-                                       $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
+                                       if ( current_user_can($tax->cap->edit_terms) ) {
+                                               $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
+                                               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
+                                       }
+                                       if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
+                                               $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
+
                                        $actions = apply_filters('tag_row_actions', $actions, $tag);
+                                       $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
+
                                        $action_count = count($actions);
                                        $i = 0;
                                        $out .= '<div class="row-actions">';
@@ -681,7 +465,8 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
                                        $out .= '</div>';
                                        $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
                                        $out .= '<div class="name">' . $qe_data->name . '</div>';
-                                       $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div></div></td>';
+                                       $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
+                                       $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
                                        break;
                                case 'description':
                                        $out .= "<td $attributes>$tag->description</td>";
@@ -691,7 +476,7 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
                                        break;
                                case 'posts':
                                        $attributes = 'class="posts column-posts num"' . $style;
-                                       $out .= "<td $attributes>$count</td>";
+                                       $out .= "<td $attributes><a href='edit.php?$tagsel=$tag->slug&amp;post_type=$post_type'>$count</a></td>";
                                        break;
                                default:
                                        $out .= "<td $attributes>";
@@ -700,7 +485,7 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
                        }
                }
 
-               $out .= '</tr>';
+               $out .= "</tr>\n";
 
                return $out;
 }
@@ -725,23 +510,84 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'po
 
        $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
 
-       if ( !empty( $searchterms ) ) {
+       if ( !empty( $searchterms ) )
                $args['search'] = $searchterms;
-       }
-
-       $tags = get_terms( $taxonomy, $args );
 
        // convert it to table rows
        $out = '';
        $count = 0;
-       foreach( $tags as $tag )
-               $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
+       if ( is_taxonomy_hierarchical($taxonomy) ) {
+               // We'll need the full set of terms then.
+               $args['number'] = $args['offset'] = 0;
+
+               $terms = get_terms( $taxonomy, $args );
+               if ( !empty( $searchterms ) ) // Ignore children on searches.
+                       $children = array();
+               else
+                       $children = _get_term_hierarchy($taxonomy);
+
+               // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake
+               $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
+       } else {
+               $terms = get_terms( $taxonomy, $args );
+               foreach( $terms as $term )
+                       $out .= _tag_row( $term, 0, $taxonomy );
+               $count = $pagesize; // Only displaying a single page.
+       }
 
-       // filter and send to screen
        echo $out;
        return $count;
 }
 
+function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
+
+       $start = ($page - 1) * $per_page;
+       $end = $start + $per_page;
+
+       $output = '';
+       foreach ( $terms as $key => $term ) {
+
+               if ( $count >= $end )
+                       break;
+
+               if ( $term->parent != $parent && empty($_GET['s']) )
+                       continue;
+
+               // If the page starts in a subtree, print the parents.
+               if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
+                       $my_parents = $parent_ids = array();
+                       $p = $term->parent;
+                       while ( $p ) {
+                               $my_parent = get_term( $p, $taxonomy );
+                               $my_parents[] = $my_parent;
+                               $p = $my_parent->parent;
+                               if ( in_array($p, $parent_ids) ) // Prevent parent loops.
+                                       break;
+                               $parent_ids[] = $p;
+                       }
+                       unset($parent_ids);
+
+                       $num_parents = count($my_parents);
+                       while ( $my_parent = array_pop($my_parents) ) {
+                               $output .=  "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy );
+                               $num_parents--;
+                       }
+               }
+
+               if ( $count >= $start )
+                       $output .= "\t" . _tag_row( $term, $level, $taxonomy );
+
+               ++$count;
+
+               unset($terms[$key]);
+
+               if ( isset($children[$term->term_id]) && empty($_GET['s']) )
+                       $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
+       }
+
+       return $output;
+}
+
 // define the columns to display, the syntax is 'internal name' => 'display name'
 /**
  * {@internal Missing Short Description}}
@@ -750,19 +596,31 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'po
  *
  * @return unknown
  */
-function wp_manage_posts_columns() {
+function wp_manage_posts_columns( $screen = '') {
+       if ( empty($screen) )
+               $post_type = 'post';
+       else
+               $post_type = $screen->post_type;
+
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
        /* translators: manage posts column name */
-       $posts_columns['title'] = _x('Post', 'column name');
+       $posts_columns['title'] = _x('Title', 'column name');
        $posts_columns['author'] = __('Author');
-       $posts_columns['categories'] = __('Categories');
-       $posts_columns['tags'] = __('Tags');
+       if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') )
+               $posts_columns['categories'] = __('Categories');
+       if ( empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag') )
+               $posts_columns['tags'] = __('Tags');
        $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
-       if ( !in_array( $post_status, array('pending', 'draft', 'future') ) )
-               $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
+       if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) )
+               $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
        $posts_columns['date'] = __('Date');
-       $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
+       if ( 'page' == $post_type )
+               $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
+       else
+               $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
+       $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
 
        return $posts_columns;
 }
@@ -785,7 +643,7 @@ function wp_manage_media_columns() {
        //$posts_columns['tags'] = _x('Tags', 'column name');
        /* translators: column name */
        $posts_columns['parent'] = _x('Attached to', 'column name');
-       $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
+       $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
        //$posts_columns['comments'] = __('Comments');
        /* translators: column name */
        $posts_columns['date'] = _x('Date', 'column name');
@@ -802,46 +660,36 @@ function wp_manage_media_columns() {
  * @return unknown
  */
 function wp_manage_pages_columns() {
-       $posts_columns = array();
-       $posts_columns['cb'] = '<input type="checkbox" />';
-       $posts_columns['title'] = __('Title');
-       $posts_columns['author'] = __('Author');
-       $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
-       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['date'] = __('Date');
-       $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
-
-       return $posts_columns;
+       return wp_manage_posts_columns();
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get the column headers for a screen
  *
  * @since unknown
  *
- * @param unknown_type $page
- * @return unknown
+ * @param string|object $screen The screen you want the headers for
+ * @return array Containing the headers in the format id => UI String
  */
-function get_column_headers($page) {
+function get_column_headers($screen) {
        global $_wp_column_headers;
 
        if ( !isset($_wp_column_headers) )
                $_wp_column_headers = array();
 
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
        // Store in static to avoid running filters on each call
-       if ( isset($_wp_column_headers[$page]) )
-               return $_wp_column_headers[$page];
+       if ( isset($_wp_column_headers[$screen->id]) )
+               return $_wp_column_headers[$screen->id];
 
-       switch ($page) {
+       switch ($screen->base) {
                case 'edit':
-                        $_wp_column_headers[$page] = wp_manage_posts_columns();
+                        $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen );
                         break;
-               case 'edit-pages':
-                       $_wp_column_headers[$page] = wp_manage_pages_columns();
-                       break;
                case 'edit-comments':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'author' => __('Author'),
                                /* translators: column name */
@@ -852,7 +700,7 @@ function get_column_headers($page) {
 
                        break;
                case 'link-manager':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
                                'url' => __('URL'),
@@ -864,10 +712,10 @@ function get_column_headers($page) {
 
                        break;
                case 'upload':
-                       $_wp_column_headers[$page] = wp_manage_media_columns();
+                       $_wp_column_headers[$screen->id] = wp_manage_media_columns();
                        break;
                case 'categories':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
                                'description' => __('Description'),
@@ -877,7 +725,7 @@ function get_column_headers($page) {
 
                        break;
                case 'edit-link-categories':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
                                'description' => __('Description'),
@@ -887,7 +735,7 @@ function get_column_headers($page) {
 
                        break;
                case 'edit-tags':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
                                'description' => __('Description'),
@@ -897,7 +745,7 @@ function get_column_headers($page) {
 
                        break;
                case 'users':
-                       $_wp_column_headers[$page] = array(
+                       $_wp_column_headers[$screen->id] = array(
                                'cb' => '<input type="checkbox" />',
                                'username' => __('Username'),
                                'name' => __('Name'),
@@ -907,11 +755,11 @@ function get_column_headers($page) {
                        );
                        break;
                default :
-                       $_wp_column_headers[$page] = array();
+                       $_wp_column_headers[$screen->id] = array();
        }
 
-       $_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);
-       return $_wp_column_headers[$page];
+       $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]);
+       return $_wp_column_headers[$screen->id];
 }
 
 /**
@@ -919,18 +767,16 @@ function get_column_headers($page) {
  *
  * @since unknown
  *
- * @param unknown_type $type
+ * @param unknown_type $screen
  * @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);
+function print_column_headers( $screen, $id = true ) {
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       $columns = get_column_headers( $screen );
+       $hidden = get_hidden_columns($screen);
        $styles = array();
-//     $styles['tag']['posts'] = 'width: 90px;';
-//     $styles['link-category']['links'] = 'width: 90px;';
-//     $styles['category']['posts'] = 'width: 90px;';
-//     $styles['link']['visible'] = 'text-align: center;';
 
        foreach ( $columns as $column_key => $column_display_name ) {
                $class = ' class="manage-column';
@@ -948,8 +794,8 @@ function print_column_headers( $type, $id = true ) {
                if ( in_array($column_key, $hidden) )
                        $style = 'display:none;';
 
-               if ( isset($styles[$type]) && isset($styles[$type][$column_key]) )
-                       $style .= ' ' . $styles[$type][$column_key];
+               if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) )
+                       $style .= ' ' . $styles[$screen>id][$column_key];
                $style = ' style="' . $style . '"';
 ?>
        <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
@@ -968,10 +814,13 @@ function print_column_headers( $type, $id = true ) {
 function register_column_headers($screen, $columns) {
        global $_wp_column_headers;
 
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
        if ( !isset($_wp_column_headers) )
                $_wp_column_headers = array();
 
-       $_wp_column_headers[$screen] = $columns;
+       $_wp_column_headers[$screen->id] = $columns;
 }
 
 /**
@@ -979,11 +828,13 @@ function register_column_headers($screen, $columns) {
  *
  * @since unknown
  *
- * @param unknown_type $page
+ * @param unknown_type $screen
  */
-function get_hidden_columns($page) {
-       $page = str_replace('.php', '', $page);
-       return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false );
+function get_hidden_columns($screen) {
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       return (array) get_user_option( 'manage' . $screen->id. 'columnshidden' );
 }
 
 /**
@@ -993,43 +844,61 @@ function get_hidden_columns($page) {
  *
  * @since 2.7
  *
- * @param string $type 'post' or 'page'
+ * @param string $screen
  */
-function inline_edit_row( $type ) {
+function inline_edit_row( $screen ) {
        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();
+       if ( is_string($screen) ) {
+               $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
+               $screen = (object) $screen;
+       }
+
+       $post = get_default_post_to_edit( $screen->post_type );
+       $post_type_object = get_post_type_object( $screen->post_type );
+
+       $taxonomy_names = get_object_taxonomies( $screen->post_type );
+       $hierarchical_taxonomies = array();
+       $flat_taxonomies = array();
+       foreach ( $taxonomy_names as $taxonomy_name ) {
+               $taxonomy = get_taxonomy( $taxonomy_name);
+
+               if ( !$taxonomy->show_ui )
+                       continue;
+
+               if ( $taxonomy->hierarchical )
+                       $hierarchical_taxonomies[] = $taxonomy;
+               else
+                       $flat_taxonomies[] = $taxonomy;
        }
 
-       $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
+       $columns = wp_manage_posts_columns($screen);
        $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");
+       $can_publish = current_user_can($post_type_object->cap->publish_posts);
        $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
+       $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
        $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";
+       <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
+               echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_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>
+               <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
 
 
-<?php if ( $bulk ) : ?>
+<?php
+
+if ( post_type_supports( $screen->post_type, 'title' ) ) :
+       if ( $bulk ) : ?>
                <div id="bulk-title-div">
                        <div id="bulk-titles"></div>
                </div>
@@ -1041,16 +910,15 @@ function inline_edit_row( $type ) {
                        <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>
 
+<?php endif; // $bulk
+endif; // post_type_supports title ?>
+
+<?php if ( !$bulk ) : ?>
                <label><span class="title"><?php _e( 'Date' ); ?></span></label>
                <div class="inline-edit-date">
                        <?php touch_time(1, 1, 4, 1); ?>
@@ -1059,12 +927,13 @@ function inline_edit_row( $type ) {
 
 <?php endif; // $bulk
 
-               $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM
+       if ( post_type_supports( $screen->post_type, 'author' ) ) :
+               $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
                $authors_dropdown = '';
                if ( $authors && count( $authors ) > 1 ) :
                        $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
                        if ( $bulk )
-                               $users_opt['show_option_none'] = __('- No Change -');
+                               $users_opt['show_option_none'] = __('&mdash; No Change &mdash;');
                        $authors_dropdown  = '<label>';
                        $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
                        $authors_dropdown .= wp_dropdown_users( $users_opt );
@@ -1073,7 +942,11 @@ function inline_edit_row( $type ) {
                endif; // authors
 ?>
 
-<?php if ( !$bulk ) : echo $authors_dropdown; ?>
+<?php if ( !$bulk ) echo $authors_dropdown;
+endif; // post_type_supports author
+
+if ( !$bulk ) :
+?>
 
                <div class="inline-edit-group">
                        <label class="alignleft">
@@ -1089,7 +962,7 @@ function inline_edit_row( $type ) {
                        </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>
+                               <span class="checkbox-title"><?php echo __('Private'); ?></span>
                        </label>
                </div>
 
@@ -1097,41 +970,49 @@ function inline_edit_row( $type ) {
 
        </div></fieldset>
 
-<?php if ( !$is_page && !$bulk ) : ?>
+<?php if ( count($hierarchical_taxonomies) && !$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' ); ?>
+
+<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
+
+               <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?>
                        <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(); ?>
+               <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?>" value="0" />
+               <ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">
+                       <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?>
                </ul>
+
+<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
+
        </div></fieldset>
 
-<?php endif; // !$is_page && !$bulk ?>
+<?php endif; // count($hierarchical_taxonomies) && !$bulk ?>
 
        <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
 
 <?php
-       if ( $bulk )
+       if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
                echo $authors_dropdown;
 ?>
 
-<?php if ( $is_page ) : ?>
+<?php if ( $post_type_object->hierarchical ) : ?>
 
                <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');
+       $dropdown_args = array('post_type' => $post_type_object->name, '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['show_option_no_change'] =  __('&mdash; No Change &mdash;');
        $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
        wp_dropdown_pages($dropdown_args);
 ?>
                </label>
 
-<?php  if ( !$bulk ) : ?>
+<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
+               if ( !$bulk ) : ?>
 
                <label>
                        <span class="title"><?php _e( 'Order' ); ?></span>
@@ -1144,67 +1025,80 @@ function inline_edit_row( $type ) {
                        <span class="title"><?php _e( 'Template' ); ?></span>
                        <select name="page_template">
 <?php  if ( $bulk ) : ?>
-                               <option value="-1"><?php _e('- No Change -'); ?></option>
+                               <option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>
 <?php  endif; // $bulk ?>
                                <option value="default"><?php _e( 'Default Template' ); ?></option>
                                <?php page_template_dropdown() ?>
                        </select>
                </label>
 
-<?php elseif ( !$bulk ) : // $is_page ?>
+<?php
+       endif; // post_type_supports page-attributes
+endif; // $post_type_object->hierarchical ?>
+
+<?php if ( count($flat_taxonomies) && !$bulk ) : ?>
+
+<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
 
                <label class="inline-edit-tags">
-                       <span class="title"><?php _e( 'Tags' ); ?></span>
-                       <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea>
+                       <span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span>
+                       <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>
                </label>
 
-<?php endif; // $is_page  ?>
+<?php endforeach; //$flat_taxonomies as $taxonomy ?>
 
-<?php if ( $bulk ) : ?>
+<?php endif; // count($flat_taxonomies) && !$bulk  ?>
+
+<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
+       if ( $bulk ) : ?>
 
                <div class="inline-edit-group">
+       <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
                <label class="alignleft">
                        <span class="title"><?php _e( 'Comments' ); ?></span>
                        <select name="comment_status">
-                               <option value=""><?php _e('- No Change -'); ?></option>
+                               <option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>
                                <option value="open"><?php _e('Allow'); ?></option>
                                <option value="closed"><?php _e('Do not allow'); ?></option>
                        </select>
                </label>
-
+       <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
                <label class="alignright">
                        <span class="title"><?php _e( 'Pings' ); ?></span>
                        <select name="ping_status">
-                               <option value=""><?php _e('- No Change -'); ?></option>
+                               <option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>
                                <option value="open"><?php _e('Allow'); ?></option>
                                <option value="closed"><?php _e('Do not allow'); ?></option>
                        </select>
                </label>
+       <?php endif; ?>
                </div>
 
 <?php else : // $bulk ?>
 
                <div class="inline-edit-group">
+               <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
                        <label class="alignleft">
                                <input type="checkbox" name="comment_status" value="open" />
                                <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
                        </label>
-
+               <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
                        <label class="alignleft">
                                <input type="checkbox" name="ping_status" value="open" />
                                <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
                        </label>
+               <?php endif; ?>
                </div>
 
-<?php endif; // $bulk ?>
-
+<?php endif; // $bulk
+endif; // post_type_supports comments or pings ?>
 
                <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>
+                                       <option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>
 <?php endif; // $bulk ?>
                                <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
                                        <option value="publish"><?php _e( 'Published' ); ?></option>
@@ -1218,14 +1112,14 @@ function inline_edit_row( $type ) {
                                </select>
                        </label>
 
-<?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>
+<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->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="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
                                        <option value="sticky"><?php _e( 'Sticky' ); ?></option>
                                        <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
                                </select>
@@ -1240,7 +1134,7 @@ function inline_edit_row( $type ) {
 
 <?php  endif; // $bulk ?>
 
-<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ?>
+<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?>
 
                </div>
 
@@ -1250,23 +1144,24 @@ function inline_edit_row( $type ) {
        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);
+               do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_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' );
+                       $update_text = __( 'Update' );
                        ?>
                        <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
-                       <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
+                       <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
                <?php } else {
-                       $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
+                       $update_text = __( 'Update' );
                ?>
                        <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />
                <?php } ?>
-               <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
+               <input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?>" />
+               <input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?>" />
                <br class="clear" />
        </p>
        </td></tr>
@@ -1286,11 +1181,11 @@ function inline_edit_row( $type ) {
  * @param unknown_type $post
  */
 function get_inline_data($post) {
-
-       if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
+       $post_type_object = get_post_type_object($post->post_type);
+       if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) )
                return;
 
-       $title = esc_attr($post->post_title);
+       $title = esc_attr( get_the_title( $post->ID ) );
 
        echo '
 <div class="hidden" id="inline_' . $post->ID . '">
@@ -1308,17 +1203,27 @@ function get_inline_data($post) {
        <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
        <div class="post_password">' . esc_html( $post->post_password ) . '</div>';
 
-       if( $post->post_type == 'page' )
-               echo '
-       <div class="post_parent">' . $post->post_parent . '</div>
-       <div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>
-       <div class="menu_order">' . $post->menu_order . '</div>';
+       if ( $post_type_object->hierarchical )
+               echo '<div class="post_parent">' . $post->post_parent . '</div>';
 
-       if( $post->post_type == 'post' )
-               echo '
-       <div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>
-       <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
-       <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
+       if ( $post->post_type == 'page' )
+               echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
+
+       if ( $post_type_object->hierarchical )
+               echo '<div class="menu_order">' . $post->menu_order . '</div>';
+
+       $taxonomy_names = get_object_taxonomies( $post->post_type );
+       foreach ( $taxonomy_names as $taxonomy_name) {
+               $taxonomy = get_taxonomy( $taxonomy_name );
+
+               if ( $taxonomy->hierarchical && $taxonomy->show_ui )
+                               echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>';
+               elseif ( $taxonomy->show_ui )
+                       echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>';
+       }
+
+       if ( !$post_type_object->hierarchical )
+               echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
 
        echo '</div>';
 }
@@ -1345,8 +1250,6 @@ function post_rows( $posts = array() ) {
                $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]) )
@@ -1366,7 +1269,7 @@ function post_rows( $posts = array() ) {
  * @param unknown_type $mode
  */
 function _post_row($a_post, $pending_comments, $mode) {
-       global $post, $current_user;
+       global $post, $current_user, $current_screen;
        static $rowclass;
 
        $global_post = $post;
@@ -1377,11 +1280,12 @@ function _post_row($a_post, $pending_comments, $mode) {
        $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
        $edit_link = get_edit_post_link( $post->ID );
        $title = _draft_or_post_title();
+       $post_type_object = get_post_type_object($post->post_type);
 ?>
        <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');
+       $posts_columns = get_column_headers( $current_screen );
+       $hidden = get_hidden_columns( $current_screen );
        foreach ( $posts_columns as $column_name=>$column_display_name ) {
                $class = "class=\"$column_name column-$column_name\"";
 
@@ -1395,7 +1299,7 @@ function _post_row($a_post, $pending_comments, $mode) {
 
                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>
+               <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
                <?php
                break;
 
@@ -1438,27 +1342,27 @@ function _post_row($a_post, $pending_comments, $mode) {
                case 'title':
                        $attributes = 'class="post-title column-title"' . $style;
                ?>
-               <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
+               <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
                <?php
                        if ( 'excerpt' == $mode )
                                the_excerpt();
 
                        $actions = array();
-                       if ( current_user_can('edit_post', $post->ID) && 'trash' != $post->post_status ) {
-                               $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
-                               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
+                       if ( current_user_can($post_type_object->cap->edit_post, $post->ID) && 'trash' != $post->post_status ) {
+                               $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
+                               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
                        }
-                       if ( current_user_can('delete_post', $post->ID) ) {
+                       if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) {
                                if ( 'trash' == $post->post_status )
-                                       $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
+                                       $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . "</a>";
                                elseif ( EMPTY_TRASH_DAYS )
-                                       $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
+                                       $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
                                if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
-                                       $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
+                                       $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</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="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                               if ( current_user_can($post_type_object->cap->edit_post, $post->ID) )
+                                       $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($post->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                        } elseif ( 'trash' != $post->post_status ) {
                                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                        }
@@ -1528,7 +1432,7 @@ function _post_row($a_post, $pending_comments, $mode) {
 
                case 'author':
                ?>
-               <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
+               <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post->post_type; ?>&amp;author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
                <?php
                break;
 
@@ -1540,13 +1444,13 @@ function _post_row($a_post, $pending_comments, $mode) {
 
                case 'control_edit':
                ?>
-               <td><?php if ( current_user_can('edit_post', $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
+               <td><?php if ( current_user_can($post_type_object->cap->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>
+               <td><?php if ( current_user_can($post_type_object->cap->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;
 
@@ -1576,7 +1480,7 @@ function _post_row($a_post, $pending_comments, $mode) {
  * @param unknown_type $level
  */
 function display_page_row( $page, $level = 0 ) {
-       global $post;
+       global $post, $current_screen;
        static $rowclass;
 
        $post = $page;
@@ -1603,14 +1507,16 @@ function display_page_row( $page, $level = 0 ) {
        $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');
+       $posts_columns = get_column_headers( $current_screen );
+       $hidden = get_hidden_columns(  $current_screen );
        $title = _draft_or_post_title();
+       $post_type = $page->post_type;
+       $post_type_object = get_post_type_object($post_type);
 ?>
 <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
 <?php
 
-foreach ($posts_columns as $column_name=>$column_display_name) {
+foreach ( $posts_columns as $column_name => $column_display_name ) {
        $class = "class=\"$column_name column-$column_name\"";
 
        $style = '';
@@ -1623,7 +1529,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
 
        case 'cb':
                ?>
-               <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th>
+               <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
                <?php
                break;
        case 'date':
@@ -1661,24 +1567,24 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
                $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_page', $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
+               <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?></strong>
                <?php
                $actions = array();
-               if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) {
+               if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) {
                        $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                }
-               if ( current_user_can('delete_page', $page->ID) ) {
+               if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) {
                        if ( $post->post_status == 'trash' )
-                               $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
+                               $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=untrash&amp;post=$page->ID", 'untrash-' . $post->post_type . '_' . $page->ID) . "'>" . __('Restore') . "</a>";
                        elseif ( EMPTY_TRASH_DAYS )
                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>";
                        if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
-                               $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
+                               $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=delete&amp;post=$page->ID", 'delete-' . $post->post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . "</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="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                       if ( current_user_can($post_type_object->cap->edit_post, $page->ID) )
+                               $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink($page->ID) ) ) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                } elseif ( $post->post_status != 'trash' ) {
                        $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                }
@@ -1716,7 +1622,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
 
        case 'author':
                ?>
-               <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
+               <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post_type; ?>&amp;author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
                <?php
                break;
 
@@ -1776,7 +1682,7 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
                        // 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) );
+                               $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $page->ID));
                                clean_page_cache( $page->ID );
                        }
 
@@ -1820,12 +1726,9 @@ 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
- */
-/**
- * {@internal Missing Short Description}}
  *
  * @since unknown
  *
@@ -1879,16 +1782,17 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Generate HTML for a single row on the users.php admin panel.
  *
- * @since unknown
+ * @since 2.1.0
  *
- * @param unknown_type $user_object
- * @param unknown_type $style
- * @param unknown_type $role
- * @return unknown
+ * @param object $user_object
+ * @param string $style Optional. Attributes added to the TR element.  Must be sanitized.
+ * @param string $role Key for the $wp_roles array.
+ * @param int $numposts Optional. Post count to display for this user.  Defaults to zero, as in, a new user has made zero posts.
+ * @return string
  */
-function user_row( $user_object, $style = '', $role = '' ) {
+function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
        global $wp_roles;
 
        $current_user = wp_get_current_user();
@@ -1904,12 +1808,11 @@ function user_row( $user_object, $style = '', $role = '' ) {
                $short_url = substr( $short_url, 0, -1 );
        if ( strlen( $short_url ) > 35 )
                $short_url = substr( $short_url, 0, 32 ).'...';
-       $numposts = get_usernumposts( $user_object->ID );
        $checkbox = '';
        // Check if the user for this row is editable
-       if ( current_user_can( 'edit_user', $user_object->ID ) ) {
+       if ( current_user_can( 'list_users' ) ) {
                // Set up the user editing link
-               // TODO: make profile/user-edit determination a seperate function
+               // TODO: make profile/user-edit determination a separate function
                if ($current_user->ID == $user_object->ID) {
                        $edit_link = 'profile.php';
                } else {
@@ -1919,9 +1822,18 @@ function user_row( $user_object, $style = '', $role = '' ) {
 
                // Set up the hover actions for this user
                $actions = array();
-               $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
-               if ( $current_user->ID != $user_object->ID )
+
+               if ( current_user_can('edit_user',  $user_object->ID) ) {
+                       $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
+                       $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
+               } else {
+                       $edit = "<strong>$user_object->user_login</strong><br />";
+               }
+
+               if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $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>";
+               if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
+                       $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=remove&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Remove') . "</a>";
                $actions = apply_filters('user_row_actions', $actions, $user_object);
                $action_count = count($actions);
                $i = 0;
@@ -1964,7 +1876,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
                                $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>";
+                               $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>";
@@ -2095,8 +2007,10 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
        $comment = get_comment( $comment_id );
        $post = get_post($comment->comment_post_ID);
        $the_comment_status = wp_get_comment_status($comment->comment_ID);
-       $user_can = current_user_can('edit_post', $post->ID);
+       $post_type_object = get_post_type_object($post->post_type);
+       $user_can = current_user_can($post_type_object->cap->edit_post, $post->ID);
 
+       $comment_url = esc_url(get_comment_link($comment->comment_ID));
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
                $author_url = '';
@@ -2114,7 +2028,6 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
                $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
 
-               $comment_url = esc_url(get_comment_link($comment->comment_ID));
                $approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
                $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
                $spam_url = esc_url( "comment.php?action=spamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
@@ -2146,7 +2059,18 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                        case 'comment':
                                echo "<td $attributes>";
                                echo '<div id="submitted-on">';
-                               printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), $comment_url, get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia')));
+                               /* translators: 2: comment date, 3: comment time */
+                               printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
+                                       /* translators: comment date format. See http://php.net/date */ get_comment_date( __('Y/m/d') ),
+                                       /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
+
+                               if ( $comment->comment_parent ) {
+                                       $parent = get_comment( $comment->comment_parent );
+                                       $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+                                       $name = apply_filters( 'get_comment_author', $parent->comment_author ); // there's no API function for this
+                                       printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
+                               }
+
                                echo '</div>';
                                comment_text();
                                if ( $user_can ) { ?>
@@ -2184,7 +2108,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                                        if ( 'spam' != $the_comment_status && 'trash' != $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='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
                                        } elseif ( 'spam' == $the_comment_status ) {
-                                               $actions['unspam'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . __( 'Not Spam' ) . '</a>';
+                                               $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
                                        } elseif ( 'trash' == $the_comment_status ) {
                                                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
                                        }
@@ -2253,9 +2177,9 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                        case 'response':
                                if ( 'single' !== $mode ) {
                                        if ( isset( $_comment_pending_count[$post->ID] ) ) {
-                                               $pending_comments = absint( $_comment_pending_count[$post->ID] );
+                                               $pending_comments = $_comment_pending_count[$post->ID];
                                        } else {
-                                               $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
+                                               $_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
                                                $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
                                        }
                                        if ( $user_can ) {
@@ -2349,7 +2273,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
        <a href="#comments-form" class="save button-primary alignright" tabindex="104">
        <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
        <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
-       <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
+       <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
        <span class="error" style="display:none;"></span>
        <br class="clear" />
        </p>
@@ -2362,7 +2286,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
        <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 esc_attr($mode); ?>" />
-       <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
+       <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false ); ?>
        <?php wp_comment_form_unfiltered_html_nonce(); ?>
 <?php if ( $table_row ) : ?>
 </td></tr></tbody></table>
@@ -2389,39 +2313,6 @@ function wp_comment_trashnotice() {
 <?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) );
-
-       if ( $categories ) {
-               foreach ( $categories as $category ) {
-                       if ( $currentcat != $category->term_id && $parent == $category->parent) {
-                               $pad = str_repeat( '&#8211; ', $level );
-                               $category->name = esc_html( $category->name );
-                               echo "\n\t<option value='$category->term_id'";
-                               if ( $currentparent == $category->term_id )
-                                       echo " selected='selected'";
-                               echo ">$pad$category->name</option>";
-                               wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
-                       }
-               }
-       } else {
-               return false;
-       }
-}
-
 /**
  * {@internal Missing Short Description}}
  *
@@ -2510,7 +2401,7 @@ function _list_meta_row( $entry, &$count ) {
 
        $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='". esc_attr__( 'Delete' ) ."' />";
-       $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='". esc_attr__( 'Update' ) ."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";
+       $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='". esc_attr__( 'Update' ) ."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce updatemeta' /></div>";
        $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
        $r .= "</td>";
 
@@ -2531,12 +2422,12 @@ function meta_form() {
                FROM $wpdb->postmeta
                GROUP BY meta_key
                HAVING meta_key NOT LIKE '\_%'
-               ORDER BY LOWER(meta_key)
+               ORDER BY meta_key
                LIMIT $limit" );
        if ( $keys )
                natcasesort($keys);
 ?>
-<p><strong><?php _e( 'Add new custom field:' ) ?></strong></p>
+<p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
 <table id="newmeta">
 <thead>
 <tr>
@@ -2550,12 +2441,11 @@ function meta_form() {
 <td id="newmetaleft" class="left">
 <?php if ( $keys ) { ?>
 <select id="metakeyselect" name="metakeyselect" tabindex="7">
-<option value="#NONE#"><?php _e( '- Select -' ); ?></option>
+<option value="#NONE#"><?php _e( '&mdash; Select &mdash;' ); ?></option>
 <?php
 
        foreach ( $keys as $key ) {
-               $key = esc_attr( $key );
-               echo "\n<option value='" . esc_attr($key) . "'>$key</option>";
+               echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
        }
 ?>
 </select>
@@ -2572,7 +2462,7 @@ function meta_form() {
 
 <tr><td colspan="2" class="submit">
 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php esc_attr_e( 'Add Custom Field' ) ?>" />
-<?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
+<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
 </td></tr>
 </tbody>
 </table>
@@ -2594,7 +2484,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
        global $wp_locale, $post, $comment;
 
        if ( $for_post )
-               $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;
+               $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
 
        $tab_index_attribute = '';
        if ( (int) $tab_index > 0 )
@@ -2602,7 +2492,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
 
        // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
 
-       $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
+       $time_adj = current_time('timestamp');
        $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
        $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
        $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
@@ -2709,18 +2599,6 @@ 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 '
-               <div id="bh"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></div>
-';
-}
-
 /**
  * {@internal Missing Short Description}}
  *
@@ -2736,7 +2614,7 @@ function the_attachment_links( $id = false ) {
        if ( $post->post_type != 'attachment' )
                return false;
 
-       $icon = get_attachment_icon( $post->ID );
+       $icon = wp_get_attachment_image( $post->ID, 'thumbnail', true );
        $attachment_data = wp_get_attachment_metadata( $id );
        $thumb = isset( $attachment_data['thumb'] );
 ?>
@@ -2784,13 +2662,12 @@ function the_attachment_links( $id = false ) {
  * @param string $default slug for the role that should be already selected
  */
 function wp_dropdown_roles( $selected = false ) {
-       global $wp_roles;
        $p = '';
        $r = '';
 
        $editable_roles = get_editable_roles();
 
-       foreach( $editable_roles as $role => $details ) {
+       foreach ( $editable_roles as $role => $details ) {
                $name = translate_user_role($details['name'] );
                if ( $selected == $role ) // Make default first in list
                        $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
@@ -2881,18 +2758,6 @@ function wp_import_upload_form( $action ) {
        endif;
 }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- */
-function wp_remember_old_slug() {
-       global $post;
-       $name = esc_attr($post->post_name); // just in case
-       if ( strlen($name) )
-               echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
-}
-
 /**
  * Add a meta box to an edit form.
  *
@@ -2957,29 +2822,27 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Meta-Box template function
  *
- * @since unknown
+ * @since 2.5.0
  *
- * @param unknown_type $page
- * @param unknown_type $context
- * @param unknown_type $object
+ * @param string $page page identifier, also known as screen identifier
+ * @param string $context box context
+ * @param mixed $object gets passed to the box callback function as first parameter
  * @return int number of 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);
-
        $hidden = get_hidden_meta_boxes($page);
 
-       echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
+       printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
 
        $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 ) ) {
+               if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
                        foreach ( $sorted as $box_context => $ids )
                                foreach ( explode(',', $ids) as $id )
                                        if ( $id )
@@ -2997,9 +2860,8 @@ function do_meta_boxes($page, $context, $object) {
                                                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";
+                                       $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
+                                       echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\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";
@@ -3045,19 +2907,22 @@ function remove_meta_box($id, $page, $context) {
  *
  * @since unknown
  *
- * @param unknown_type $page
+ * @param unknown_type $screen
  */
-function meta_box_prefs($page) {
+function meta_box_prefs($screen) {
        global $wp_meta_boxes;
 
-       if ( empty($wp_meta_boxes[$page]) )
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       if ( empty($wp_meta_boxes[$screen->id]) )
                return;
 
-       $hidden = get_hidden_meta_boxes($page);
+       $hidden = get_hidden_meta_boxes($screen);
 
-       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 ) {
+       foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) {
+               foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) {
+                       foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {
                                if ( false == $box || ! $box['title'] )
                                        continue;
                                // Submit box cannot be hidden
@@ -3072,13 +2937,23 @@ function meta_box_prefs($page) {
        }
 }
 
-function get_hidden_meta_boxes($page) {
-       $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
+/**
+ * Get Hidden Meta Boxes
+ *
+ * @since 2.7
+ *
+ * @param string|object $screen Screen identifier
+ * @return array Hidden Meta Boxes
+ */
+function get_hidden_meta_boxes( $screen ) {
+       if ( is_string( $screen ) )
+               $screen = convert_to_screen( $screen );
+
+       $hidden = get_user_option( "metaboxhidden_{$screen->id}" );
 
        // Hide slug boxes by default
-       if ( empty($hidden[0]) ) {
+       if ( !is_array( $hidden ) )
                $hidden = array('slugdiv');
-       }
 
        return $hidden;
 }
@@ -3086,16 +2961,31 @@ function get_hidden_meta_boxes($page) {
 /**
  * Add a new section to a settings page.
  *
+ * Part of the Settings API. Use this to define new settings sections for an admin page.
+ * Show settings sections in your admin page callback function with do_settings_sections().
+ * Add settings fields to your section with add_settings_field()
+ *
+ * The $callback argument should be the name of a function that echoes out any
+ * content you want to show at the top of the settings section before the actual
+ * fields. It can output nothing if you want.
+ *
  * @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, ...).
+ * @global $wp_settings_sections Storage array of all settings sections added to admin pages
+ *
+ * @param string $id Slug-name to identify the section. Used in the 'id' attribute of tags.
+ * @param string $title Formatted title of the section. Shown as the heading for the section.
+ * @param string $callback Function that echos out any content at the top of the section (between heading and fields).
+ * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page();
  */
 function add_settings_section($id, $title, $callback, $page) {
        global $wp_settings_sections;
 
+       if ( 'misc' == $page ) {
+               _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
+               $page = 'general';
+       }
+
        if ( !isset($wp_settings_sections) )
                $wp_settings_sections = array();
        if ( !isset($wp_settings_sections[$page]) )
@@ -3107,20 +2997,35 @@ function add_settings_section($id, $title, $callback, $page) {
 }
 
 /**
- * Add a new field to a settings page.
+ * Add a new field to a section of a settings page
+ *
+ * Part of the Settings API. Use this to define a settings field that will show
+ * as part of a settings section inside a settings page. The fields are shown using
+ * do_settings_fields() in do_settings-sections()
+ *
+ * The $callback argument should be the name of a function that echoes out the
+ * html input tags for this setting field. Use get_option() to retrive existing
+ * values to show.
  *
  * @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, ...).
+ * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
+ *
+ * @param string $id Slug-name to identify the field. Used in the 'id' attribute of tags.
+ * @param string $title Formatted title of the field. Shown as the label for the field during output.
+ * @param string $callback Function that fills the field with the desired form inputs. The function should echo its output.
+ * @param string $page The slug-name of the settings page on which to show the section (general, reading, writing, ...).
+ * @param string $section The slug-name of 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 ( 'misc' == $page ) {
+               _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
+               $page = 'general';
+       }
+
        if ( !isset($wp_settings_fields) )
                $wp_settings_fields = array();
        if ( !isset($wp_settings_fields[$page]) )
@@ -3132,11 +3037,17 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Prints out all settings sections added to a particular settings page
  *
+ * Part of the Settings API. Use this in a settings page callback function
+ * to output all the sections and fields that were added to that $page with
+ * add_settings_section() and add_settings_field()
+ *
+ * @global $wp_settings_sections Storage array of all settings sections added to admin pages
+ * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
  * @since unknown
  *
- * @param unknown_type $page
+ * @param string $page The slug name of the page whos settings sections you want to output
  */
 function do_settings_sections($page) {
        global $wp_settings_sections, $wp_settings_fields;
@@ -3156,12 +3067,18 @@ function do_settings_sections($page) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Print out the settings fields for a particular settings section
+ *
+ * Part of the Settings API. Use this in a settings page to output
+ * a specific section. Should normally be called by do_settings_sections()
+ * rather than directly.
+ *
+ * @global $wp_settings_fields Storage array of settings fields and their pages/sections
  *
  * @since unknown
  *
- * @param unknown_type $page
- * @param unknown_type $section
+ * @param string $page Slug title of the admin page who's settings fields you want to show.
+ * @param section $section Slug title of the settings section who's fields you want to show.
  */
 function do_settings_fields($page, $section) {
        global $wp_settings_fields;
@@ -3182,6 +3099,131 @@ function do_settings_fields($page, $section) {
        }
 }
 
+/**
+ * Register a settings error to be displayed to the user
+ *
+ * Part of the Settings API. Use this to show messages to users about settings validation
+ * problems, missing settings or anything else.
+ *
+ * Settings errors should be added inside the $sanitize_callback function defined in
+ * register_setting() for a given setting to give feedback about the submission.
+ *
+ * By default messages will show immediately after the submission that generated the error.
+ * Additional calls to settings_errors() can be used to show errors even when the settings
+ * page is first accessed.
+ *
+ * @global array $wp_settings_errors Storage array of errors registered during this pageload
+ *
+ * @param string $setting Slug title of the setting to which this error applies
+ * @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
+ * @param string $message The formatted message text to display to the user (will be shown inside styled <div> and <p>)
+ * @param string $type The type of message it is, controls HTML class. Use 'error' or 'updated'.
+ */
+function add_settings_error( $setting, $code, $message, $type = 'error' ) {
+       global $wp_settings_errors;
+
+       if ( !isset($wp_settings_errors) )
+               $wp_settings_errors = array();
+
+       $new_error = array(
+               'setting' => $setting,
+               'code' => $code,
+               'message' => $message,
+               'type' => $type
+       );
+       $wp_settings_errors[] = $new_error;
+}
+
+/**
+ * Fetch settings errors registered by add_settings_error()
+ *
+ * Checks the $wp_settings_errors array for any errors declared during the current
+ * pageload and returns them.
+ *
+ * If changes were just submitted ($_GET['updated']) and settings errors were saved
+ * to the 'settings_errors' transient then those errors will be returned instead. This
+ * is used to pass errors back across pageloads.
+ *
+ * Use the $sanitize argument to manually re-sanitize the option before returning errors.
+ * This is useful if you have errors or notices you want to show even when the user
+ * hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook)
+ *
+ * @global array $wp_settings_errors Storage array of errors registered during this pageload
+ *
+ * @param string $setting Optional slug title of a specific setting who's errors you want.
+ * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
+ * @return array Array of settings errors
+ */
+function get_settings_errors( $setting = '', $sanitize = FALSE ) {
+       global $wp_settings_errors;
+
+       // If $sanitize is true, manually re-run the sanitizisation for this option
+       // This allows the $sanitize_callback from register_setting() to run, adding
+       // any settings errors you want to show by default.
+       if ( $sanitize )
+               sanitize_option( $setting, get_option($setting));
+
+       // If settings were passed back from options.php then use them
+       // Ignore transients if $sanitize is true, we dont' want the old values anyway
+       if ( isset($_GET['updated']) && $_GET['updated'] && get_transient('settings_errors') ) {
+               $settings_errors = get_transient('settings_errors');
+               delete_transient('settings_errors');
+       // Otherwise check global in case validation has been run on this pageload
+       } elseif ( count( $wp_settings_errors ) ) {
+               $settings_errors = $wp_settings_errors;
+       } else {
+               return;
+       }
+
+       // Filter the results to those of a specific setting if one was set
+       if ( $setting ) {
+               foreach ( (array) $settings_errors as $key => $details )
+                       if ( $setting != $details['setting'] )
+                               unset( $settings_errors[$key] );
+       }
+       return $settings_errors;
+}
+
+/**
+ * Display settings errors registered by add_settings_error()
+ *
+ * Part of the Settings API. Outputs a <div> for each error retrieved by get_settings_errors().
+ *
+ * This is called automatically after a settings page based on the Settings API is submitted.
+ * Errors should be added during the validation callback function for a setting defined in register_setting()
+ *
+ * The $sanitize option is passed into get_settings_errors() and will re-run the setting sanitization
+ * on its current value.
+ *
+ * The $hide_on_update option will cause errors to only show when the settings page is first loaded.
+ * if the user has already saved new values it will be hidden to avoid repeating messages already
+ * shown in the default error reporting after submission. This is useful to show general errors like missing
+ * settings when the user arrives at the settings page.
+ *
+ * @param string $setting Optional slug title of a specific setting who's errors you want.
+ * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
+ * @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted.
+ * @return <type>
+ */
+function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) {
+
+       if ($hide_on_update AND $_GET['updated']) return;
+
+       $settings_errors = get_settings_errors( $setting, $sanitize );
+
+       if ( !is_array($settings_errors) ) return;
+
+       $output = '';
+       foreach ( $settings_errors as $key => $details ) {
+               $css_id = 'setting-error-' . $details['code'];
+               $css_class = $details['type'] . ' settings-error';
+               $output .= "<div id='$css_id' class='$css_class'> \n";
+               $output .= "<p><strong>{$details['message']}</strong></p>";
+               $output .= "</div> \n";
+       }
+       echo $output;
+}
+
 /**
  * {@internal Missing Short Description}}
  *
@@ -3189,20 +3231,20 @@ function do_settings_fields($page, $section) {
  *
  * @param unknown_type $page
  */
-function manage_columns_prefs($page) {
-       $columns = get_column_headers($page);
-
-       $hidden = get_hidden_columns($page);
+function manage_columns_prefs( $page ) {
+       $columns = get_column_headers( $page );
+       $hidden  = get_hidden_columns( $page );
+       $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username');
 
        foreach ( $columns as $column => $title ) {
-               // Can't hide these
-               if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
+               // Can't hide these or they are special
+               if ( in_array( $column, $special ) )
                        continue;
-               if ( empty($title) )
+               if ( empty( $title ) )
                        continue;
 
                if ( 'comments' == $column )
-                       $title = __('Comments');
+                       $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"' : '') . ' />';
@@ -3233,10 +3275,16 @@ function find_posts_div($found_action = '') {
                                <input type="text" id="find-posts-input" name="ps" value="" />
                                <input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />
 
-                               <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
-                               <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
-                               <input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" />
-                               <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label>
+                               <?php
+                               $post_types = get_post_types( array('public' => true), 'objects' );
+                               foreach ( $post_types as $post ) {
+                                       if ( 'attachment' == $post->name )
+                                               continue;
+                               ?>
+                               <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name,  'post'); ?> />
+                               <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label>
+                               <?php
+                               } ?>
                        </div>
                        <div id="find-posts-response"></div>
                </div>
@@ -3268,55 +3316,62 @@ function the_post_password() {
  * @since unknown
  */
 function favorite_actions( $screen = null ) {
-       switch ( $screen ) {
-               case 'post-new.php':
-                       $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts'));
-                       break;
-               case 'edit-pages.php':
-                       $default_action = array('page-new.php' => array(__('New Page'), 'edit_pages'));
-                       break;
-               case 'page-new.php':
-                       $default_action = array('edit-pages.php' => array(__('Edit Pages'), 'edit_pages'));
-                       break;
-               case 'upload.php':
-                       $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
-                       break;
-               case 'media-new.php':
-                       $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
-                       break;
-               case 'link-manager.php':
-                       $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
-                       break;
-               case 'link-add.php':
-                       $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
-                       break;
-               case 'users.php':
-                       $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
-                       break;
-               case 'user-new.php':
-                       $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
-                       break;
-               case 'plugins.php':
-                       $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
-                       break;
-               case 'plugin-install.php':
-                       $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
-                       break;
-               case 'themes.php':
-                       $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
-                       break;
-               case 'theme-install.php':
-                       $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
-                       break;
-               default:
-                       $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
-                       break;
+       $default_action = false;
+
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       if ( isset($screen->post_type) ) {
+               $post_type_object = get_post_type_object($screen->post_type);
+               if ( 'add' != $screen->action )
+                       $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts));
+               else
+                       $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->name, $post_type_object->cap->edit_posts));
+       }
+
+       if ( !$default_action ) {
+               switch ( $screen->id ) {
+                       case 'upload':
+                               $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
+                               break;
+                       case 'media':
+                               $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
+                               break;
+                       case 'link-manager':
+                       case 'link':
+                               if ( 'add' != $screen->action )
+                                       $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
+                               else
+                                       $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
+                               break;
+                       case 'users':
+                               $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
+                               break;
+                       case 'user':
+                               $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
+                               break;
+                       case 'plugins':
+                               $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
+                               break;
+                       case 'plugin-install':
+                               $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
+                               break;
+                       case 'themes':
+                               $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
+                               break;
+                       case 'theme-install':
+                               $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
+                               break;
+                       default:
+                               $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
+                               break;
+               }
        }
 
        $actions = array(
                'post-new.php' => array(__('New Post'), 'edit_posts'),
                'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
-               'page-new.php' => array(__('New Page'), 'edit_pages'),
+               'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),
                'media-new.php' => array(__('Upload'), 'upload_files'),
                'edit-comments.php' => array(__('Comments'), 'moderate_comments')
                );
@@ -3363,8 +3418,7 @@ function favorite_actions( $screen = null ) {
  * @param int $id The post id. If not supplied the global $post is used.
  *
  */
-function _draft_or_post_title($post_id = 0)
-{
+function _draft_or_post_title($post_id = 0) {
        $title = get_the_title($post_id);
        if ( empty($title) )
                $title = __('(no title)');
@@ -3394,6 +3448,7 @@ function _admin_search_query() {
  *
  */
 function iframe_header( $title = '', $limit_styles = false ) {
+global $hook_suffix;
 ?><!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>
@@ -3415,9 +3470,20 @@ function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_r
 do_action('admin_print_styles');
 do_action('admin_print_scripts');
 do_action('admin_head');
+
+$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
 ?>
 </head>
-<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>  class="no-js <?php echo $admin_body_class; ?>">
+<script type="text/javascript">
+//<![CDATA[
+(function(){
+var c = document.body.className;
+c = c.replace(/no-js/, 'js');
+document.body.className = c;
+})();
+//]]>
+</script>
 <?php
 }
 
@@ -3473,25 +3539,38 @@ function _post_states($post) {
        }
 }
 
+/**
+ * Convert a screen string to a screen object
+ *
+ * @since 3.0.0
+ *
+ * @param string $screen The name of the screen
+ * @return object An object containing the safe screen name and id
+ */
+function convert_to_screen( $screen ) {
+       $screen = str_replace( array('.php', '-new', '-add' ), '', $screen);
+       $screen = (string) apply_filters( 'screen_meta_screen', $screen );
+       $screen = (object) array('id' => $screen, 'base' => $screen);
+       return $screen;
+}
+
 function screen_meta($screen) {
-       global $wp_meta_boxes, $_wp_contextual_help;
+       global $wp_meta_boxes, $_wp_contextual_help, $title;
 
-       $screen = str_replace('.php', '', $screen);
-       $screen = str_replace('-new', '', $screen);
-       $screen = str_replace('-add', '', $screen);
-       $screen = apply_filters('screen_meta_screen', $screen);
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
 
        $column_screens = get_column_headers($screen);
        $meta_screens = array('index' => 'dashboard');
 
-       if ( isset($meta_screens[$screen]) )
-               $screen = $meta_screens[$screen];
+       if ( isset($meta_screens[$screen->id]) ) {
+               $screen->id = $meta_screens[$screen->id];
+               $screen->base = $screen->id;
+       }
+
        $show_screen = false;
-       $show_on_screen = false;
-       if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) ) {
+       if ( !empty($wp_meta_boxes[$screen->id]) || !empty($column_screens) )
                $show_screen = true;
-               $show_on_screen = true;
-       }
 
        $screen_options = screen_options($screen);
        if ( $screen_options )
@@ -3500,109 +3579,68 @@ function screen_meta($screen) {
        if ( !isset($_wp_contextual_help) )
                $_wp_contextual_help = array();
 
-       $settings = '';
+       $settings = apply_filters('screen_settings', '', $screen);
 
-       switch ( $screen ) {
-               case 'post':
-                       if ( !isset($_wp_contextual_help['post']) ) {
-                               $help = drag_drop_help();
-                               $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
-                               $_wp_contextual_help['post'] = $help;
-                       }
-                       break;
-               case 'page':
-                       if ( !isset($_wp_contextual_help['page']) ) {
-                               $help = drag_drop_help();
-                               $_wp_contextual_help['page'] = $help;
-                       }
-                       break;
-               case 'dashboard':
-                       if ( !isset($_wp_contextual_help['dashboard']) ) {
-                               $help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n";
-                               $help .= drag_drop_help();
-                               $_wp_contextual_help['dashboard'] = $help;
-                       }
-                       break;
-               case 'link':
-                       if ( !isset($_wp_contextual_help['link']) ) {
-                               $help = drag_drop_help();
-                               $_wp_contextual_help['link'] = $help;
-                       }
-                       break;
-               case 'options-general':
-                       if ( !isset($_wp_contextual_help['options-general']) )
-                               $_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
-                       break;
-               case 'theme-install':
-               case 'plugin-install':
-                       if ( ( !isset($_GET['tab']) || 'dashboard' == $_GET['tab'] ) && !isset($_wp_contextual_help[$screen]) ) {
-                               $help = plugins_search_help();
-                               $_wp_contextual_help[$screen] = $help;
-                       }
-                       break;
+       switch ( $screen->id ) {
                case 'widgets':
-                       if ( !isset($_wp_contextual_help['widgets']) ) {
-                               $help = widgets_help();
-                               $_wp_contextual_help['widgets'] = $help;
-                       }
                        $settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
                        $show_screen = true;
                        break;
        }
+       if( ! empty( $settings ) )
+               $show_screen = true;
 ?>
 <div id="screen-meta">
-<?php
-       if ( $show_screen ) :
-?>
+<?php if ( $show_screen ) : ?>
 <div id="screen-options-wrap" class="hidden">
        <form id="adv-settings" action="" method="post">
-<?php if ( $show_on_screen ) : ?>
-       <h5><?php _e('Show on screen') ?></h5>
-       <div class="metabox-prefs">
-<?php
-       if ( !meta_box_prefs($screen) && isset($column_screens) ) {
-               manage_columns_prefs($screen);
+       <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?>
+               <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>
+               <div class="metabox-prefs">
+                       <?php meta_box_prefs($screen); ?>
+                       <br class="clear" />
+               </div>
+               <?php endif;
+               if ( ! empty($column_screens) ) : ?>
+               <h5><?php echo ( isset( $column_screens['_title'] ) ?  $column_screens['_title'] :  _x('Show on screen', 'Columns') ) ?></h5>
+               <div class="metabox-prefs">
+                       <?php manage_columns_prefs($screen); ?>
+                       <br class="clear" />
+               </div>
+       <?php endif;
+       echo screen_layout($screen);
+
+       if ( !empty( $screen_options ) ) {
+               ?>
+               <h5><?php _ex('Show on screen', 'Screen Options') ?></h5>
+               <?php
        }
-?>
-       <br class="clear" />
-       </div>
-<?php endif; ?>
-<?php echo screen_layout($screen); ?>
-<?php echo $screen_options; ?>
-<?php echo $settings; ?>
+
+       echo $screen_options;
+       echo $settings; ?>
 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
 </form>
 </div>
 
-<?php
-       endif;
-
-       global $title;
+<?php endif; // $show_screen
 
        $_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 &#8220;%s&#8221;'), $title) . '</h5>';
-               else
-                       $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
-               $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
-
-               $contextual_help .= '<h5>' . __('Other Help') . '</h5>';
+       if ( isset($_wp_contextual_help[$screen->id]) ) {
+               $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n";
        } else {
-               $contextual_help .= '<h5>' . __('Help') . '</h5>';
+               $contextual_help .= '<div class="metabox-prefs">';
+               $default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
+               $default_help .= '<br />';
+               $default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
+               $contextual_help .= apply_filters('default_contextual_help', $default_help);
+               $contextual_help .= "</div>\n";
        }
 
-       $contextual_help .= '<div class="metabox-prefs">';
-       $default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
-       $default_help .= '<br />';
-       $default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
-       $contextual_help .= apply_filters('default_contextual_help', $default_help);
-       $contextual_help .= "</div>\n";
-       echo apply_filters('contextual_help', $contextual_help, $screen);
+       echo apply_filters('contextual_help', $contextual_help, $screen->id, $screen);
        ?>
        </div>
 
@@ -3631,10 +3669,13 @@ function screen_meta($screen) {
 function add_contextual_help($screen, $help) {
        global $_wp_contextual_help;
 
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
        if ( !isset($_wp_contextual_help) )
                $_wp_contextual_help = array();
 
-       $_wp_contextual_help[$screen] = $help;
+       $_wp_contextual_help[$screen->id] = $help;
 }
 
 function drag_drop_help() {
@@ -3654,28 +3695,27 @@ function plugins_search_help() {
 ';
 }
 
-function widgets_help() {
-       return '
-       <p>' . __('Widgets are added and arranged by simple drag &#8217;n&#8217; drop. If you hover your mouse over the titlebar of a widget, you&#8217;ll see a 4-arrow cursor which indicates that the widget is movable.  Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you&#8217;ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '</p>
-       <p>' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '</p>
-       <p>' . __('To remove a widget from a sidebar <em>and keep its configuration</em>, drag it to Inactive Widgets.') . '</p>
-       <p>' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '</p>
-';
-}
-
 function screen_layout($screen) {
        global $screen_layout_columns;
 
-       $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2);
-       $columns = apply_filters('screen_layout_columns', $columns, $screen);
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       $columns = array('dashboard' => 4, 'link' => 2);
+
+       // Add custom post types
+       foreach ( get_post_types( array('show_ui' => true) ) as $post_type )
+               $columns[$post_type] = 2;
 
-       if ( !isset($columns[$screen]) ) {
+       $columns = apply_filters('screen_layout_columns', $columns, $screen->id, $screen);
+
+       if ( !isset($columns[$screen->id]) ) {
                $screen_layout_columns = 0;
                return '';
        }
 
-       $screen_layout_columns = get_user_option("screen_layout_$screen");
-       $num = $columns[$screen];
+       $screen_layout_columns = get_user_option("screen_layout_$screen->id");
+       $num = $columns[$screen->id];
 
        if ( ! $screen_layout_columns )
                        $screen_layout_columns = 2;
@@ -3691,66 +3731,91 @@ function screen_layout($screen) {
 }
 
 function screen_options($screen) {
-       switch ( $screen ) {
+       if ( is_string($screen) )
+               $screen = convert_to_screen($screen);
+
+       switch ( $screen->base ) {
                case 'edit':
-                       $per_page_label = __('Posts per page:');
-                       break;
                case 'edit-pages':
-                       $per_page_label = __('Pages per page:');
+                       $post_type = 'post';
+                       if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
+                               $post_type = $_GET['post_type'];
+                       $post_type_object = get_post_type_object($post_type);
+                       $per_page_label = $post_type_object->labels->name;
+                       break;
+               case 'ms-sites':
+                       $per_page_label = _x( 'Sites', 'sites per page (screen options)' );
+                       break;
+               case 'ms-users':
+                       $per_page_label = _x( 'Users', 'users per page (screen options)' );
                        break;
                case 'edit-comments':
-                       $per_page_label = __('Comments per page:');
+                       $per_page_label = _x( 'Comments', 'comments per page (screen options)' );
                        break;
                case 'upload':
-                       $per_page_label = __('Media items per page:');
-                       break;
-               case 'categories':
-                       $per_page_label = __('Categories per page:');
+                       $per_page_label = _x( 'Media items', 'items per page (screen options)' );
                        break;
                case 'edit-tags':
-                       $per_page_label = __('Tags per page:');
+                       global $tax;
+                       $per_page_label = $tax->labels->name;
                        break;
                case 'plugins':
-                       $per_page_label = __('Plugins per page:');
+                       $per_page_label = _x( 'Plugins', 'plugins per page (screen options)' );
                        break;
                default:
                        return '';
        }
 
-       $option = str_replace( '-', '_', "${screen}_per_page" );
-       $per_page = (int) get_user_option( $option, 0, false );
+       $option = str_replace( '-', '_', "{$screen->id}_per_page" );
+       if ( 'edit_tags_per_page' == $option ) {
+               if ( 'category' == $tax->name )
+                       $option = 'categories_per_page';
+               elseif ( 'post_tag' != $tax->name )
+                       $option = 'edit_' . $tax->name . '_per_page';
+       }
+
+       $per_page = (int) get_user_option( $option );
        if ( empty( $per_page ) || $per_page < 1 ) {
-               if ( 'plugins' == $screen )
+               if ( 'plugins' == $screen->id )
                        $per_page = 999;
                else
                        $per_page = 20;
        }
+
        if ( 'edit_comments_per_page' == $option )
                $per_page = apply_filters( 'comments_per_page', $per_page, isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all' );
-       elseif ( 'categories' == $option )
+       elseif ( 'categories_per_page' == $option )
                $per_page = apply_filters( 'edit_categories_per_page', $per_page );
        else
                $per_page = apply_filters( $option, $per_page );
 
-       $return = '<h5>' . __('Options') . "</h5>\n";
-       $return .= "<div class='screen-options'>\n";
+       $return = "<div class='screen-options'>\n";
        if ( !empty($per_page_label) )
-               $return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n";
+               $return .= "<input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' /> <label for='$option'>$per_page_label</label>\n";
        $return .= "<input type='submit' class='button' value='" . esc_attr__('Apply') . "' />";
        $return .= "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />";
        $return .= "</div>\n";
        return $return;
 }
 
-function screen_icon($name = '') {
-       global $parent_file, $hook_suffix;
+function screen_icon($screen = '') {
+       global $current_screen;
+
+       if ( empty($screen) )
+               $screen = $current_screen;
+       elseif ( is_string($screen) )
+               $name = $screen;
 
        if ( empty($name) ) {
-               if ( isset($parent_file) && !empty($parent_file) )
-                       $name = substr($parent_file, 0, -4);
+               if ( !empty($screen->parent_base) )
+                       $name = $screen->parent_base;
                else
-                       $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
+                       $name = $screen->base;
+
+               if ( 'edit' == $name && isset($screen->post_type) && 'page' == $screen->post_type )
+                       $name = 'edit-pages';
        }
+
 ?>
        <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
 <?php
@@ -3821,4 +3886,69 @@ function compression_test() {
 <?php
 }
 
+/**
+ * Set the current screen object
+ *
+ * @since 3.0.0
+ *
+ * @uses $current_screen
+ *
+ * @param string $id Screen id, optional.
+ */
+function set_current_screen( $id =  '' ) {
+       global $current_screen, $hook_suffix, $typenow, $taxnow;
+
+       $action = '';
+
+       if ( empty($id) ) {
+               $current_screen = $hook_suffix;
+               $current_screen = str_replace('.php', '', $current_screen);
+               if ( preg_match('/-add|-new$/', $current_screen) )
+                       $action = 'add';
+               $current_screen = str_replace('-new', '', $current_screen);
+               $current_screen = str_replace('-add', '', $current_screen);
+               $current_screen = array('id' => $current_screen, 'base' => $current_screen);
+       } else {
+               $id = sanitize_key($id);
+               if ( false !== strpos($id, '-') ) {
+                       list( $id, $typenow ) = explode('-', $id, 2);
+                       if ( taxonomy_exists( $typenow ) ) {
+                               $id = 'edit-tags';
+                               $taxnow = $typenow;
+                               $typenow = '';
+                       }
+               }
+               $current_screen = array('id' => $id, 'base' => $id);
+       }
+
+       $current_screen = (object) $current_screen;
+
+       $current_screen->action = $action;
+
+       // Map index to dashboard
+       if ( 'index' == $current_screen->base )
+               $current_screen->base = 'dashboard';
+       if ( 'index' == $current_screen->id )
+               $current_screen->id = 'dashboard';
+
+       if ( 'edit' == $current_screen->id ) {
+               if ( empty($typenow) )
+                       $typenow = 'post';
+               $current_screen->id .= '-' . $typenow;
+               $current_screen->post_type = $typenow;
+       } elseif ( 'post' == $current_screen->id ) {
+               if ( empty($typenow) )
+                       $typenow = 'post';
+               $current_screen->id = $typenow;
+               $current_screen->post_type = $typenow;
+       } elseif ( 'edit-tags' == $current_screen->id ) {
+               if ( empty($taxnow) )
+                       $taxnow = 'post_tag';
+               $current_screen->id = 'edit-' . $taxnow;
+               $current_screen->taxonomy = $taxnow;
+       }
+
+       $current_screen = apply_filters('current_screen', $current_screen);
+}
+
 ?>
index d704d67d211da9832ac1d58d8a7a8609a7b35fbc..ea96ef8bd77b340585a28324c3d8a248d9367abf 100644 (file)
@@ -156,7 +156,7 @@ function install_theme_search_form() {
        <select name="type" id="typeselector">
        <option value="term" <?php selected('term', $type) ?>><?php _e('Term'); ?></option>
        <option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option>
-       <option value="tag" <?php selected('tag', $type) ?>><?php echo _x('Tag', 'Theme Installer'); ?></option>
+       <option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option>
        </select>
        <input type="text" name="s" size="30" value="<?php echo esc_attr($term) ?>" />
        <input type="submit" name="search" value="<?php esc_attr_e('Search'); ?>" class="button" />
@@ -301,7 +301,7 @@ function display_theme($theme, $actions = null, $show_details = true) {
        if ( !is_array($actions) ) {
                $actions = array();
                $actions[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
-                                                                               '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=350') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install &#8220;%s&#8221;'), $name)) . '">' . __('Install') . '</a>';
+                                                                               '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=385') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install &#8220;%s&#8221;'), $name)) . '">' . __('Install') . '</a>';
                $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
                $actions = apply_filters('theme_install_action_links', $actions, $theme);
        }
@@ -366,8 +366,6 @@ function display_theme($theme, $actions = null, $show_details = true) {
  * @param int $totalpages Number of pages.
  */
 function display_themes($themes, $page = 1, $totalpages = 1) {
-       global $themes_allowedtags;
-
        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
        ?>
@@ -457,8 +455,11 @@ function install_theme_information() {
        // Sanitize HTML
        foreach ( (array)$api->sections as $section_name => $content )
                $api->sections[$section_name] = wp_kses($content, $themes_allowedtags);
-       foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )
-               $api->$key = wp_kses($api->$key, $themes_allowedtags);
+
+       foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key ) {
+               if ( isset($api->$key) )
+                       $api->$key = wp_kses($api->$key, $themes_allowedtags);
+       }
 
        iframe_header( __('Theme Install') );
 
@@ -476,7 +477,7 @@ function install_theme_information() {
        // Default to a "new" theme
        $type = 'install';
        // Check to see if this theme is known to be installed, and has an update awaiting it.
-       $update_themes = get_transient('update_themes');
+       $update_themes = get_site_transient('update_themes');
        if ( is_object($update_themes) && isset($update_themes->response) ) {
                foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) {
                        if ( $theme_slug === $api->slug ) {
index b39351fc9c86dd15a4faae0a1aa8db8b38d576cb..44a1f629e978ae201bcbc487631a8d753c9cb597 100644 (file)
 function current_theme_info() {
        $themes = get_themes();
        $current_theme = get_current_theme();
+       if ( ! isset( $themes[$current_theme] ) ) {
+               delete_option( 'current_theme' );
+               $current_theme = get_current_theme();
+       }
        $ct->name = $current_theme;
        $ct->title = $themes[$current_theme]['Title'];
        $ct->version = $themes[$current_theme]['Version'];
@@ -65,7 +69,7 @@ function delete_theme($template) {
                request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again
                $data = ob_get_contents();
                ob_end_clean();
-               if( ! empty($data) ){
+               if ( ! empty($data) ) {
                        include_once( ABSPATH . 'wp-admin/admin-header.php');
                        echo $data;
                        include( ABSPATH . 'wp-admin/admin-footer.php');
@@ -79,7 +83,7 @@ function delete_theme($template) {
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
        if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
+               return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors);
 
        //Get the base plugin folder
        $themes_dir = $wp_filesystem->wp_themes_dir();
@@ -87,17 +91,14 @@ function delete_theme($template) {
                return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.'));
 
        $themes_dir = trailingslashit( $themes_dir );
-
-       $errors = array();
-
        $theme_dir = trailingslashit($themes_dir . $template);
        $deleted = $wp_filesystem->delete($theme_dir, true);
 
        if ( ! $deleted )
-               return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s'), $template) );
+               return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $template) );
 
        // Force refresh of theme update information
-       delete_transient('update_themes');
+       delete_site_transient('update_themes');
 
        return true;
 }
@@ -116,6 +117,45 @@ function get_broken_themes() {
        return $wp_broken_themes;
 }
 
+/**
+ * Get the allowed themes for the current blog.
+ *
+ * @since 3.0.0
+ *
+ * @uses get_themes()
+ * @uses current_theme_info()
+ * @uses get_site_allowed_themes()
+ * @uses wpmu_get_blog_allowedthemes
+ *
+ * @return array $themes Array of allowed themes.
+ */
+function get_allowed_themes() {
+       if ( !is_multisite() )
+               return get_themes();
+
+       $themes = get_themes();
+       $ct = current_theme_info();
+       $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes() );
+       if ( $allowed_themes == false )
+               $allowed_themes = array();
+
+       $blog_allowed_themes = wpmu_get_blog_allowedthemes();
+       if ( is_array( $blog_allowed_themes ) )
+               $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );
+
+       if ( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false )
+               $allowed_themes[ esc_html( $ct->stylesheet ) ] = true;
+
+       reset( $themes );
+       foreach ( $themes as $key => $theme ) {
+               if ( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false )
+                       unset( $themes[ $key ] );
+       }
+       reset( $themes );
+
+       return $themes;
+}
+
 /**
  * Get the Page Templates available in this theme
  *
@@ -156,10 +196,10 @@ function get_page_templates() {
 
 /**
  * Tidies a filename for url display by the theme editor.
- * 
+ *
  * @since 2.9.0
- * @private
- * 
+ * @access private
+ *
  * @param string $fullpath Full path to the theme file
  * @param string $containingfolder Path of the theme parent folder
  * @return string
@@ -168,4 +208,46 @@ function _get_template_edit_filename($fullpath, $containingfolder) {
        return str_replace(dirname(dirname( $containingfolder )) , '', $fullpath);
 }
 
+/**
+ * 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 ( !current_user_can('update_themes' ) )
+               return;
+
+       if ( !isset($themes_update) )
+               $themes_update = get_site_transient('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 ];
+               $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');
+               $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
+               $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
+               $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Upgrading this theme will lose any customizations you have made.  'Cancel' to stop, 'OK' to upgrade.") ) . '\') ) {return true;}return false;"';
+
+               if ( ! current_user_can('update_themes') )
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
+               else if ( empty($update['package']) )
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
+               else
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s" %5$s>upgrade automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
+       }
+}
+
 ?>
index d179e1eb9bf25980483ae1b76bbbb08164e5c8d8..d9698a7e4c579fadc8eb1f4440ced8c0799bb0b0 100644 (file)
@@ -171,7 +171,58 @@ $_old_files = array(
 'wp-images/wpminilogo.png',
 'wp.php',
 'wp-includes/gettext.php',
-'wp-includes/streams.php'
+'wp-includes/streams.php',
+// MU
+'wp-admin/wpmu-admin.php',
+'wp-admin/wpmu-blogs.php',
+'wp-admin/wpmu-edit.php',
+'wp-admin/wpmu-options.php',
+'wp-admin/wpmu-themes.php',
+'wp-admin/wpmu-upgrade-site.php',
+'wp-admin/wpmu-users.php',
+'wp-includes/wpmu-default-filters.php',
+'wp-includes/wpmu-functions.php',
+'wpmu-settings.php',
+'index-install.php',
+'README.txt',
+'htaccess.dist',
+'wp-admin/css/mu-rtl.css',
+'wp-admin/css/mu.css',
+'wp-admin/images/site-admin.png',
+'wp-admin/includes/mu.php',
+'wp-includes/images/wordpress-mu.png',
+// 3.0
+'wp-admin/categories.php',
+'wp-admin/edit-category-form.php',
+'wp-admin/edit-page-form.php',
+'wp-admin/edit-pages.php',
+'wp-admin/images/wp-logo.gif',
+'wp-admin/js/wp-gears.dev.js',
+'wp-admin/js/wp-gears.js',
+'wp-admin/options-misc.php',
+'wp-admin/page-new.php',
+'wp-admin/page.php',
+'wp-admin/rtl.css',
+'wp-admin/rtl.dev.css',
+'wp-admin/update-links.php',
+'wp-admin/wp-admin.css',
+'wp-admin/wp-admin.dev.css',
+'wp-includes/js/codepress',
+'wp-includes/js/jquery/autocomplete.dev.js',
+'wp-includes/js/jquery/interface.js',
+'wp-includes/js/jquery/autocomplete.js',
+'wp-includes/js/scriptaculous/prototype.js',
+'wp-includes/js/tinymce/wp-tinymce.js',
+'wp-content/themes/twentyten/searchform.php',
+'wp-admin/import',
+'wp-admin/images/ico-edit.png',
+'wp-admin/images/fav-top.png',
+'wp-admin/images/ico-close.png',
+'wp-admin/images/admin-header-footer.png',
+'wp-admin/images/screen-options-left.gif',
+'wp-admin/images/ico-add.png',
+'wp-admin/images/browse-happy.gif',
+'wp-admin/images/ico-viewpage.png',
 );
 
 /**
@@ -223,7 +274,7 @@ function update_core($from, $to) {
        $mysql_version  = $wpdb->db_version();
        $required_php_version = '4.3';
        $required_mysql_version = '4.1.2';
-       $wp_version = '2.9.2';
+       $wp_version = '3.0';
        $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
        $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
 
@@ -238,14 +289,22 @@ function update_core($from, $to) {
                return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) );
 
        // 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') ) {
+       apply_filters('update_feedback', __('Verifying the unpacked files&#8230;'));
+       $distro = '';
+       $roots = array( '/wordpress', '/wordpress-mu' );
+       foreach( $roots as $root ) {
+               if ( $wp_filesystem->exists($from . $root . '/wp-settings.php') && $wp_filesystem->exists($from . $root . '/wp-admin/admin.php') &&
+                       $wp_filesystem->exists($from . $root . '/wp-includes/functions.php') ) {
+                       $distro = $root;
+                       break;
+               }
+       }
+       if ( !$distro ) {
                $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'));
+       apply_filters('update_feedback', __('Installing the latest version&#8230;'));
 
        // Create maintenance file to signal that we are upgrading
        $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
@@ -254,7 +313,7 @@ function update_core($from, $to) {
        $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);
+       $result = copy_dir($from . $distro, $to);
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($maintenance_file);
                $wp_filesystem->delete($from, true);
@@ -270,7 +329,7 @@ function update_core($from, $to) {
        }
 
        // Upgrade DB with separate request
-       apply_filters('update_feedback', __('Upgrading database'));
+       apply_filters('update_feedback', __('Upgrading database&#8230;'));
        $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
        wp_remote_post($db_upgrade_url, array('timeout' => 60));
 
@@ -278,8 +337,8 @@ function update_core($from, $to) {
        $wp_filesystem->delete($from, true);
 
        // Force refresh of update information
-       if ( function_exists('delete_transient') )
-               delete_transient('update_core');
+       if ( function_exists('delete_site_transient') )
+               delete_site_transient('update_core');
        else
                delete_option('update_core');
 
index 0d0e6604d30adb23bf960ecf5954083d008ae8df..52e9ee1ac4d5ab54126fb422e2b8e17ec422fb98 100644 (file)
@@ -31,9 +31,9 @@ function get_preferred_from_update_core() {
  */
 function get_core_updates( $options = array() ) {
        $options = array_merge( array('available' => true, 'dismissed' => false ), $options );
-       $dismissed = get_option( 'dismissed_update_core' );
+       $dismissed = get_site_option( 'dismissed_update_core' );
        if ( !is_array( $dismissed ) ) $dismissed = array();
-       $from_api = get_transient( 'update_core' );
+       $from_api = get_site_transient( 'update_core' );
        if ( empty($from_api) )
                return false;
        if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return false;
@@ -57,21 +57,21 @@ function get_core_updates( $options = array() ) {
 }
 
 function dismiss_core_update( $update ) {
-       $dismissed = get_option( 'dismissed_update_core' );
+       $dismissed = get_site_option( 'dismissed_update_core' );
        $dismissed[ $update->current.'|'.$update->locale ] = true;
-       return update_option( 'dismissed_update_core', $dismissed );
+       return update_site_option( 'dismissed_update_core', $dismissed );
 }
 
 function undismiss_core_update( $version, $locale ) {
-       $dismissed = get_option( 'dismissed_update_core' );
+       $dismissed = get_site_option( 'dismissed_update_core' );
        $key = $version.'|'.$locale;
        if ( !isset( $dismissed[$key] ) ) return false;
        unset( $dismissed[$key] );
-       return update_option( 'dismissed_update_core', $dismissed );
+       return update_site_option( 'dismissed_update_core', $dismissed );
 }
 
 function find_core_update( $version, $locale ) {
-       $from_api = get_transient( 'update_core' );
+       $from_api = get_site_transient( 'update_core' );
        if ( !is_array( $from_api->updates ) ) return false;
        $updates = $from_api->updates;
        foreach($updates as $update) {
@@ -82,7 +82,10 @@ function find_core_update( $version, $locale ) {
 }
 
 function core_update_footer( $msg = '' ) {
-       if ( !current_user_can('manage_options') )
+       if ( is_multisite() && !current_user_can('update_core') )
+               return false;
+
+       if ( !current_user_can('update_core') )
                return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
 
        $cur = get_preferred_from_update_core();
@@ -101,10 +104,8 @@ function core_update_footer( $msg = '' ) {
        break;
 
        case 'upgrade' :
-               if ( current_user_can('manage_options') ) {
-                       return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
-                       break;
-               }
+               return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
+       break;
 
        case 'latest' :
        default :
@@ -115,6 +116,9 @@ function core_update_footer( $msg = '' ) {
 add_filter( 'update_footer', 'core_update_footer' );
 
 function update_nag() {
+       if ( is_multisite() && !current_user_can('update_core') )
+               return false;
+
        global $pagenow;
 
        if ( 'update-core.php' == $pagenow )
@@ -125,21 +129,24 @@ function update_nag() {
        if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
                return false;
 
-       if ( current_user_can('manage_options') )
-               $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
+       if ( current_user_can('update_core') )
+               $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
        else
-               $msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current );
+               $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
 
-       echo "<div id='update-nag'>$msg</div>";
+       echo "<div class='update-nag'>$msg</div>";
 }
 add_action( 'admin_notices', 'update_nag', 3 );
 
 // Called directly from dashboard
 function update_right_now_message() {
+       if ( is_multisite() && !current_user_can('update_core') )
+               return false;
+
        $cur = get_preferred_from_update_core();
 
        $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('update_core') )
                $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>";
@@ -148,7 +155,7 @@ function update_right_now_message() {
 function get_plugin_updates() {
        $all_plugins = get_plugins();
        $upgrade_plugins = array();
-       $current = get_transient( 'update_plugins' );
+       $current = get_site_transient( 'update_plugins' );
        foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
                if ( isset( $current->response[ $plugin_file ] ) ) {
                        $upgrade_plugins[ $plugin_file ] = (object) $plugin_data;
@@ -160,7 +167,10 @@ function get_plugin_updates() {
 }
 
 function wp_plugin_update_rows() {
-       $plugins = get_transient( 'update_plugins' );
+       if ( !current_user_can('update_plugins' ) )
+               return;
+
+       $plugins = get_site_transient( 'update_plugins' );
        if ( isset($plugins->response) && is_array($plugins->response) ) {
                $plugins = array_keys( $plugins->response );
                foreach( $plugins as $plugin_file ) {
@@ -171,7 +181,7 @@ function wp_plugin_update_rows() {
 add_action( 'admin_init', 'wp_plugin_update_rows' );
 
 function wp_plugin_update_row( $file, $plugin_data ) {
-       $current = get_transient( 'update_plugins' );
+       $current = get_site_transient( 'update_plugins' );
        if ( !isset( $current->response[ $file ] ) )
                return false;
 
@@ -196,7 +206,6 @@ function wp_plugin_update_row( $file, $plugin_data ) {
 }
 
 function wp_update_plugin($plugin, $feedback = '') {
-
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
@@ -207,7 +216,7 @@ function wp_update_plugin($plugin, $feedback = '') {
 
 function get_theme_updates() {
        $themes = get_themes();
-       $current = get_transient('update_themes');
+       $current = get_site_transient('update_themes');
        $update_themes = array();
 
        foreach ( $themes as $theme ) {
@@ -222,7 +231,6 @@ function get_theme_updates() {
 }
 
 function wp_update_theme($theme, $feedback = '') {
-
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
@@ -233,7 +241,6 @@ function wp_update_theme($theme, $feedback = '') {
 
 
 function wp_update_core($current, $feedback = '') {
-
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
@@ -248,12 +255,12 @@ function maintenance_nag() {
        if ( ! isset( $upgrading ) )
                return false;
 
-       if ( current_user_can('manage_options') )
+       if ( current_user_can('update_core') )
                $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>";
+       echo "<div class='update-nag'>$msg</div>";
 }
 add_action( 'admin_notices', 'maintenance_nag' );
 
index e70b9d9649fdfd8245a404b28836def081069bcd..1560f2c8d1ab2a6aba31678632d90cf77a204468 100644 (file)
@@ -31,11 +31,15 @@ if ( !function_exists('wp_install') ) :
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param null $deprecated Optional. Not used.
+ * @param string $user_password Optional. User's chosen password. Will default to a random password.
  * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
-function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
+function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
        global $wp_rewrite;
 
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.6' );
+
        wp_check_mysql_version();
        wp_cache_flush();
        make_db_current_silent();
@@ -57,14 +61,20 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
        // Create default user.  If the user already exists, the user tables are
        // being shared among blogs.  Just set the role in that case.
        $user_id = username_exists($user_name);
-       if ( !$user_id ) {
-               $random_password = wp_generate_password();
+       $user_password = trim($user_password);
+       $email_password = false;
+       if ( !$user_id && empty($user_password) ) {
+               $user_password = wp_generate_password();
                $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
-               $user_id = wp_create_user($user_name, $random_password, $user_email);
-               update_usermeta($user_id, 'default_password_nag', true);
+               $user_id = wp_create_user($user_name, $user_password, $user_email);
+               update_user_option($user_id, 'default_password_nag', true, true);
+               $email_password = true;
+       } else if ( !$user_id ) {
+               // Password has been provided
+               $message = '<em>'.__('Your chosen password.').'</em>';
+               $user_id = wp_create_user($user_name, $user_password, $user_email);
        } else {
-               $random_password = '';
-               $message =  __('User already exists.  Password inherited.');
+               $message =  __('User already exists. Password inherited.');
        }
 
        $user = new WP_User($user_id);
@@ -74,11 +84,11 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
 
        $wp_rewrite->flush_rules();
 
-       wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
+       wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
 
        wp_cache_flush();
 
-       return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message);
+       return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
 endif;
 
@@ -93,23 +103,47 @@ if ( !function_exists('wp_install_defaults') ) :
  * @param int $user_id User ID.
  */
 function wp_install_defaults($user_id) {
-       global $wpdb;
+       global $wpdb, $wp_rewrite, $current_site, $table_prefix;
 
        // Default category
        $cat_name = __('Uncategorized');
        /* translators: Default category slug */
        $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
 
-       $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
-       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
+       if ( global_terms_enabled() ) {
+               $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
+               if ( $cat_id == null ) {
+                       $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );
+                       $cat_id = $wpdb->insert_id;
+               }
+               update_option('default_category', $cat_id);
+       } else {
+               $cat_id = 1;
+       }
+
+       $wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
+       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
+       $cat_tt_id = $wpdb->insert_id;
 
        // Default link category
        $cat_name = __('Blogroll');
        /* translators: Default link category slug */
        $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
 
-       $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
-       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
+       if ( global_terms_enabled() ) {
+               $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
+               if ( $blogroll_id == null ) {
+                       $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );
+                       $blogroll_id = $wpdb->insert_id;
+               }
+               update_option('default_link_category', $blogroll_id);
+       } else {
+               $blogroll_id = 2;
+       }
+
+       $wpdb->insert( $wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
+       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
+       $blogroll_tt_id = $wpdb->insert_id;
 
        // Now drop in some default links
        $default_links = array();
@@ -119,7 +153,7 @@ function wp_install_defaults($user_id) {
                                                                'link_notes' => '');
 
        $default_links[] = array(       'link_url' => 'http://wordpress.org/development/',
-                                                               'link_name' => 'Development Blog',
+                                                               'link_name' => 'WordPress Blog',
                                                                'link_rss' => 'http://wordpress.org/development/feed/',
                                                                'link_notes' => '');
 
@@ -150,7 +184,7 @@ function wp_install_defaults($user_id) {
 
        foreach ( $default_links as $link ) {
                $wpdb->insert( $wpdb->links, $link);
-               $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 2, 'object_id' => $wpdb->insert_id) );
+               $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $blogroll_tt_id, 'object_id' => $wpdb->insert_id) );
        }
 
        // First post
@@ -158,15 +192,27 @@ function wp_install_defaults($user_id) {
        $now_gmt = gmdate('Y-m-d H:i:s');
        $first_post_guid = get_option('home') . '/?p=1';
 
+       if ( is_multisite() ) {
+               $first_post = get_site_option( 'first_post' );
+
+               if ( empty($first_post) )
+                       $first_post = stripslashes( __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ) );
+
+               $first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post );
+               $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
+       } else {
+               $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
+       }
+
        $wpdb->insert( $wpdb->posts, array(
                                                                'post_author' => $user_id,
                                                                'post_date' => $now,
                                                                'post_date_gmt' => $now_gmt,
-                                                               'post_content' => __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'),
+                                                               'post_content' => $first_post,
                                                                'post_excerpt' => '',
                                                                'post_title' => __('Hello world!'),
                                                                /* translators: Default post slug */
-                                                               'post_name' => _x('hello-world', 'Default post slug'),
+                                                               'post_name' => sanitize_title( _x('hello-world', 'Default post slug') ),
                                                                'post_modified' => $now,
                                                                'post_modified_gmt' => $now_gmt,
                                                                'guid' => $first_post_guid,
@@ -175,25 +221,37 @@ function wp_install_defaults($user_id) {
                                                                'pinged' => '',
                                                                'post_content_filtered' => ''
                                                                ));
-       $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 1, 'object_id' => 1) );
+       $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1) );
 
        // Default comment
+       $first_comment_author = __('Mr WordPress');
+       $first_comment_url = 'http://wordpress.org/';
+       $first_comment = __('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.');
+       if ( is_multisite() ) {
+               $first_comment_author = get_site_option( 'first_comment_author', $first_comment_author );
+               $first_comment_url = get_site_option( 'first_comment_url', network_home_url() );
+               $first_comment = get_site_option( 'first_comment', $first_comment );
+       }
        $wpdb->insert( $wpdb->comments, array(
                                                                'comment_post_ID' => 1,
-                                                               'comment_author' => __('Mr WordPress'),
+                                                               'comment_author' => $first_comment_author,
                                                                'comment_author_email' => '',
-                                                               'comment_author_url' => 'http://wordpress.org/',
+                                                               'comment_author_url' => $first_comment_url,
                                                                'comment_date' => $now,
                                                                'comment_date_gmt' => $now_gmt,
-                                                               'comment_content' => __('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.')
+                                                               'comment_content' => $first_comment
                                                                ));
+
        // First Page
+       $first_page = __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.');
+       if ( is_multisite() )
+               $first_page = get_site_option( 'first_page', $first_page );
        $first_post_guid = get_option('home') . '/?page_id=2';
        $wpdb->insert( $wpdb->posts, array(
                                                                'post_author' => $user_id,
                                                                'post_date' => $now,
                                                                'post_date_gmt' => $now_gmt,
-                                                               'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),
+                                                               'post_content' => $first_page,
                                                                'post_excerpt' => '',
                                                                'post_title' => __('About'),
                                                                /* translators: Default page slug */
@@ -206,6 +264,33 @@ function wp_install_defaults($user_id) {
                                                                'pinged' => '',
                                                                'post_content_filtered' => ''
                                                                ));
+       $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) );
+
+       // Setup default widgets for default theme.
+       update_option( 'widget_search', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) );
+       update_option( 'widget_recent-posts', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
+       update_option( 'widget_recent-comments', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
+       update_option( 'widget_archives', array ( 2 => array ( 'title' => '', 'count' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) );
+       update_option( 'widget_categories', array ( 2 => array ( 'title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) );
+       update_option( 'widget_meta', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) );
+       update_option( 'sidebars_widgets', array ( 'wp_inactive_widgets' => array ( ), 'primary-widget-area' => array ( 0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2', ), 'secondary-widget-area' => array ( ), 'first-footer-widget-area' => array ( ), 'second-footer-widget-area' => array ( ), 'third-footer-widget-area' => array ( ), 'fourth-footer-widget-area' => array ( ), 'array_version' => 3 ) );
+
+       if ( is_multisite() ) {
+               // Flush rules to pick up the new page.
+               $wp_rewrite->init();
+               $wp_rewrite->flush_rules();
+
+               $user = new WP_User($user_id);
+               $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
+
+               // Remove all perms except for the login user.
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') );
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
+
+               // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
+               if ( !is_super_admin( $user_id ) && $user_id != 1 )
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );
+       }
 }
 endif;
 
@@ -226,7 +311,7 @@ function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
        $user = new WP_User($user_id);
        $email = $user->user_email;
        $name = $user->user_login;
-       $message = sprintf(__("Your new WordPress blog has been successfully set up at:
+       $message = sprintf(__("Your new WordPress site has been successfully set up at:
 
 %1\$s
 
@@ -235,13 +320,13 @@ You can log in to the administrator account with the following information:
 Username: %2\$s
 Password: %3\$s
 
-We hope you enjoy your new blog. Thanks!
+We hope you enjoy your new site. Thanks!
 
 --The WordPress Team
 http://wordpress.org/
 "), $blog_url, $name, $password);
 
-       @wp_mail($email, __('New WordPress Blog'), $message);
+       @wp_mail($email, __('New WordPress Site'), $message);
 }
 endif;
 
@@ -256,7 +341,7 @@ if ( !function_exists('wp_upgrade') ) :
  * @return null
  */
 function wp_upgrade() {
-       global $wp_current_db_version, $wp_db_version;
+       global $wp_current_db_version, $wp_db_version, $wpdb;
 
        $wp_current_db_version = __get_option('db_version');
 
@@ -264,7 +349,7 @@ function wp_upgrade() {
        if ( $wp_db_version == $wp_current_db_version )
                return;
 
-       if( ! is_blog_installed() )
+       if ( ! is_blog_installed() )
                return;
 
        wp_check_mysql_version();
@@ -272,7 +357,16 @@ function wp_upgrade() {
        pre_schema_upgrade();
        make_db_current_silent();
        upgrade_all();
+       if ( is_multisite() && is_main_site() )
+               upgrade_network();
        wp_cache_flush();
+
+       if ( is_multisite() ) {
+               if ( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) )
+                       $wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'" );
+               else
+                       $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" );
+       }
 }
 endif;
 
@@ -331,9 +425,6 @@ function upgrade_all() {
        if ( $wp_current_db_version < 7499 )
                upgrade_250();
 
-       if ( $wp_current_db_version < 7796 )
-               upgrade_251();
-
        if ( $wp_current_db_version < 7935 )
                upgrade_252();
 
@@ -349,6 +440,9 @@ function upgrade_all() {
        if ( $wp_current_db_version < 11958 )
                upgrade_290();
 
+       if ( $wp_current_db_version < 15260 )
+               upgrade_300();
+
        maybe_disable_automattic_widgets();
 
        update_option( 'db_version', $wp_db_version );
@@ -470,7 +564,7 @@ function upgrade_110() {
        // Check if we already set the GMT fields (if we did, then
        // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
        // <michel_v> I just slapped myself silly for not thinking about it earlier
-       $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
+       $got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00');
 
        if (!$got_gmt_fields) {
 
@@ -581,23 +675,23 @@ function upgrade_160() {
        $users = $wpdb->get_results("SELECT * FROM $wpdb->users");
        foreach ( $users as $user ) :
                if ( !empty( $user->user_firstname ) )
-                       update_usermeta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
+                       update_user_meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
                if ( !empty( $user->user_lastname ) )
-                       update_usermeta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
+                       update_user_meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
                if ( !empty( $user->user_nickname ) )
-                       update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
+                       update_user_meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
                if ( !empty( $user->user_level ) )
-                       update_usermeta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
+                       update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
                if ( !empty( $user->user_icq ) )
-                       update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
+                       update_user_meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
                if ( !empty( $user->user_aim ) )
-                       update_usermeta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
+                       update_user_meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
                if ( !empty( $user->user_msn ) )
-                       update_usermeta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
+                       update_user_meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
                if ( !empty( $user->user_yim ) )
-                       update_usermeta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
+                       update_user_meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
                if ( !empty( $user->user_description ) )
-                       update_usermeta( $user->ID, 'description', $wpdb->escape($user->user_description) );
+                       update_user_meta( $user->ID, 'description', $wpdb->escape($user->user_description) );
 
                if ( isset( $user->user_idmode ) ):
                        $idmode = $user->user_idmode;
@@ -612,11 +706,11 @@ function upgrade_160() {
                endif;
 
                // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
-               $caps = get_usermeta( $user->ID, $wpdb->prefix . 'capabilities');
+               $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities');
                if ( empty($caps) || defined('RESET_CAPS') ) {
-                       $level = get_usermeta($user->ID, $wpdb->prefix . 'user_level');
+                       $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level', true);
                        $role = translate_level_to_role($level);
-                       update_usermeta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
+                       update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
                }
 
        endforeach;
@@ -628,7 +722,7 @@ function upgrade_160() {
 
        // populate comment_count field of posts table
        $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
-       if( is_array( $comments ) )
+       if ( is_array( $comments ) )
                foreach ($comments as $comment)
                        $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) );
 
@@ -918,18 +1012,6 @@ function upgrade_250() {
 
 }
 
-/**
- * Execute changes made in WordPress 2.5.1.
- *
- * @since 2.5.1
- */
-function upgrade_251() {
-       global $wp_current_db_version;
-
-       // Make the secret longer
-       update_option('secret', wp_generate_password(64));
-}
-
 /**
  * Execute changes made in WordPress 2.5.2.
  *
@@ -980,10 +1062,25 @@ function upgrade_270() {
  * @since 2.8.0
  */
 function upgrade_280() {
-       global $wp_current_db_version;
+       global $wp_current_db_version, $wpdb;
 
        if ( $wp_current_db_version < 10360 )
                populate_roles_280();
+       if ( is_multisite() ) {
+               $start = 0;
+               while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) {
+                       foreach( $rows as $row ) {
+                               $value = $row->option_value;
+                               if ( !@unserialize( $value ) )
+                                       $value = stripslashes( $value );
+                               if ( $value !== $row->option_value ) {
+                                       update_option( $row->option_name, $value );
+                               }
+                       }
+                       $start += 20;
+               }
+               refresh_blog_details( $wpdb->blogid );
+       }
 }
 
 /**
@@ -1003,6 +1100,83 @@ function upgrade_290() {
        }
 }
 
+/**
+ * Execute changes made in WordPress 3.0.
+ *
+ * @since 3.0.0
+ */
+function upgrade_300() {
+       global $wp_current_db_version, $wpdb;
+
+       if ( $wp_current_db_version < 15093 )
+               populate_roles_300();
+
+       if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
+               add_site_option( 'siteurl', '' );
+
+       // 3.0-alpha nav menu postmeta changes. can be removed before release. // r13802
+       if ( $wp_current_db_version >= 13226 && $wp_current_db_version < 13974 )
+               $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key IN( 'menu_type', 'object_id', 'menu_new_window', 'menu_link', '_menu_item_append', 'menu_item_append', 'menu_item_type', 'menu_item_object_id', 'menu_item_target', 'menu_item_classes', 'menu_item_xfn', 'menu_item_url' )" );
+
+       // 3.0-beta1 remove_user primitive->meta cap. can be removed before release. r13956
+       if ( $wp_current_db_version >= 12751 && $wp_current_db_version < 13974 ) {
+               $role =& get_role( 'administrator' );
+               if ( ! empty( $role ) )
+                       $role->remove_cap( 'remove_user' );
+       }
+
+       // 3.0-beta1 nav menu postmeta changes. can be removed before release. r13974
+       if ( $wp_current_db_version >= 13802 && $wp_current_db_version < 13974 )
+               $wpdb->update( $wpdb->postmeta, array( 'meta_value' => '' ), array( 'meta_key' => '_menu_item_target', 'meta_value' => '_self' ) );
+
+       // 3.0 screen options key name changes.
+       if ( !is_multisite() || is_main_site() ) {
+               $prefix = like_escape($wpdb->base_prefix);
+               $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE '{$prefix}%meta-box-hidden%' OR meta_key LIKE '{$prefix}%closedpostboxes%' OR meta_key LIKE '{$prefix}%manage-%-columns-hidden%' OR meta_key LIKE '{$prefix}%meta-box-order%' OR meta_key LIKE '{$prefix}%metaboxorder%' OR meta_key LIKE '{$prefix}%screen_layout%'
+                                        OR meta_key = 'manageedittagscolumnshidden' OR meta_key='managecategoriescolumnshidden' OR meta_key = 'manageedit-tagscolumnshidden' OR meta_key = 'manageeditcolumnshidden' OR meta_key = 'categories_per_page' OR meta_key = 'edit_tags_per_page'" );
+       }
+
+}
+
+/**
+ * Execute network level changes
+ *
+ * @since 3.0.0
+ */
+function upgrade_network() {
+       global $wp_current_db_version, $wpdb;
+       // 2.8
+       if ( $wp_current_db_version < 11549 ) {
+               $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
+               $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
+               if ( $wpmu_sitewide_plugins ) {
+                       if ( !$active_sitewide_plugins )
+                               $sitewide_plugins = (array) $wpmu_sitewide_plugins;
+                       else
+                               $sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins );
+
+                       update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
+               }
+               delete_site_option( 'wpmu_sitewide_plugins' );
+               delete_site_option( 'deactivated_sitewide_plugins' );
+
+               $start = 0;
+               while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
+                       foreach( $rows as $row ) {
+                               $value = $row->meta_value;
+                               if ( !@unserialize( $value ) )
+                                       $value = stripslashes( $value );
+                               if ( $value !== $row->meta_value ) {
+                                       update_site_option( $row->meta_key, $value );
+                               }
+                       }
+                       $start += 20;
+               }
+       }
+       // 3.0
+       if ( $wp_current_db_version < 13576 )
+               update_site_option( 'global_terms_enabled', '1' );
+}
 
 // The functions we use to actually do stuff
 
@@ -1132,11 +1306,11 @@ function __get_option($setting) {
        global $wpdb;
 
        if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
-               return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
+               return preg_replace( '|/+$|', '', WP_HOME );
        }
 
        if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
-               return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
+               return preg_replace( '|/+$|', '', WP_SITEURL );
        }
 
        $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );
@@ -1196,9 +1370,9 @@ function dbDelta($queries, $execute = true) {
        global $wpdb;
 
        // Separate individual queries into an array
-       if( !is_array($queries) ) {
+       if ( !is_array($queries) ) {
                $queries = explode( ';', $queries );
-               if('' == $queries[count($queries) - 1]) array_pop($queries);
+               if ('' == $queries[count($queries) - 1]) array_pop($queries);
        }
 
        $cqueries = array(); // Creation Queries
@@ -1207,33 +1381,28 @@ function dbDelta($queries, $execute = true) {
 
        // Create a tablename index for an array ($cqueries) of queries
        foreach($queries as $qry) {
-               if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
+               if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
                        $cqueries[trim( strtolower($matches[1]), '`' )] = $qry;
                        $for_update[$matches[1]] = 'Created table '.$matches[1];
-               }
-               else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
+               } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
                        array_unshift($cqueries, $qry);
-               }
-               else if(preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
+               } else if (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
                        $iqueries[] = $qry;
-               }
-               else if(preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
+               } else if (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
                        $iqueries[] = $qry;
-               }
-               else {
+               } else {
                        // Unrecognized query type
                }
        }
 
        // Check to see which tables and fields exist
-       if($tables = $wpdb->get_col('SHOW TABLES;')) {
+       if ($tables = $wpdb->get_col('SHOW TABLES;')) {
                // For every table in the database
-               foreach($tables as $table) {
+               foreach ($tables as $table) {
                        // If a table query exists for the database table...
-                       if( array_key_exists(strtolower($table), $cqueries) ) {
+                       if ( array_key_exists(strtolower($table), $cqueries) ) {
                                // Clear the field and index arrays
-                               unset($cfields);
-                               unset($indices);
+                               $cfields = $indices = array();
                                // Get all of the field names in the query from between the parens
                                preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2);
                                $qryline = trim($match2[1]);
@@ -1244,15 +1413,14 @@ function dbDelta($queries, $execute = true) {
                                //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
 
                                // For every field line specified in the query
-                               foreach($flds as $fld) {
+                               foreach ($flds as $fld) {
                                        // Extract the field name
                                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
                                        $fieldname = trim( $fvals[1], '`' );
 
                                        // Verify the found field name
                                        $validfield = true;
-                                       switch(strtolower($fieldname))
-                                       {
+                                       switch (strtolower($fieldname)) {
                                        case '':
                                        case 'primary':
                                        case 'index':
@@ -1266,7 +1434,7 @@ function dbDelta($queries, $execute = true) {
                                        $fld = trim($fld);
 
                                        // If it's a valid field, add it to the field array
-                                       if($validfield) {
+                                       if ($validfield) {
                                                $cfields[strtolower($fieldname)] = trim($fld, ", \n");
                                        }
                                }
@@ -1275,15 +1443,15 @@ function dbDelta($queries, $execute = true) {
                                $tablefields = $wpdb->get_results("DESCRIBE {$table};");
 
                                // For every field in the table
-                               foreach($tablefields as $tablefield) {
+                               foreach ($tablefields as $tablefield) {
                                        // If the table field exists in the field array...
-                                       if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
+                                       if (array_key_exists(strtolower($tablefield->Field), $cfields)) {
                                                // Get the field type from the query
                                                preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
                                                $fieldtype = $matches[1];
 
                                                // Is actual field type different from the field type in query?
-                                               if($tablefield->Type != $fieldtype) {
+                                               if ($tablefield->Type != $fieldtype) {
                                                        // Add a query to change the column type
                                                        $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
                                                        $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
@@ -1291,10 +1459,9 @@ function dbDelta($queries, $execute = true) {
 
                                                // Get the default value from the array
                                                        //echo "{$cfields[strtolower($tablefield->Field)]}<br>";
-                                               if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
+                                               if (preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
                                                        $default_value = $matches[1];
-                                                       if($tablefield->Default != $default_value)
-                                                       {
+                                                       if ($tablefield->Default != $default_value) {
                                                                // Add a query to change the column's default value
                                                                $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN {$tablefield->Field} SET DEFAULT '{$default_value}'";
                                                                $for_update[$table.'.'.$tablefield->Field] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}";
@@ -1303,14 +1470,13 @@ function dbDelta($queries, $execute = true) {
 
                                                // Remove the field from the array (so it's not added)
                                                unset($cfields[strtolower($tablefield->Field)]);
-                                       }
-                                       else {
+                                       } else {
                                                // This field exists in the table, but not in the creation queries?
                                        }
                                }
 
                                // For every remaining field specified for the table
-                               foreach($cfields as $fieldname => $fielddef) {
+                               foreach ($cfields as $fieldname => $fielddef) {
                                        // Push a query line into $cqueries that adds the field to that table
                                        $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
                                        $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
@@ -1320,12 +1486,12 @@ function dbDelta($queries, $execute = true) {
                                // Fetch the table index structure from the database
                                $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
 
-                               if($tableindices) {
+                               if ($tableindices) {
                                        // Clear the index array
                                        unset($index_ary);
 
                                        // For every index in the table
-                                       foreach($tableindices as $tableindex) {
+                                       foreach ($tableindices as $tableindex) {
                                                // Add the index to the index data array
                                                $keyname = $tableindex->Key_name;
                                                $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part);
@@ -1333,32 +1499,31 @@ function dbDelta($queries, $execute = true) {
                                        }
 
                                        // For each actual index in the index array
-                                       foreach($index_ary as $index_name => $index_data) {
+                                       foreach ($index_ary as $index_name => $index_data) {
                                                // Build a create string to compare to the query
                                                $index_string = '';
-                                               if($index_name == 'PRIMARY') {
+                                               if ($index_name == 'PRIMARY') {
                                                        $index_string .= 'PRIMARY ';
-                                               }
-                                               else if($index_data['unique']) {
+                                               } else if($index_data['unique']) {
                                                        $index_string .= 'UNIQUE ';
                                                }
                                                $index_string .= 'KEY ';
-                                               if($index_name != 'PRIMARY') {
+                                               if ($index_name != 'PRIMARY') {
                                                        $index_string .= $index_name;
                                                }
                                                $index_columns = '';
                                                // For each column in the index
-                                               foreach($index_data['columns'] as $column_data) {
-                                                       if($index_columns != '') $index_columns .= ',';
+                                               foreach ($index_data['columns'] as $column_data) {
+                                                       if ($index_columns != '') $index_columns .= ',';
                                                        // Add the field to the column list string
                                                        $index_columns .= $column_data['fieldname'];
-                                                       if($column_data['subpart'] != '') {
+                                                       if ($column_data['subpart'] != '') {
                                                                $index_columns .= '('.$column_data['subpart'].')';
                                                        }
                                                }
                                                // Add the column list to the index create string
                                                $index_string .= ' ('.$index_columns.')';
-                                               if(!(($aindex = array_search($index_string, $indices)) === false)) {
+                                               if (!(($aindex = array_search($index_string, $indices)) === false)) {
                                                        unset($indices[$aindex]);
                                                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
                                                }
@@ -1383,8 +1548,8 @@ function dbDelta($queries, $execute = true) {
        }
 
        $allqueries = array_merge($cqueries, $iqueries);
-       if($execute) {
-               foreach($allqueries as $query) {
+       if ($execute) {
+               foreach ($allqueries as $query) {
                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
                        $wpdb->query($query);
                }
@@ -1454,7 +1619,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
                if ($oldfile == 'index.php') { // Check to make sure it's not a new index
                        $index = implode('', file("$oldpath/$oldfile"));
                        if (strpos($index, 'WP_USE_THEMES') !== false) {
-                               if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
+                               if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))
                                        return false;
                                continue; // Don't copy anything
                                }
@@ -1514,12 +1679,12 @@ function make_site_theme_from_oldschool($theme_name, $template) {
  */
 function make_site_theme_from_default($theme_name, $template) {
        $site_dir = WP_CONTENT_DIR . "/themes/$template";
-       $default_dir = WP_CONTENT_DIR . '/themes/default';
+       $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;
 
        // Copy files from the default theme to the site theme.
        //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
 
-       $theme_dir = @ opendir("$default_dir");
+       $theme_dir = @ opendir($default_dir);
        if ($theme_dir) {
                while(($theme_file = readdir( $theme_dir )) !== false) {
                        if (is_dir("$default_dir/$theme_file"))
@@ -1610,7 +1775,7 @@ function make_site_theme() {
 
        // Make the new site theme active.
        $current_template = __get_option('template');
-       if ($current_template == 'default') {
+       if ($current_template == WP_DEFAULT_THEME) {
                update_option('template', $template);
                update_option('stylesheet', $template);
        }
@@ -1699,4 +1864,124 @@ function pre_schema_upgrade() {
 
 }
 
+/**
+ * Install Network.
+ *
+ * @since 3.0.0
+ *
+ */
+if ( !function_exists( 'install_network' ) ) :
+function install_network() {
+       global $wpdb, $charset_collate;
+       $ms_queries = "
+CREATE TABLE $wpdb->users (
+  ID bigint(20) unsigned NOT NULL auto_increment,
+  user_login varchar(60) NOT NULL default '',
+  user_pass varchar(64) NOT NULL default '',
+  user_nicename varchar(50) NOT NULL default '',
+  user_email varchar(100) NOT NULL default '',
+  user_url varchar(100) NOT NULL default '',
+  user_registered datetime NOT NULL default '0000-00-00 00:00:00',
+  user_activation_key varchar(60) NOT NULL default '',
+  user_status int(11) NOT NULL default '0',
+  display_name varchar(250) NOT NULL default '',
+  spam tinyint(2) NOT NULL default '0',
+  deleted tinyint(2) NOT NULL default '0',
+  PRIMARY KEY  (ID),
+  KEY user_login_key (user_login),
+  KEY user_nicename (user_nicename)
+) $charset_collate;
+CREATE TABLE $wpdb->blogs (
+  blog_id bigint(20) NOT NULL auto_increment,
+  site_id bigint(20) NOT NULL default '0',
+  domain varchar(200) NOT NULL default '',
+  path varchar(100) NOT NULL default '',
+  registered datetime NOT NULL default '0000-00-00 00:00:00',
+  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+  public tinyint(2) NOT NULL default '1',
+  archived enum('0','1') NOT NULL default '0',
+  mature tinyint(2) NOT NULL default '0',
+  spam tinyint(2) NOT NULL default '0',
+  deleted tinyint(2) NOT NULL default '0',
+  lang_id int(11) NOT NULL default '0',
+  PRIMARY KEY  (blog_id),
+  KEY domain (domain(50),path(5)),
+  KEY lang_id (lang_id)
+) $charset_collate;
+CREATE TABLE $wpdb->blog_versions (
+  blog_id bigint(20) NOT NULL default '0',
+  db_version varchar(20) NOT NULL default '',
+  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (blog_id),
+  KEY db_version (db_version)
+) $charset_collate;
+CREATE TABLE $wpdb->registration_log (
+  ID bigint(20) NOT NULL auto_increment,
+  email varchar(255) NOT NULL default '',
+  IP varchar(30) NOT NULL default '',
+  blog_id bigint(20) NOT NULL default '0',
+  date_registered datetime NOT NULL default '0000-00-00 00:00:00',
+  PRIMARY KEY  (ID),
+  KEY IP (IP)
+) $charset_collate;
+CREATE TABLE $wpdb->site (
+  id bigint(20) NOT NULL auto_increment,
+  domain varchar(200) NOT NULL default '',
+  path varchar(100) NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY domain (domain,path)
+) $charset_collate;
+CREATE TABLE $wpdb->sitemeta (
+  meta_id bigint(20) NOT NULL auto_increment,
+  site_id bigint(20) NOT NULL default '0',
+  meta_key varchar(255) default NULL,
+  meta_value longtext,
+  PRIMARY KEY  (meta_id),
+  KEY meta_key (meta_key),
+  KEY site_id (site_id)
+) $charset_collate;
+CREATE TABLE $wpdb->signups (
+  domain varchar(200) NOT NULL default '',
+  path varchar(100) NOT NULL default '',
+  title longtext NOT NULL,
+  user_login varchar(60) NOT NULL default '',
+  user_email varchar(100) NOT NULL default '',
+  registered datetime NOT NULL default '0000-00-00 00:00:00',
+  activated datetime NOT NULL default '0000-00-00 00:00:00',
+  active tinyint(1) NOT NULL default '0',
+  activation_key varchar(50) NOT NULL default '',
+  meta longtext,
+  KEY activation_key (activation_key),
+  KEY domain (domain)
+) $charset_collate;
+";
+// now create tables
+       dbDelta( $ms_queries );
+}
+endif;
+
+/**
+ * Install global terms.
+ *
+ * @since 3.0.0
+ *
+ */
+if ( !function_exists( 'install_global_terms' ) ) :
+function install_global_terms() {
+       global $wpdb, $charset_collate;
+       $ms_queries = "
+CREATE TABLE $wpdb->sitecategories (
+  cat_ID bigint(20) NOT NULL auto_increment,
+  cat_name varchar(55) NOT NULL default '',
+  category_nicename varchar(200) NOT NULL default '',
+  last_updated timestamp NOT NULL,
+  PRIMARY KEY  (cat_ID),
+  KEY category_nicename (category_nicename),
+  KEY last_updated (last_updated)
+) $charset_collate;
+";
+// now create tables
+       dbDelta( $ms_queries );
+}
+endif;
 ?>
index f8c21e34b3ba7163cb7ae36be11d089754caaca4..7a72297534fcb6b09009bf73182dc8e9f6731ee7 100644 (file)
@@ -30,7 +30,7 @@ function add_user() {
                        if ( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
                                // If the new role isn't editable by the logged-in user die with error
                                $editable_roles = get_editable_roles();
-                               if ( !$editable_roles[$new_role] )
+                               if ( empty( $editable_roles[$new_role] ) )
                                        wp_die(__('You can&#8217;t give users that role.'));
 
                                $user = new WP_User( $user_id );
@@ -76,13 +76,15 @@ function edit_user( $user_id = 0 ) {
 
        if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
                $new_role = sanitize_text_field( $_POST['role'] );
+               $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
                // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
-               if( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ))
+               // Multisite super admins can freely edit their blog roles -- they possess all caps.
+               if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != $current_user->id || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
                        $user->role = $new_role;
 
                // If the new role isn't editable by the logged-in user die with error
                $editable_roles = get_editable_roles();
-               if ( !$editable_roles[$new_role] )
+               if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) )
                        wp_die(__('You can&#8217;t give users that role.'));
        }
 
@@ -92,7 +94,7 @@ function edit_user( $user_id = 0 ) {
                if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) {
                        $user->user_url = '';
                } else {
-                       $user->user_url = sanitize_url( $_POST['url'] );
+                       $user->user_url = esc_url_raw( $_POST['url'] );
                        $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
                }
        }
@@ -156,8 +158,8 @@ function edit_user( $user_id = 0 ) {
        if ( !empty( $pass1 ) )
                $user->user_pass = $pass1;
 
-       if ( !$update && !validate_username( $user->user_login ) )
-               $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
+       if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) )
+               $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ));
 
        if ( !$update && username_exists( $user->user_login ) )
                $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
@@ -197,7 +199,11 @@ function edit_user( $user_id = 0 ) {
  */
 function get_author_user_ids() {
        global $wpdb;
-       $level_key = $wpdb->prefix . 'user_level';
+       if ( !is_multisite() )
+               $level_key = $wpdb->get_blog_prefix() . 'user_level';
+       else
+               $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
 }
 
@@ -216,7 +222,7 @@ function get_editable_authors( $user_id ) {
 
        $editable = get_editable_user_ids( $user_id );
 
-       if( !$editable ) {
+       if ( !$editable ) {
                return false;
        } else {
                $editable = join(',', $editable);
@@ -241,15 +247,19 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
        global $wpdb;
 
        $user = new WP_User( $user_id );
+       $post_type_obj = get_post_type_object($post_type);
 
-       if ( ! $user->has_cap("edit_others_{$post_type}s") ) {
-               if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false )
+       if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
+               if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
                        return array($user->id);
                else
                        return array();
        }
 
-       $level_key = $wpdb->prefix . 'user_level';
+       if ( !is_multisite() )
+               $level_key = $wpdb->get_blog_prefix() . 'user_level';
+       else
+               $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
 
        $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
        if ( $exclude_zeros )
@@ -294,7 +304,11 @@ function get_editable_roles() {
  */
 function get_nonauthor_user_ids() {
        global $wpdb;
-       $level_key = $wpdb->prefix . 'user_level';
+
+       if ( !is_multisite() )
+               $level_key = $wpdb->get_blog_prefix() . 'user_level';
+       else
+               $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
 
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
 }
@@ -320,7 +334,7 @@ function get_others_unpublished_posts($user_id, $type='any') {
 
        $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
 
-       if( !$editable ) {
+       if ( !$editable ) {
                $other_unpubs = '';
        } else {
                $editable = join(',', $editable);
@@ -408,20 +422,19 @@ function get_users_drafts( $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') {
+function wp_delete_user( $id, $reassign = 'novalue' ) {
        global $wpdb;
 
        $id = (int) $id;
-       $user = new WP_User($id);
 
        // allow for transaction statement
        do_action('delete_user', $id);
 
-       if ($reassign == 'novalue') {
+       if ( 'novalue' === $reassign || null === $reassign ) {
                $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
 
-               if ($post_ids) {
-                       foreach ($post_ids as $post_id)
+               if ( $post_ids ) {
+                       foreach ( $post_ids as $post_id )
                                wp_delete_post($post_id);
                }
 
@@ -432,22 +445,22 @@ function wp_delete_user($id, $reassign = 'novalue') {
                        foreach ( $link_ids as $link_id )
                                wp_delete_link($link_id);
                }
-
        } else {
                $reassign = (int) $reassign;
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $id) );
+               $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) );
+               $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
        }
 
-       // FINALLY, delete user
-
-       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
-       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
+       clean_user_cache($id);
 
-       wp_cache_delete($id, 'users');
-       wp_cache_delete($user->user_login, 'userlogins');
-       wp_cache_delete($user->user_email, 'useremail');
-       wp_cache_delete($user->user_nicename, 'userslugs');
+       // FINALLY, delete user
+       if ( !is_multisite() ) {
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
+       } else {
+               $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+               $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'");
+       }
 
        // allow for commit transaction
        do_action('deleted_user', $id);
@@ -474,7 +487,6 @@ if ( !class_exists('WP_User_Search') ) :
  * WordPress User Search class.
  *
  * @since unknown
- * @author Mark Jaquith
  */
 class WP_User_Search {
 
@@ -555,27 +567,36 @@ class WP_User_Search {
         *
         * @since unknown
         * @access private
-        * @var unknown_type
+        * @var string
         */
        var $query_limit;
 
        /**
         * {@internal Missing Description}}
         *
-        * @since unknown
+        * @since 3.0.0
         * @access private
-        * @var unknown_type
+        * @var string
         */
-       var $query_sort;
+       var $query_orderby;
 
        /**
         * {@internal Missing Description}}
         *
-        * @since unknown
+        * @since 3.0.0
         * @access private
-        * @var unknown_type
+        * @var string
+        */
+       var $query_from;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since 3.0.0
+        * @access private
+        * @var string
         */
-       var $query_from_where;
+       var $query_where;
 
        /**
         * {@internal Missing Description}}
@@ -646,8 +667,10 @@ class WP_User_Search {
        function prepare_query() {
                global $wpdb;
                $this->first_user = ($this->page - 1) * $this->users_per_page;
+
                $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
-               $this->query_sort = ' ORDER BY user_login';
+               $this->query_orderby = ' ORDER BY user_login';
+
                $search_sql = '';
                if ( $this->search_term ) {
                        $searches = array();
@@ -658,13 +681,19 @@ class WP_User_Search {
                        $search_sql .= ')';
                }
 
-               $this->query_from_where = "FROM $wpdb->users";
-               if ( $this->role )
-                       $this->query_from_where .= $wpdb->prepare(" INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
-               else
-                       $this->query_from_where .= " WHERE 1=1";
-               $this->query_from_where .= " $search_sql";
+               $this->query_from = " FROM $wpdb->users";
+               $this->query_where = " WHERE 1=1 $search_sql";
+
+               if ( $this->role ) {
+                       $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
+                       $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
+               } elseif ( is_multisite() ) {
+                       $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
+                       $this->query_from .= ", $wpdb->usermeta";
+                       $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
+               }
 
+               do_action_ref_array( 'pre_user_search', array( &$this ) );
        }
 
        /**
@@ -677,10 +706,11 @@ class WP_User_Search {
         */
        function query() {
                global $wpdb;
-               $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit);
+
+               $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
 
                if ( $this->results )
-                       $this->total_users_for_query = $wpdb->get_var('SELECT COUNT(ID) ' . $this->query_from_where); // no limit
+                       $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
                else
                        $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
        }
@@ -792,39 +822,41 @@ endif;
 add_action('admin_init', 'default_password_nag_handler');
 function default_password_nag_handler($errors = false) {
        global $user_ID;
-       if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
+       if ( ! get_user_option('default_password_nag') ) //Short circuit it.
                return;
 
        //get_user_setting = JS saved UI setting. else no-js-falback code.
        if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {
                delete_user_setting('default_password_nag');
-               update_usermeta($user_ID, 'default_password_nag', false);
+               update_user_option($user_ID, 'default_password_nag', false, true);
        }
 }
 
 add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
 function default_password_nag_edit_user($user_ID, $old_data) {
-       global $user_ID;
-       if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
+       if ( ! get_user_option('default_password_nag', $user_ID) ) //Short circuit it.
                return;
 
        $new_data = get_userdata($user_ID);
 
        if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed.
-               delete_user_setting('default_password_nag');
-               update_usermeta($user_ID, 'default_password_nag', false);
+               delete_user_setting('default_password_nag', $user_ID);
+               update_user_option($user_ID, 'default_password_nag', false, true);
        }
 }
 
 add_action('admin_notices', 'default_password_nag');
 function default_password_nag() {
-       global $user_ID;
-       if ( ! get_usermeta($user_ID, 'default_password_nag') )
+       if ( ! get_user_option('default_password_nag') ) //Short circuit it.
                return;
 
-       echo '<div class="error default-password-nag"><p>';
-       printf(__("Notice: you're using the auto-generated password for your account. Would you like to change it to something you'll remember easier?<br />
-                         <a href='%s'>Yes, Take me to my profile page</a> | <a href='%s' id='default-password-nag-no'>No Thanks, Do not remind me again.</a>"), admin_url('profile.php') . '#password', '?default_password_nag=0');
+       echo '<div class="error default-password-nag">';
+       echo '<p>';
+       echo '<strong>' . __('Notice:') . '</strong> ';
+       _e('You&rsquo;re using the auto-generated password for your account. Would you like to change it to something you&rsquo;ll remember easier?');
+       echo '</p><p>';
+       printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', admin_url('profile.php') . '#password' );
+       printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' );
        echo '</p></div>';
 }
 
index 47dfec524064188035c55640526ecf762e96c3b3..aef0dbafaea840a78eaff81902ecbe50a2ff78b5 100644 (file)
@@ -68,7 +68,7 @@ function wp_list_widget_controls( $sidebar ) {
 
        if ( !empty( $description ) ) {
                echo "<div class='sidebar-description'>\n";
-               echo "\t<p class='description'>$description</p>"; 
+               echo "\t<p class='description'>$description</p>";
                echo "</div>\n";
        }
 
@@ -202,7 +202,7 @@ function wp_widget_control( $sidebar_args ) {
                <a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
                </div>
                <div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
-               <img src="images/wpspin_light.gif" class="ajax-feedback " title="" alt="" />
+               <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback " title="" alt="" />
                <input type="submit" name="savewidget" class="button-primary widget-control-save" value="<?php esc_attr_e('Save'); ?>" />
                </div>
                <br class="clear" />
index 3218970733c167fa6c7a49cd6bcd794a1d85da0b..22df0d67dc1f78917b91fdc3eb45d5e94fc03f88 100644 (file)
@@ -7,15 +7,13 @@
  */
 
 /** 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'));
+@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
+send_nosniff_header();
 
 switch ( $_GET['jax'] ) {
 
@@ -35,6 +33,10 @@ case 'dashboard_plugins' :
        wp_dashboard_plugins_output();
        break;
 
+case 'dashboard_quick_press' :
+       wp_dashboard_quick_press_output();
+       break;
+
 }
 
 ?>
\ No newline at end of file
index a88b1bc3685ceff3f1794599e14994511fe4be3d..789835c99cfe1642a69b6c637047cb7c2f6ba2fc 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** Load WordPress Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 /** Load WordPress dashboard API */
 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
@@ -23,7 +23,26 @@ add_thickbox();
 
 $title = __('Dashboard');
 $parent_file = 'index.php';
-require_once('admin-header.php');
+
+add_contextual_help($current_screen,
+
+       '<p>' . __('Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application.') . '</p>' .
+       '<p>' . __('The left-hand navigation menu provides links to the administration screens in your WordPress application. You can expand or collapse navigation sections by clicking on the arrow that appears on the right side of each navigation item when you hover over it. You can also minimize the navigation menu to a narrow icon strip by clicking on the separator lines between navigation sections that end in double arrowheads; when minimized, the submenu items will be displayed on hover.') . '</p>' .
+       '<p>' . __('You can configure your dashboard by choosing which modules to display, how many columns to display them in, and where each module should be placed. You can hide/show modules and select the number of columns in the Screen Options tab. To rearrange the modules, drag and drop by clicking on the title bar of the selected module and releasing when you see a gray dotted-line box appear in the location you want to place the module. You can also expand or collapse each module by clicking once on the the module&#8217;s title bar. In addition, some modules are configurable, and will show a &#8220;Configure&#8221; link in the title bar when you hover over it.') . '</p>' .
+       '<p>' . __('The modules on your Dashboard screen are:') . '</p>' .
+       '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>' .
+       '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>' .
+       '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>' .
+       '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>' .
+       '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>' .
+       '<p>' . __('<strong>Other WordPress News</strong> - Shows the feed from <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a>. You can configure it to show a different feed of your choosing.') . '</p>' .
+       '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_SubPanel" target="_blank">Dashboard Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once('./admin-header.php');
 
 $today = current_time('mysql', 1);
 ?>
index 0e9b87b902f393dbd8e78dcd1e7ae5dfe927b668..58be073861a80468e40c8d6e0be262c4e5933c8a 100644 (file)
  * @subpackage Administration
  */
 
+// Sanity check.
+if ( 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" >
+<head>
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <title>Error: PHP is not running</title>
+</head>
+<body>
+       <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
+       <h2>Error: PHP is not running</h2>
+       <p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
+</body>
+</html>
+<?php
+}
+
 /**
  * We are installing WordPress.
  *
- * @since unknown
+ * @since 1.5.1
  * @var bool
  */
-define('WP_INSTALLING', true);
+define( 'WP_INSTALLING', true );
 
 /** Load WordPress Bootstrap */
-require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
 
 /** Load WordPress Administration Upgrade API */
-require_once(dirname(__FILE__) . '/includes/upgrade.php');
+require_once( dirname( __FILE__ ) . '/includes/upgrade.php' );
 
-if (isset($_GET['step']))
-       $step = $_GET['step'];
-else
-       $step = 0;
+/** Load wpdb */
+require_once(dirname(dirname(__FILE__)) . '/wp-includes/wp-db.php');
+
+$step = isset( $_GET['step'] ) ? $_GET['step'] : 0;
 
 /**
  * Display install header.
  *
- * @since unknown
+ * @since 2.5.0
  * @package WordPress
  * @subpackage Installer
  */
 function display_header() {
-header( 'Content-Type: text/html; charset=utf-8' );
+       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" <?php language_attributes(); ?>>
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-       <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
+       <title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
        <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 
 <?php
-}//end function display_header();
+} // end display_header()
 
+/**
+ * Display installer setup form.
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Installer
+ */
 function display_setup_form( $error = null ) {
+       global $wpdb;
+       $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->users'") != null );
+
        // Ensure that Blogs appear in search engines by default
        $blog_public = 1;
-       if ( isset($_POST) && !empty($_POST) ) {
-               $blog_public = isset($_POST['blog_public']);
-       }
+       if ( ! empty( $_POST ) )
+               $blog_public = isset( $_POST['blog_public'] );
+
+       $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
+       $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
+       $admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : '';
+       $admin_email  = isset( $_POST['admin_email']  ) ? trim( stripslashes( $_POST['admin_email'] ) ) : '';
 
        if ( ! is_null( $error ) ) {
 ?>
-<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
+<p class="message"><?php printf( __( '<strong>ERROR</strong>: %s' ), $error ); ?></p>
 <?php } ?>
 <form id="setup" method="post" action="install.php?step=2">
        <table class="form-table">
                <tr>
-                       <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
-                       <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td>
+                       <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
+                       <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>
+               </tr>
+               <tr>
+                       <th scope="row"><label for="user_name"><?php _e('Username'); ?></label></th>
+                       <td>
+                       <?php
+                       if ( $user_table ) {
+                               _e('User(s) already exists.');
+                       } else {
+                               ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
+                               <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods and the @ symbol.' ); ?></p>
+                       <?php
+                       } ?>
+                       </td>
                </tr>
+               <?php if ( ! $user_table ) : ?>
                <tr>
-                       <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
-                       <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br />
-                       <?php _e('Double-check your email address before continuing.'); ?></td>
+                       <th scope="row">
+                               <label for="admin_password"><?php _e('Password, twice'); ?></label>
+                               <p><?php _e('A password will be automatically generated for you if you leave this blank.'); ?></p>
+                       </th>
+                       <td>
+                               <input name="admin_password" type="password" id="pass1" size="25" value="" />
+                               <p><input name="admin_password2" type="password" id="pass2" size="25" value="" /></p>
+                               <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
+                               <p><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
+                       </td>
                </tr>
+               <?php endif; ?>
                <tr>
-                       <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" <?php checked($blog_public); ?> /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
+                       <th scope="row"><label for="admin_email"><?php _e( 'Your E-mail' ); ?></label></th>
+                       <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" />
+                       <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
+               </tr>
+               <tr>
+                       <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" <?php checked( $blog_public ); ?> /> <?php _e( 'Allow my site to appear in search engines like Google and Technorati.' ); ?></label></td>
                </tr>
        </table>
-       <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p>
+       <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button" /></p>
 </form>
 <?php
-}
+} // end display_setup_form()
 
 // Let's check to make sure WP isn't already installed.
-if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
+if ( is_blog_installed() ) {
+       display_header();
+       die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="../wp-login.php" class="button">' . __('Log In') . '</a></p></body></html>' );
+}
 
 $php_version    = phpversion();
 $mysql_version  = $wpdb->db_version();
@@ -88,11 +150,11 @@ $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
 $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
 
 if ( !$mysql_compat && !$php_compat )
-       $compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
+       $compat = sprintf( __('You cannot install because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
 elseif ( !$php_compat )
-       $compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
+       $compat = sprintf( __('You cannot install because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
 elseif ( !$mysql_compat )
-       $compat = sprintf( __('You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
+       $compat = sprintf( __('You cannot install because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
 
 if ( !$mysql_compat || !$php_compat ) {
        display_header();
@@ -100,68 +162,80 @@ if ( !$mysql_compat || !$php_compat ) {
 }
 
 switch($step) {
-       case 0:
-       case 1: // in case people are directly linking to this
+       case 0: // Step 1
+       case 1: // Step 1, direct link.
          display_header();
 ?>
-<h1><?php _e('Welcome'); ?></h1>
-<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
-<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
-
-<h1><?php _e('Information needed'); ?></h1>
-<p><?php _e('Please provide the following information.  Don&#8217;t worry, you can always change these settings later.'); ?></p>
-
+<h1><?php _e( 'Welcome' ); ?></h1>
+<p><?php printf( __( 'Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ), '../readme.html' ); ?></p>
 
+<h1><?php _e( 'Information needed' ); ?></h1>
+<p><?php _e( 'Please provide the following information. Don&#8217;t worry, you can always change these settings later.' ); ?></p>
 
 <?php
                display_setup_form();
                break;
        case 2:
-               if ( !empty($wpdb->error) )
-                       wp_die($wpdb->error->get_error_message());
+               if ( ! empty( $wpdb->error ) )
+                       wp_die( $wpdb->error->get_error_message() );
 
                display_header();
                // Fill in the data we gathered
-               $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;
+               $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
+               $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
+               $admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : '';
+               $admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2'] : '';
+               $admin_email  = isset( $_POST['admin_email']  ) ?trim( stripslashes( $_POST['admin_email'] ) ) : '';
+               $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
                // check e-mail address
                $error = false;
-               if (empty($admin_email)) {
+               if ( empty( $user_name ) ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __('you must provide a valid username.') );
+                       $error = true;
+               } elseif ( $user_name != sanitize_user( $user_name, true ) ) {
+                       display_setup_form( __('the username you provided has invalid characters.') );
+                       $error = true;
+               } elseif ( $admin_password != $admin_password_check ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __( 'your passwords do not match. Please try again' ) );
+                       $error = true;
+               } else if ( empty( $admin_email ) ) {
                        // TODO: poka-yoke
-                       display_setup_form( __('you must provide an e-mail address.') );
+                       display_setup_form( __( 'you must provide an e-mail address.' ) );
                        $error = true;
-               } else if (!is_email($admin_email)) {
+               } elseif ( ! is_email( $admin_email ) ) {
                        // TODO: poka-yoke
-                       display_setup_form( __('that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>') );
+                       display_setup_form( __( 'that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>' ) );
                        $error = true;
                }
 
                if ( $error === false ) {
                        $wpdb->show_errors();
-                       $result = wp_install($weblog_title, 'admin', $admin_email, $public);
-                       extract($result, EXTR_SKIP);
+                       $result = wp_install($weblog_title, $user_name, $admin_email, $public, '', $admin_password);
+                       extract( $result, EXTR_SKIP );
 ?>
 
-<h1><?php _e('Success!'); ?></h1>
+<h1><?php _e( 'Success!' ); ?></h1>
 
-<p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>
+<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p>
 
 <table class="form-table">
        <tr>
-               <th><?php _e('Username'); ?></th>
-               <td><code>admin</code></td>
+               <th><?php _e( 'Username' ); ?></th>
+               <td><code><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></code></td>
        </tr>
        <tr>
-               <th><?php _e('Password'); ?></th>
-               <td><?php if ( !empty( $password ) ) {
-                                               echo '<code>'. $password .'</code><br />';
-                                       }
-                                       echo '<p>'. $password_message .'</p>'; ?></td>
+               <th><?php _e( 'Password' ); ?></th>
+               <td><?php
+               if ( ! empty( $password ) && empty($admin_password_check) )
+                       echo '<code>'. esc_html($password) .'</code><br />';
+               echo "<p>$password_message</p>"; ?>
+               </td>
        </tr>
 </table>
 
-<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
+<p class="step"><a href="../wp-login.php" class="button"><?php _e( 'Log In' ); ?></a></p>
 
 <?php
                }
@@ -169,5 +243,22 @@ switch($step) {
 }
 ?>
 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
+<script type="text/javascript" src="../wp-includes/js/jquery/jquery.js"></script>
+<script type="text/javascript" src="js/password-strength-meter.js"></script>
+<script type="text/javascript" src="js/user-profile.js"></script>
+<script type="text/javascript" src="js/utils.js"></script>
+<script type='text/javascript'>
+/* <![CDATA[ */
+var pwsL10n = {
+ empty: "<?php echo esc_js( __( 'Strength indicator' ) ); ?>",
+ short: "<?php echo esc_js( __( 'Very weak' ) ); ?>",
+ bad: "<?php echo esc_js( __( 'Weak' ) ); ?>",
+ good: "<?php echo esc_js( __( 'Medium' ) ); ?>",
+ strong: "<?php echo esc_js( __( 'Strong' ) ); ?>",
+ mismatch: "<?php echo esc_js( __( 'Mismatch' ) ); ?>"
+};
+try{convertEntities(pwsL10n);}catch(e){};
+/* ]]> */
+</script>
 </body>
 </html>
index 2ef85e6b1ab78429a196fa86a366e3e320f7c781..4972cb0fcb6acfb4b565031f96ee02d9d9c99e4d 100644 (file)
@@ -123,25 +123,47 @@ $(document).ready(function(){ adminMenu.init(); });
 // show/hide/save table columns
 columns = {
        init : function() {
+               var that = this;
                $('.hide-column-tog', '#adv-settings').click( function() {
-                       var column = $(this).val();
-                       if ( $(this).attr('checked') )
-                               $('.column-' + column).show();
+                       var $t = $(this), column = $t.val();
+                       if ( $t.attr('checked') )
+                               that.checked(column);
                        else
-                               $('.column-' + column).hide();
+                               that.unchecked(column);
 
-                       columns.save_manage_columns_state();
+                       columns.saveManageColumnsState();
                });
        },
 
-       save_manage_columns_state : function() {
-               var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
+       saveManageColumnsState : function() {
+               var hidden = this.hidden();
                $.post(ajaxurl, {
                        action: 'hidden-columns',
                        hidden: hidden,
                        screenoptionnonce: $('#screenoptionnonce').val(),
                        page: pagenow
                });
+       },
+
+       checked : function(column) {
+               $('.column-' + column).show();
+       },
+
+       unchecked : function(column) {
+               $('.column-' + column).hide();
+       },
+
+       hidden : function() {
+               return $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
+       },
+
+       useCheckboxesForHidden : function() {
+               this.hidden = function(){
+                       return $('.hide-column-tog').not(':checked').map(function() {
+                               var id = this.id;
+                               return id.substring( id, id.length - 5 );
+                       }).get().join(',');
+               };
        }
 }
 
@@ -172,9 +194,9 @@ showNotice = {
 jQuery(document).ready( function($) {
        var lastClicked = false, checks, first, last, checked;
 
-       // Move .updated and .error alert boxes
+       // Move .updated and .error alert boxes. Don't move boxes designed to be inline.
        $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
-       $('div.updated, div.error').not('.below-h2').insertAfter( $('div.wrap h2:first') );
+       $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
 
        // screen settings tab
        $('#show-settings-link').click(function () {
@@ -183,11 +205,11 @@ jQuery(document).ready( function($) {
 
                $('#screen-options-wrap').slideToggle('fast', function(){
                        if ( $(this).hasClass('screen-options-open') ) {
-                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
+                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif?ver=20100531")'});
                                $('#contextual-help-link-wrap').css('visibility', '');
                                $(this).removeClass('screen-options-open');
                        } else {
-                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
+                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif?ver=20100531")'});
                                $(this).addClass('screen-options-open');
                        }
                });
@@ -201,11 +223,11 @@ jQuery(document).ready( function($) {
 
                $('#contextual-help-wrap').slideToggle('fast', function() {
                        if ( $(this).hasClass('contextual-help-open') ) {
-                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
+                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif?ver=20100531")'});
                                $('#screen-options-link-wrap').css('visibility', '');
                                $(this).removeClass('contextual-help-open');
                        } else {
-                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
+                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif?ver=20100531")'});
                                $(this).addClass('contextual-help-open');
                        }
                });
@@ -267,24 +289,37 @@ jQuery(document).ready( function($) {
                $('div.default-password-nag').hide();
                return false;
        });
-});
 
-jQuery(document).ready( function($){
-       var turboNag = $('span.turbo-nag', '#user_info');
+       // tab in textareas
+       $('#newcontent').keydown(function(e) {
+               if ( e.keyCode != 9 )
+                       return true;
 
-       if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) )
-               return;
+               var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
 
-       if ( 'undefined' != typeof GearsFactory ) {
-               return;
-       } else {
                try {
-                       if ( ( 'undefined' != typeof window.ActiveXObject && ActiveXObject('Gears.Factory') ) ||
-                               ( 'undefined' != typeof navigator.mimeTypes && navigator.mimeTypes['application/x-googlegears'] ) ) {
-                                       return;
-                       }
-               } catch(e){}
-       }
+                       this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event.  See blur handler below.
+               } catch(err) {}
+
+               if ( document.selection ) {
+                       el.focus();
+                       sel = document.selection.createRange();
+                       sel.text = '\t';
+               } else if ( selStart >= 0 ) {
+                       scroll = this.scrollTop;
+                       el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) );
+                       el.selectionStart = el.selectionEnd = selStart + 1;
+                       this.scrollTop = scroll;
+               }
 
-       turboNag.show();
-});
+               if ( e.stopPropagation )
+                       e.stopPropagation();
+               if ( e.preventDefault )
+                       e.preventDefault();
+       });
+
+       $('#newcontent').blur(function(e) {
+               if ( this.lastKey && 9 == this.lastKey )
+                       this.focus();
+       });
+});
\ No newline at end of file
index eaef37f8ed767007ff7bdb86acf9506372371ace..c18dad14234bb2a693411cb5f389dac0da194d7e 100644 (file)
@@ -1 +1 @@
-var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){var b=a("#adminmenu");a(".wp-menu-toggle",b).each(function(){var c=a(this),d=c.siblings(".wp-submenu");if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a(".separator",b).click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("li.wp-has-submenu","#adminmenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){var c=b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open").attr("id");if(c){a("li.wp-has-submenu","#adminmenu").each(function(f,g){if(c==g.id){var d=a(g).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+f,d)}})}return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=a(this).offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)}).bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog","#adv-settings").click(function(){var b=a(this).val();if(a(this).attr("checked")){a(".column-"+b).show()}else{a(".column-"+b).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter(d("div.wrap h2:first"));d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("tbody").children().children(".check-column").find(":checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).closest("form").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).closest("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead, tfoot").find(":checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(d(this).closest("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).closest("table").children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b("span.turbo-nag","#user_info");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
\ No newline at end of file
+var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){var b=a("#adminmenu");a(".wp-menu-toggle",b).each(function(){var c=a(this),d=c.siblings(".wp-submenu");if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a(".separator",b).click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("li.wp-has-submenu","#adminmenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){var c=b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open").attr("id");if(c){a("li.wp-has-submenu","#adminmenu").each(function(f,g){if(c==g.id){var d=a(g).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+f,d)}})}return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=a(this).offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)}).bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var d=a(this),c=d.val();if(d.attr("checked")){b.checked(c)}else{b.unchecked(c)}columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).show()},unchecked:function(b){a(".column-"+b).hide()},hidden:function(){return a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var b=this.id;return b.substring(b,b.length-5)}).get().join(",")}}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2, .inline").insertAfter(d("div.wrap h2:first"));d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif?ver=20100531")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif?ver=20100531")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif?ver=20100531")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif?ver=20100531")'});d(this).addClass("contextual-help-open")}});return false});d("tbody").children().children(".check-column").find(":checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).closest("form").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).closest("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead, tfoot").find(":checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(d(this).closest("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).closest("table").children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false});d("#newcontent").keydown(function(l){if(l.keyCode!=9){return true}var i=l.target,n=i.selectionStart,h=i.selectionEnd,m=i.value,g,k;try{this.lastKey=9}catch(j){}if(document.selection){i.focus();k=document.selection.createRange();k.text="\t"}else{if(n>=0){g=this.scrollTop;i.value=m.substring(0,n).concat("\t",m.substring(h));i.selectionStart=i.selectionEnd=n+1;this.scrollTop=g}}if(l.stopPropagation){l.stopPropagation()}if(l.preventDefault){l.preventDefault()}});d("#newcontent").blur(function(g){if(this.lastKey&&9==this.lastKey){this.focus()}})});
\ No newline at end of file
diff --git a/wp-admin/js/custom-background.dev.js b/wp-admin/js/custom-background.dev.js
new file mode 100644 (file)
index 0000000..5b4b154
--- /dev/null
@@ -0,0 +1,46 @@
+var farbtastic;
+
+function pickColor(color) {
+       farbtastic.setColor(color);
+       jQuery('#background-color').val(color);
+       jQuery('#custom-background-image').css('background-color', color);
+}
+
+jQuery(document).ready(function() {
+       jQuery('#pickcolor').click(function() {
+               jQuery('#colorPickerDiv').show();
+               return false;
+       });
+
+       jQuery('#background-color').keyup(function() {
+               var _hex = jQuery('#background-color').val(), hex = _hex;
+               if ( hex[0] != '#' )
+                       hex = '#' + hex;
+               hex = hex.replace(/[^#a-fA-F0-9]+/, '');
+               if ( hex != _hex )
+                       jQuery('#background-color').val(hex);
+               if ( hex.length == 4 || hex.length == 7 )
+                       pickColor( hex );
+       });
+
+       jQuery('input[name="background-position-x"]').change(function() {
+               jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top');
+       });
+
+       jQuery('input[name="background-repeat"]').change(function() {
+               jQuery('#custom-background-image').css('background-repeat', jQuery(this).val());
+       });
+
+       farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) {
+               pickColor(color);
+       });
+       pickColor(jQuery('#background-color').val());
+
+       jQuery(document).mousedown(function(){
+               jQuery('#colorPickerDiv').each(function(){
+                       var display = jQuery(this).css('display');
+                       if ( display == 'block' )
+                               jQuery(this).fadeOut(2);
+               });
+       });
+});
diff --git a/wp-admin/js/custom-background.js b/wp-admin/js/custom-background.js
new file mode 100644 (file)
index 0000000..0a5f8af
--- /dev/null
@@ -0,0 +1 @@
+var farbtastic;function pickColor(a){farbtastic.setColor(a);jQuery("#background-color").val(a);jQuery("#custom-background-image").css("background-color",a)}jQuery(document).ready(function(){jQuery("#pickcolor").click(function(){jQuery("#colorPickerDiv").show();return false});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val(),a=b;if(a[0]!="#"){a="#"+a}a=a.replace(/[^#a-fA-F0-9]+/,"");if(a!=b){jQuery("#background-color").val(a)}if(a.length==4||a.length==7){pickColor(a)}});jQuery('input[name="background-position-x"]').change(function(){jQuery("#custom-background-image").css("background-position",jQuery(this).val()+" top")});jQuery('input[name="background-repeat"]').change(function(){jQuery("#custom-background-image").css("background-repeat",jQuery(this).val())});farbtastic=jQuery.farbtastic("#colorPickerDiv",function(a){pickColor(a)});pickColor(jQuery("#background-color").val());jQuery(document).mousedown(function(){jQuery("#colorPickerDiv").each(function(){var a=jQuery(this).css("display");if(a=="block"){jQuery(this).fadeOut(2)}})})});
\ No newline at end of file
index aa33391c8b018a19ba59a157148a1009a7d61660..4969113ccc9613544323a5ea766905d826977111 100644 (file)
@@ -6,7 +6,8 @@ jQuery(document).ready( function($) {
                'dashboard_incoming_links',
                'dashboard_primary',
                'dashboard_secondary',
-               'dashboard_plugins'
+               'dashboard_plugins',
+               'dashboard_quick_press'
        ];
 
        ajaxPopulateWidgets = function(el) {
@@ -20,6 +21,10 @@ jQuery(document).ready( function($) {
                                                        $(this).css('display', '');
                                                        if ( 'dashboard_plugins' == id && $.isFunction(tb_init) )
                                                                tb_init('#dashboard_plugins a.thickbox');
+                                                       if ( 'dashboard_quick_press' == id && $.isFunction(tb_init) ) {
+                                                               tb_init('#dashboard_quick_press a.thickbox');
+                                                               quickPressLoad();
+                                                       }
                                                });
                                        });
                                }, i * 500 );
@@ -43,7 +48,7 @@ jQuery(document).ready( function($) {
        quickPressLoad = function() {
                var act = $('#quickpost-action'), t;
                t = $('#quick-press').submit( function() {
-                       $('#dashboard_quick_press h3').append( '<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />' );
+                       $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'visible');
                        $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','disabled');
 
                        if ( 'post' == act.val() ) {
@@ -51,8 +56,9 @@ jQuery(document).ready( function($) {
                        }
 
                        $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
-                               $('#dashboard_quick_press h3 img').remove();
+                               $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'hidden');
                                $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','');
+                               $('#dashboard_quick_press ul').next('p').remove();
                                $('#dashboard_quick_press ul').find('li').each( function() {
                                        $('#dashboard_recent_drafts ul').prepend( this );
                                } ).end().remove();
@@ -65,6 +71,5 @@ jQuery(document).ready( function($) {
                $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
 
        };
-       quickPressLoad();
 
 } );
index c9886183e4d2febfcf62d78df3e180fa8d47a397..f391e1342e31e8acc84995308cb309efccaee841 100644 (file)
@@ -1 +1 @@
-var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press h3 img").remove();a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()});
\ No newline at end of file
+var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins","dashboard_quick_press"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}if("dashboard_quick_press"==g&&a.isFunction(tb_init)){tb_init("#dashboard_quick_press a.thickbox");quickPressLoad()}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})}});
\ No newline at end of file
index cc39f12cd19b3eded135fb8cb19eb79bd6141df2..bec6f3cccef7e029190716ee140e438283b65ab0 100644 (file)
@@ -49,6 +49,8 @@ setCommentsList = function() {
                        el = $('#comment-' + id);
                        note = $('#' + action + '-undo-holder').html();
 
+                       el.find('.check-column :checkbox').attr('checked', ''); // Uncheck the row so as not to be affected by Bulk Edits.
+
                        if ( el.siblings('#replyrow').length && commentReply.cid == id )
                                commentReply.close();
 
index 8d1347a434be15752db8333296879d265c987e45..cb865d9c285145ad9c6337037214dc24ed6dc13d 100644 (file)
@@ -1 +1 @@
-var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var c,e,h,l=0,g,i,d,k;c=a('.tablenav input[name="_total"]',"#comments-form");e=a('.tablenav input[name="_per_page"]',"#comments-form");h=a('.tablenav input[name="_page"]',"#comments-form");g=function(n,m){var o=a("#"+m.element);if(o.is(".unapproved")){o.find("div.comment_status").html("0")}else{o.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var p=a(this),r,q;r=p.html().replace(/[^0-9]+/g,"");r=parseInt(r,10);if(isNaN(r)){return}q=a("#"+m.element).is("."+m.dimClass)?1:-1;r=r+q;if(r<0){r=0}p.closest("#awaiting-mod")[0==r?"addClass":"removeClass"]("count-0");f(p,r);j()})};i=function(q,u){var w=a(q.target).attr("className"),m,o,p,t,v,s,r=false;q.data._total=c.val()||0;q.data._per_page=e.val()||0;q.data._page=h.val()||0;q.data._url=document.location.href;if(w.indexOf(":trash=1")!=-1){r="trash"}else{if(w.indexOf(":spam=1")!=-1){r="spam"}}if(r){m=w.replace(/.*?comment-([0-9]+).*/,"$1");o=a("#comment-"+m);note=a("#"+r+"-undo-holder").html();if(o.siblings("#replyrow").length&&commentReply.cid==m){commentReply.close()}if(o.is("tr")){p=o.children(":visible").length;s=a(".author strong",o).text();t=a('<tr id="undo-'+m+'" class="undo un'+r+'" style="display:none;"><td colspan="'+p+'">'+note+"</td></tr>")}else{s=a(".comment-author",o).text();t=a('<div id="undo-'+m+'" style="display:none;" class="undo un'+r+'">'+note+"</div>")}o.before(t);a("strong","#undo-"+m).text(s+" ");v=a(".undo a","#undo-"+m);v.attr("href","comment.php?action=un"+r+"comment&c="+m+"&_wpnonce="+q.data._ajax_nonce);v.attr("className","delete:the-comment-list:comment-"+m+"::un"+r+"=1 vim-z vim-destructive");a(".avatar",o).clone().prependTo("#undo-"+m+" ."+r+"-undo-inside");v.click(function(){u.wpList.del(this);a("#undo-"+m).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+m).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return q};d=function(m,n,o){if(n<l){return}if(o){l=n}c.val(m.toString());a("span.total-type-count").each(function(){f(a(this),m)})};function j(s){var r=a("#dashboard_right_now"),o,q,p,m;s=s||0;if(isNaN(s)||!r.length){return}o=a("span.total-count",r);q=a("span.approved-count",r);p=b(o);p=p+s;m=p-b(a("span.pending-count",r))-b(a("span.spam-count",r));f(o,p);f(q,m)}function b(m){var o=parseInt(m.html().replace(/[^0-9]+/g,""),10);if(isNaN(o)){return 0}return o}function f(o,p){var m="";if(isNaN(p)){return}p=p<1?"0":p.toString();if(p.length>3){while(p.length>3){m=thousandsSeparator+p.substr(p.length-3)+m;p=p.substr(0,p.length-3)}p=p+m}o.html(p)}k=function(m,o){var t,p,q,v=a(o.target).parent().is("span.untrash"),n=a(o.target).parent().is("span.unspam"),u,s;function w(r){if(a(o.target).parent().is("span."+r)){return 1}else{if(a("#"+o.element).is("."+r)){return -1}}return 0}u=w("spam");s=w("trash");if(v){s=-1}if(n){u=-1}a("span.pending-count").each(function(){var r=a(this),y=b(r),x=a("#"+o.element).is(".unapproved");if(a(o.target).parent().is("span.unapprove")||((v||n)&&x)){y=y+1}else{if(x){y=y-1}}if(y<0){y=0}r.closest("#awaiting-mod")[0==y?"addClass":"removeClass"]("count-0");f(r,y);j()});a("span.spam-count").each(function(){var r=a(this),x=b(r)+u;f(r,x)});a("span.trash-count").each(function(){var r=a(this),x=b(r)+s;f(r,x)});if(a("#dashboard_right_now").length){q=s?-1*s:0;j(q)}else{t=c.val()?parseInt(c.val(),10):0;t=t-u-s;if(t<0){t=0}if(("object"==typeof m)&&l<o.parsed.responses[0].supplemental.time){p=o.parsed.responses[0].supplemental.pageLinks||"";if(a.trim(p)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(p))}else{a(".tablenav-pages").find(".page-numbers").remove()}d(t,o.parsed.responses[0].supplemental.time,true)}else{d(t,m,false)}}if(theExtraList.size()==0||theExtraList.children().size()==0||v){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:i,dimAfter:g,delAfter:k,addColor:"none"}).bind("wpListDelEnd",function(n,m){var o=m.element.replace(/[^0-9]+/g,"");if(m.target.className.indexOf(":trash=1")!=-1||m.target.className.indexOf(":spam=1")!=-1){a("#undo-"+o).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var l=this,e,f,i,g,j=a("#comment-"+b);l.close();l.cid=b;a("td","#replyrow").attr("colspan",a("table.widefat thead th:visible").length);e=a("#replyrow");f=a("#inline-"+b);i=l.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);a("#replyrow").fadeIn(300,function(){a(this).show()})}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var n,h,o,c,m;n=a("#replyrow").offset().top;h=n+a("#replyrow").height();o=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;m=o+c;if(m-20<h){window.scroll(0,h-c+35)}else{if(n-20<o){window.scroll(0,n-35)}}a("#replycontent").focus().keyup(function(p){if(p.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}e=e.responses[0];g=e.data;f="#comment-"+e.id;if("edit-comment"==this.act){a(f).remove()}a(g).hide();a("#replyrow").after(g);this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a("option[value="+f+"]",g).attr("selected","selected");a("#comments-form").submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
\ No newline at end of file
+var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var c,e,h,l=0,g,i,d,k;c=a('.tablenav input[name="_total"]',"#comments-form");e=a('.tablenav input[name="_per_page"]',"#comments-form");h=a('.tablenav input[name="_page"]',"#comments-form");g=function(n,m){var o=a("#"+m.element);if(o.is(".unapproved")){o.find("div.comment_status").html("0")}else{o.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var p=a(this),r,q;r=p.html().replace(/[^0-9]+/g,"");r=parseInt(r,10);if(isNaN(r)){return}q=a("#"+m.element).is("."+m.dimClass)?1:-1;r=r+q;if(r<0){r=0}p.closest("#awaiting-mod")[0==r?"addClass":"removeClass"]("count-0");f(p,r);j()})};i=function(q,u){var w=a(q.target).attr("className"),m,o,p,t,v,s,r=false;q.data._total=c.val()||0;q.data._per_page=e.val()||0;q.data._page=h.val()||0;q.data._url=document.location.href;if(w.indexOf(":trash=1")!=-1){r="trash"}else{if(w.indexOf(":spam=1")!=-1){r="spam"}}if(r){m=w.replace(/.*?comment-([0-9]+).*/,"$1");o=a("#comment-"+m);note=a("#"+r+"-undo-holder").html();o.find(".check-column :checkbox").attr("checked","");if(o.siblings("#replyrow").length&&commentReply.cid==m){commentReply.close()}if(o.is("tr")){p=o.children(":visible").length;s=a(".author strong",o).text();t=a('<tr id="undo-'+m+'" class="undo un'+r+'" style="display:none;"><td colspan="'+p+'">'+note+"</td></tr>")}else{s=a(".comment-author",o).text();t=a('<div id="undo-'+m+'" style="display:none;" class="undo un'+r+'">'+note+"</div>")}o.before(t);a("strong","#undo-"+m).text(s+" ");v=a(".undo a","#undo-"+m);v.attr("href","comment.php?action=un"+r+"comment&c="+m+"&_wpnonce="+q.data._ajax_nonce);v.attr("className","delete:the-comment-list:comment-"+m+"::un"+r+"=1 vim-z vim-destructive");a(".avatar",o).clone().prependTo("#undo-"+m+" ."+r+"-undo-inside");v.click(function(){u.wpList.del(this);a("#undo-"+m).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+m).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return q};d=function(m,n,o){if(n<l){return}if(o){l=n}c.val(m.toString());a("span.total-type-count").each(function(){f(a(this),m)})};function j(s){var r=a("#dashboard_right_now"),o,q,p,m;s=s||0;if(isNaN(s)||!r.length){return}o=a("span.total-count",r);q=a("span.approved-count",r);p=b(o);p=p+s;m=p-b(a("span.pending-count",r))-b(a("span.spam-count",r));f(o,p);f(q,m)}function b(m){var o=parseInt(m.html().replace(/[^0-9]+/g,""),10);if(isNaN(o)){return 0}return o}function f(o,p){var m="";if(isNaN(p)){return}p=p<1?"0":p.toString();if(p.length>3){while(p.length>3){m=thousandsSeparator+p.substr(p.length-3)+m;p=p.substr(0,p.length-3)}p=p+m}o.html(p)}k=function(m,o){var t,p,q,v=a(o.target).parent().is("span.untrash"),n=a(o.target).parent().is("span.unspam"),u,s;function w(r){if(a(o.target).parent().is("span."+r)){return 1}else{if(a("#"+o.element).is("."+r)){return -1}}return 0}u=w("spam");s=w("trash");if(v){s=-1}if(n){u=-1}a("span.pending-count").each(function(){var r=a(this),y=b(r),x=a("#"+o.element).is(".unapproved");if(a(o.target).parent().is("span.unapprove")||((v||n)&&x)){y=y+1}else{if(x){y=y-1}}if(y<0){y=0}r.closest("#awaiting-mod")[0==y?"addClass":"removeClass"]("count-0");f(r,y);j()});a("span.spam-count").each(function(){var r=a(this),x=b(r)+u;f(r,x)});a("span.trash-count").each(function(){var r=a(this),x=b(r)+s;f(r,x)});if(a("#dashboard_right_now").length){q=s?-1*s:0;j(q)}else{t=c.val()?parseInt(c.val(),10):0;t=t-u-s;if(t<0){t=0}if(("object"==typeof m)&&l<o.parsed.responses[0].supplemental.time){p=o.parsed.responses[0].supplemental.pageLinks||"";if(a.trim(p)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(p))}else{a(".tablenav-pages").find(".page-numbers").remove()}d(t,o.parsed.responses[0].supplemental.time,true)}else{d(t,m,false)}}if(theExtraList.size()==0||theExtraList.children().size()==0||v){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:i,dimAfter:g,delAfter:k,addColor:"none"}).bind("wpListDelEnd",function(n,m){var o=m.element.replace(/[^0-9]+/g,"");if(m.target.className.indexOf(":trash=1")!=-1||m.target.className.indexOf(":spam=1")!=-1){a("#undo-"+o).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var l=this,e,f,i,g,j=a("#comment-"+b);l.close();l.cid=b;a("td","#replyrow").attr("colspan",a("table.widefat thead th:visible").length);e=a("#replyrow");f=a("#inline-"+b);i=l.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);a("#replyrow").fadeIn(300,function(){a(this).show()})}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var n,h,o,c,m;n=a("#replyrow").offset().top;h=n+a("#replyrow").height();o=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;m=o+c;if(m-20<h){window.scroll(0,h-c+35)}else{if(n-20<o){window.scroll(0,n-35)}}a("#replycontent").focus().keyup(function(p){if(p.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}e=e.responses[0];g=e.data;f="#comment-"+e.id;if("edit-comment"==this.act){a(f).remove()}a(g).hide();a("#replyrow").after(g);this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a("option[value="+f+"]",g).attr("selected","selected");a("#comments-form").submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
\ No newline at end of file
index 49ce7f3bd3ec202cac8816ce84346714735538c4..0e43d5110c4d8327f38796ef583a64d839be7dc0 100644 (file)
@@ -204,10 +204,10 @@ imageEdit = {
 
                        if ( fw < 1 ) {
                                w.focus();
-                               return false;;
+                               return false;
                        } else if ( fh < 1 ) {
                                h.focus();
-                               return false;;
+                               return false;
                        }
 
                        if ( fw == t.hold.ow || fh == t.hold.oh )
index f1380ee675af2fd965148f218824edd0390d8c62..2bb3547b14ecf92939154a172bad0fa92748009f 100644 (file)
@@ -36,17 +36,13 @@ inlineEditPost = {
                        $('#inline-edit label.inline-edit-tags').clone()
                );
 
-               // categories expandable?
+               // hiearchical taxonomies expandable?
                $('span.catshow').click(function() {
-                       $('.inline-editor ul.cat-checklist').addClass("cat-hover");
-                       $('.inline-editor span.cathide').show();
-                       $(this).hide();
+                       $(this).hide().next().show().parent().next().addClass("cat-hover");
                });
 
                $('span.cathide').click(function() {
-                       $('.inline-editor ul.cat-checklist').removeClass("cat-hover");
-                       $('.inline-editor span.catshow').show();
-                       $(this).hide();
+                       $(this).hide().prev().show().parent().next().removeClass("cat-hover");
                });
 
                $('select[name="_status"] option[value="future"]', bulkRow).remove();
@@ -118,7 +114,6 @@ inlineEditPost = {
 
                fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
                if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
-               if ( t.type == 'post' ) fields.push('tags_input');
 
                // add the new blank row
                editRow = $('#inline-edit').clone(true);
@@ -146,9 +141,24 @@ inlineEditPost = {
                if ( $('.sticky', rowData).text() == 'sticky' )
                        $('input[name="sticky"]', editRow).attr("checked", "checked");
 
-               // categories
-               if ( cats = $('.post_category', rowData).text() )
-                       $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
+               // hierarchical taxonomies
+               $('.post_category', rowData).each(function(){
+                       if( term_ids = $(this).text() )
+                       {
+                               taxname = $(this).attr('id').replace('_'+id, '');
+                               $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
+                       }
+               });
+               //flat taxonomies
+               $('.tags_input', rowData).each(function(){
+                       if( terms = $(this).text() )
+                       {
+                               taxname = $(this).attr('id').replace('_'+id, '');
+                               $('textarea.tax_input_'+taxname, editRow).val(terms);
+                               $('textarea.tax_input_'+taxname, editRow).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+                       }
+               });
+
 
                // handle the post status
                status = $('._status', rowData).text();
@@ -180,12 +190,6 @@ inlineEditPost = {
                $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
                $('.ptitle', editRow).focus();
 
-               // enable autocomplete for tags
-               if ( t.type == 'post' ) {
-                       tax = 'post_tag';
-                       $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-               }
-
                return false;
        },
 
@@ -199,7 +203,7 @@ inlineEditPost = {
 
                params = {
                        action: 'inline-save',
-                       post_type: this.type,
+                       post_type: typenow,
                        post_ID: id,
                        edit_date: 'true',
                        post_status: page
index f8fd54bad97117746d14022124a48e5b79656c0f..baf9e4415a2db89832157058e1e55280efb10fcf 100644 (file)
@@ -1 +1 @@
-(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});a("a.editinline").live("click",function(){inlineEditPost.edit(this);return false});a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(".inline-editor ul.cat-checklist").addClass("cat-hover");a(".inline-editor span.cathide").show();a(this).hide()});a("span.cathide").click(function(){a(".inline-editor ul.cat-checklist").removeClass("cat-hover");a(".inline-editor span.catshow").show();a(this).hide()});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},setBulk:function(){var e="",d=this.type,b,f=true;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(g){if(a(this).attr("checked")){f=false;var h=a(this).val(),c;c=a("#inline_"+h+" .post_title").text()||inlineEditL10n.notitle;e+='<div id="ttle'+h+'"><a id="_'+h+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+c+"</div>"}});if(f){return this.revert()}a("#bulk-titles").html(e);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').attr("checked","");a("#ttle"+c).remove()});if(d=="post"){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}if(o.type=="post"){j.push("tags_input")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);if(!a(':input[name="post_author"] option[value='+a(".post_author",g).text()+"]",d).val()){a(':input[name="post_author"]',d).prepend('<option value="'+a(".post_author",g).text()+'">'+a("#"+o.type+"-"+b+" .author").text()+"</option>")}for(k=0;k<j.length;k++){a(':input[name="'+j[k]+'"]',d).val(a("."+j[k],g).text())}if(a(".comment_status",g).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",g).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",g).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}if(n=a(".post_category",g).text()){a("ul.cat-checklist :checkbox",d).val(n.split(","))}i=a("._status",g).text();if(i!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(i=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}h=a('select[name="post_parent"] option[value="'+b+'"]',d);if(h.length>0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();if(o.type=="post"){e="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+e,{delay:500,minchars:2,multiple:true,multipleSep:", "})}return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save",post_type:this.type,post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(f){a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("<tr")){a(inlineEditPost.what+e).remove();a("#edit-"+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+f+"</span>")}}else{a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
\ No newline at end of file
+(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});a("a.editinline").live("click",function(){inlineEditPost.edit(this);return false});a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(this).hide().next().show().parent().next().addClass("cat-hover")});a("span.cathide").click(function(){a(this).hide().prev().show().parent().next().removeClass("cat-hover")});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},setBulk:function(){var e="",d=this.type,b,f=true;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(g){if(a(this).attr("checked")){f=false;var h=a(this).val(),c;c=a("#inline_"+h+" .post_title").text()||inlineEditL10n.notitle;e+='<div id="ttle'+h+'"><a id="_'+h+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+c+"</div>"}});if(f){return this.revert()}a("#bulk-titles").html(e);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').attr("checked","");a("#ttle"+c).remove()});if(d=="post"){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);if(!a(':input[name="post_author"] option[value='+a(".post_author",g).text()+"]",d).val()){a(':input[name="post_author"]',d).prepend('<option value="'+a(".post_author",g).text()+'">'+a("#"+o.type+"-"+b+" .author").text()+"</option>")}for(k=0;k<j.length;k++){a(':input[name="'+j[k]+'"]',d).val(a("."+j[k],g).text())}if(a(".comment_status",g).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",g).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",g).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}a(".post_category",g).each(function(){if(term_ids=a(this).text()){taxname=a(this).attr("id").replace("_"+b,"");a("ul."+taxname+"-checklist :checkbox",d).val(term_ids.split(","))}});a(".tags_input",g).each(function(){if(terms=a(this).text()){taxname=a(this).attr("id").replace("_"+b,"");a("textarea.tax_input_"+taxname,d).val(terms);a("textarea.tax_input_"+taxname,d).suggest("admin-ajax.php?action=ajax-tag-search&tax="+taxname,{delay:500,minchars:2,multiple:true,multipleSep:", "})}});i=a("._status",g).text();if(i!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(i=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}h=a('select[name="post_parent"] option[value="'+b+'"]',d);if(h.length>0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save",post_type:typenow,post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(f){a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("<tr")){a(inlineEditPost.what+e).remove();a("#edit-"+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+f+"</span>")}}else{a("#edit-"+e+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
\ No newline at end of file
index e963db99a4dcc0d204c66f2e656f7476c7f8358f..2db467a38fe5855019a8646846958bc3dc06b990 100644 (file)
@@ -59,6 +59,7 @@ jQuery(document).ready( function($) {
        $('#category-add-toggle').click( function() {
                $(this).parents('div:first').toggleClass( 'wp-hidden-children' );
                $('#category-tabs a[href="#categories-all"]').click();
+               $('#newcategory').focus();
                return false;
        } );
 
index db140c6b7835067c937194b839fb92e6ce5b7f0b..e394d7d10041ad6d459a3d712371e89f63ce9918 100644 (file)
@@ -1 +1 @@
-jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).attr("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('<option value="'+parseInt(l,10)+'"></option>').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()});
\ No newline at end of file
+jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).attr("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('<option value="'+parseInt(l,10)+'"></option>').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()});
\ No newline at end of file
index 7c6f4d272584c533a3c07a29468e350799378a4b..92749daeacf5ae537f54461085d09d095980e50a 100644 (file)
@@ -31,11 +31,10 @@ var findPosts;
                                _ajax_nonce: $('#_ajax_nonce').val()
                        };
 
-                       if ( $('#find-posts-pages').is(':checked') ) {
-                               post['pages'] = 1;
-                       } else {
-                               post['posts'] = 1;
-                       }
+                       var selectedItem;
+                       $("input[@name='itemSelect[]']:checked").each(function() { selectedItem = $(this).val() });
+                       post['post_type'] = selectedItem;
+
                        $.ajax({
                                type : 'POST',
                                url : ajaxurl,
index 4818f81bfe8d5e3773eebba10c3bccd59bc4cc46..4d338a413aabcacdd1f26b96470c6b9a58d67782 100644 (file)
@@ -1 +1 @@
-var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()};if(a("#find-posts-pages").is(":checked")){b.pages=1}else{b.posts=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){findPosts.show(c)},error:function(c){findPosts.error(c)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery);
\ No newline at end of file
+var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()};var c;a("input[@name='itemSelect[]']:checked").each(function(){c=a(this).val()});b.post_type=c;a.ajax({type:"POST",url:ajaxurl,data:b,success:function(d){findPosts.show(d)},error:function(d){findPosts.error(d)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/nav-menu.dev.js b/wp-admin/js/nav-menu.dev.js
new file mode 100644 (file)
index 0000000..2df0a8d
--- /dev/null
@@ -0,0 +1,953 @@
+/**
+ * WordPress Administration Navigation Menu
+ * Interface JS functions
+ *
+ * @version 2.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+var wpNavMenu;
+
+(function($) {
+
+       var api = wpNavMenu = {
+
+               options : {
+                       menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead.
+                       globalMaxDepth : 11
+               },
+
+               menuList : undefined,   // Set in init.
+               targetList : undefined, // Set in init.
+               menusChanged : false,
+               isRTL: !! ( 'undefined' != typeof isRtl && isRtl ),
+               negateIfRTL: ( 'undefined' != typeof isRtl && isRtl ) ? -1 : 1,
+
+               // Functions that run on init.
+               init : function() {
+                       api.menuList = $('#menu-to-edit');
+                       api.targetList = api.menuList;
+
+                       this.jQueryExtensions();
+
+                       this.attachMenuEditListeners();
+
+                       this.setupInputWithDefaultTitle();
+                       this.attachQuickSearchListeners();
+                       this.attachThemeLocationsListeners();
+
+                       this.attachTabsPanelListeners();
+
+                       this.attachUnsavedChangesListener();
+
+                       if( api.menuList.length ) // If no menu, we're in the + tab.
+                               this.initSortables();
+
+                       this.initToggles();
+
+                       this.initTabManager();
+               },
+
+               jQueryExtensions : function() {
+                       // jQuery extensions
+                       $.fn.extend({
+                               menuItemDepth : function() {
+                                       var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left');
+                                       return api.pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 );
+                               },
+                               updateDepthClass : function(current, prev) {
+                                       return this.each(function(){
+                                               var t = $(this);
+                                               prev = prev || t.menuItemDepth();
+                                               $(this).removeClass('menu-item-depth-'+ prev )
+                                                       .addClass('menu-item-depth-'+ current );
+                                       });
+                               },
+                               shiftDepthClass : function(change) {
+                                       return this.each(function(){
+                                               var t = $(this),
+                                                       depth = t.menuItemDepth();
+                                               $(this).removeClass('menu-item-depth-'+ depth )
+                                                       .addClass('menu-item-depth-'+ (depth + change) );
+                                       });
+                               },
+                               childMenuItems : function() {
+                                       var result = $();
+                                       this.each(function(){
+                                               var t = $(this), depth = t.menuItemDepth(), next = t.next();
+                                               while( next.length && next.menuItemDepth() > depth ) {
+                                                       result = result.add( next );
+                                                       next = next.next();
+                                               }
+                                       });
+                                       return result;
+                               },
+                               updateParentMenuItemDBId : function() {
+                                       return this.each(function(){
+                                               var item = $(this),
+                                                       input = item.find('.menu-item-data-parent-id'),
+                                                       depth = item.menuItemDepth(),
+                                                       parent = item.prev();
+
+                                               if( depth == 0 ) { // Item is on the top level, has no parent
+                                                       input.val(0);
+                                               } else { // Find the parent item, and retrieve its object id.
+                                                       while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) )
+                                                               parent = parent.prev();
+                                                       input.val( parent.find('.menu-item-data-db-id').val() );
+                                               }
+                                       });
+                               },
+                               hideAdvancedMenuItemFields : function() {
+                                       return this.each(function(){
+                                               var that = $(this);
+                                               $('.hide-column-tog').not(':checked').each(function(){
+                                                       that.find('.field-' + $(this).val() ).addClass('hidden-field');
+                                               });
+                                       });
+                               },
+                               /**
+                                * Adds selected menu items to the menu.
+                                *
+                                * @param jQuery metabox The metabox jQuery object.
+                                */
+                               addSelectedToMenu : function(processMethod) {
+                                       if ( 0 == $('#menu-to-edit').length ) {
+                                               return false;
+                                       }
+
+                                       return this.each(function() {
+                                               var t = $(this), menuItems = {},
+                                                       checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'),
+                                                       re = new RegExp('menu-item\\[(\[^\\]\]*)');
+
+                                               processMethod = processMethod || api.addMenuItemToBottom;
+
+                                               // If no items are checked, bail.
+                                               if ( !checkboxes.length )
+                                                       return false;
+
+                                               // Show the ajax spinner
+                                               t.find('img.waiting').show();
+
+                                               // Retrieve menu item data
+                                               $(checkboxes).each(function(){
+                                                       var t = $(this),
+                                                               listItemDBIDMatch = re.exec( t.attr('name') ),
+                                                               listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10);
+                                                       if ( this.className && -1 != this.className.indexOf('add-to-top') )
+                                                               processMethod = api.addMenuItemToTop;
+                                                       menuItems[listItemDBID] = t.closest('li').getItemData( 'add-menu-item', listItemDBID );
+                                               });
+
+                                               // Add the items
+                                               api.addItemToMenu(menuItems, processMethod, function(){
+                                                       // Deselect the items and hide the ajax spinner
+                                                       checkboxes.removeAttr('checked');
+                                                       t.find('img.waiting').hide();
+                                               });
+                                       });
+                               },
+                               getItemData : function( itemType, id ) {
+                                       itemType = itemType || 'menu-item';
+
+                                       var itemData = {}, i,
+                                       fields = [
+                                               'menu-item-db-id',
+                                               'menu-item-object-id',
+                                               'menu-item-object',
+                                               'menu-item-parent-id',
+                                               'menu-item-position',
+                                               'menu-item-type',
+                                               'menu-item-title',
+                                               'menu-item-url',
+                                               'menu-item-description',
+                                               'menu-item-attr-title',
+                                               'menu-item-target',
+                                               'menu-item-classes',
+                                               'menu-item-xfn'
+                                       ];
+
+                                       if( !id && itemType == 'menu-item' ) {
+                                               id = this.find('.menu-item-data-db-id').val();
+                                       }
+
+                                       if( !id ) return itemData;
+
+                                       this.find('input').each(function() {
+                                               var field;
+                                               i = fields.length;
+                                               while ( i-- ) {
+                                                       if( itemType == 'menu-item' )
+                                                               field = fields[i] + '[' + id + ']';
+                                                       else if( itemType == 'add-menu-item' )
+                                                               field = 'menu-item[' + id + '][' + fields[i] + ']';
+
+                                                       if (
+                                                               this.name &&
+                                                               field == this.name
+                                                       ) {
+                                                               itemData[fields[i]] = this.value;
+                                                       }
+                                               }
+                                       });
+
+                                       return itemData;
+                               },
+                               setItemData : function( itemData, itemType, id ) { // Can take a type, such as 'menu-item', or an id.
+                                       itemType = itemType || 'menu-item';
+
+                                       if( !id && itemType == 'menu-item' ) {
+                                               id = $('.menu-item-data-db-id', this).val();
+                                       }
+
+                                       if( !id ) return this;
+
+                                       this.find('input').each(function() {
+                                               var t = $(this), field;
+                                               $.each( itemData, function( attr, val ) {
+                                                       if( itemType == 'menu-item' )
+                                                               field = attr + '[' + id + ']';
+                                                       else if( itemType == 'add-menu-item' )
+                                                               field = 'menu-item[' + id + '][' + attr + ']';
+
+                                                       if ( field == t.attr('name') ) {
+                                                               t.val( val );
+                                                       }
+                                               });
+                                       });
+                                       return this;
+                               }
+                       });
+               },
+
+               initToggles : function() {
+                       // init postboxes
+                       postboxes.add_postbox_toggles('nav-menus');
+
+                       // adjust columns functions for menus UI
+                       columns.useCheckboxesForHidden();
+                       columns.checked = function(field) {
+                               $('.field-' + field).removeClass('hidden-field');
+                       }
+                       columns.unchecked = function(field) {
+                               $('.field-' + field).addClass('hidden-field');
+                       }
+                       // hide fields
+                       api.menuList.hideAdvancedMenuItemFields();
+               },
+
+               initSortables : function() {
+                       var currentDepth = 0, originalDepth, minDepth, maxDepth,
+                               prev, next, prevBottom, nextThreshold, helperHeight, transport,
+                               menuEdge = api.menuList.offset().left,
+                               body = $('body'), maxChildDepth,
+                               menuMaxDepth = initialMenuMaxDepth();
+
+                       // Use the right edge if RTL.
+                       menuEdge += api.isRTL ? api.menuList.width() : 0;
+
+                       api.menuList.sortable({
+                               handle: '.menu-item-handle',
+                               placeholder: 'sortable-placeholder',
+                               start: function(e, ui) {
+                                       var height, width, parent, children, tempHolder;
+
+                                       // handle placement for rtl orientation
+                                       if ( api.isRTL )
+                                               ui.item[0].style.right = 'auto';
+
+                                       transport = ui.item.children('.menu-item-transport');
+
+                                       // Set depths. currentDepth must be set before children are located.
+                                       originalDepth = ui.item.menuItemDepth();
+                                       updateCurrentDepth(ui, originalDepth);
+
+                                       // Attach child elements to parent
+                                       // Skip the placeholder
+                                       parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item;
+                                       children = parent.childMenuItems();
+                                       transport.append( children );
+
+                                       // Update the height of the placeholder to match the moving item.
+                                       height = transport.outerHeight();
+                                       // If there are children, account for distance between top of children and parent
+                                       height += ( height > 0 ) ? (ui.placeholder.css('margin-top').slice(0, -2) * 1) : 0;
+                                       height += ui.helper.outerHeight();
+                                       helperHeight = height;
+                                       height -= 2; // Subtract 2 for borders
+                                       ui.placeholder.height(height);
+
+                                       // Update the width of the placeholder to match the moving item.
+                                       maxChildDepth = originalDepth;
+                                       children.each(function(){
+                                               var depth = $(this).menuItemDepth();
+                                               maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth;
+                                       });
+                                       width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width
+                                       width += api.depthToPx(maxChildDepth - originalDepth); // Account for children
+                                       width -= 2; // Subtract 2 for borders
+                                       ui.placeholder.width(width);
+
+                                       // Update the list of menu items.
+                                       tempHolder = ui.placeholder.next();
+                                       tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder
+                                       ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item
+                                       $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know.
+                                       ui.item.after( ui.placeholder ); // reattach the placeholder.
+                                       tempHolder.css('margin-top', 0); // reset the margin
+
+                                       // Now that the element is complete, we can update...
+                                       updateSharedVars(ui);
+                               },
+                               stop: function(e, ui) {
+                                       var children, depthChange = currentDepth - originalDepth;
+
+                                       // Return child elements to the list
+                                       children = transport.children().insertAfter(ui.item);
+
+                                       // Update depth classes
+                                       if( depthChange != 0 ) {
+                                               ui.item.updateDepthClass( currentDepth );
+                                               children.shiftDepthClass( depthChange );
+                                               updateMenuMaxDepth( depthChange );
+                                       }
+                                       // Register a change
+                                       api.registerChange();
+                                       // Update the item data.
+                                       ui.item.updateParentMenuItemDBId();
+
+                                       // address sortable's incorrectly-calculated top in opera
+                                       ui.item[0].style.top = 0;
+
+                                       // handle drop placement for rtl orientation
+                                       if ( api.isRTL ) {
+                                               ui.item[0].style.left = 'auto';
+                                               ui.item[0].style.right = 0;
+                                       }
+
+                                       // The width of the tab bar might have changed. Just in case.
+                                       api.refreshMenuTabs( true );
+                               },
+                               change: function(e, ui) {
+                                       // Make sure the placeholder is inside the menu.
+                                       // Otherwise fix it, or we're in trouble.
+                                       if( ! ui.placeholder.parent().hasClass('menu') )
+                                               (prev.length) ? prev.after( ui.placeholder ) : api.menuList.prepend( ui.placeholder );
+
+                                       updateSharedVars(ui);
+                               },
+                               sort: function(e, ui) {
+                                       var offset = ui.helper.offset(),
+                                               edge = api.isRTL ? offset.left + ui.helper.width() : offset.left,
+                                               depth = api.negateIfRTL * api.pxToDepth( edge - menuEdge );
+                                       // Check and correct if depth is not within range.
+                                       // Also, if the dragged element is dragged upwards over
+                                       // an item, shift the placeholder to a child position.
+                                       if ( depth > maxDepth || offset.top < prevBottom ) depth = maxDepth;
+                                       else if ( depth < minDepth ) depth = minDepth;
+
+                                       if( depth != currentDepth )
+                                               updateCurrentDepth(ui, depth);
+
+                                       // If we overlap the next element, manually shift downwards
+                                       if( nextThreshold && offset.top + helperHeight > nextThreshold ) {
+                                               next.after( ui.placeholder );
+                                               updateSharedVars( ui );
+                                               $(this).sortable( "refreshPositions" );
+                                       }
+                               }
+                       });
+
+                       function updateSharedVars(ui) {
+                               var depth;
+
+                               prev = ui.placeholder.prev();
+                               next = ui.placeholder.next();
+
+                               // Make sure we don't select the moving item.
+                               if( prev[0] == ui.item[0] ) prev = prev.prev();
+                               if( next[0] == ui.item[0] ) next = next.next();
+
+                               prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0;
+                               nextThreshold = (next.length) ? next.offset().top + next.height() / 3 : 0;
+                               minDepth = (next.length) ? next.menuItemDepth() : 0;
+
+                               if( prev.length )
+                                       maxDepth = ( (depth = prev.menuItemDepth() + 1) > api.options.globalMaxDepth ) ? api.options.globalMaxDepth : depth;
+                               else
+                                       maxDepth = 0;
+                       }
+
+                       function updateCurrentDepth(ui, depth) {
+                               ui.placeholder.updateDepthClass( depth, currentDepth );
+                               currentDepth = depth;
+                       }
+
+                       function initialMenuMaxDepth() {
+                               if( ! body[0].className ) return 0;
+                               var match = body[0].className.match(/menu-max-depth-(\d+)/);
+                               return match && match[1] ? parseInt(match[1]) : 0;
+                       }
+
+                       function updateMenuMaxDepth( depthChange ) {
+                               var depth, newDepth = menuMaxDepth;
+                               if ( depthChange === 0 ) {
+                                       return;
+                               } else if ( depthChange > 0 ) {
+                                       depth = maxChildDepth + depthChange;
+                                       if( depth > menuMaxDepth )
+                                               newDepth = depth;
+                               } else if ( depthChange < 0 && maxChildDepth == menuMaxDepth ) {
+                                       while( ! $('.menu-item-depth-' + newDepth, api.menuList).length && newDepth > 0 )
+                                               newDepth--;
+                               }
+                               // Update the depth class.
+                               body.removeClass( 'menu-max-depth-' + menuMaxDepth ).addClass( 'menu-max-depth-' + newDepth );
+                               menuMaxDepth = newDepth;
+                       }
+               },
+
+               attachMenuEditListeners : function() {
+                       var that = this;
+                       $('#update-nav-menu').bind('click', function(e) {
+                               if ( e.target && e.target.className ) {
+                                       if ( -1 != e.target.className.indexOf('item-edit') ) {
+                                               return that.eventOnClickEditLink(e.target);
+                                       } else if ( -1 != e.target.className.indexOf('menu-save') ) {
+                                               return that.eventOnClickMenuSave(e.target);
+                                       } else if ( -1 != e.target.className.indexOf('menu-delete') ) {
+                                               return that.eventOnClickMenuDelete(e.target);
+                                       } else if ( -1 != e.target.className.indexOf('item-delete') ) {
+                                               return that.eventOnClickMenuItemDelete(e.target);
+                                       } else if ( -1 != e.target.className.indexOf('item-cancel') ) {
+                                               return that.eventOnClickCancelLink(e.target);
+                                       }
+                               }
+                       });
+               },
+
+               /**
+                * An interface for managing default values for input elements
+                * that is both JS and accessibility-friendly.
+                *
+                * Input elements that add the class 'input-with-default-title'
+                * will have their values set to the provided HTML title when empty.
+                */
+               setupInputWithDefaultTitle : function() {
+                       var name = 'input-with-default-title';
+
+                       $('.' + name).each( function(){
+                               var $t = $(this), title = $t.attr('title'), val = $t.val();
+                               $t.data( name, title );
+
+                               if( '' == val ) $t.val( title );
+                               else if ( title == val ) return;
+                               else $t.removeClass( name );
+                       }).focus( function(){
+                               var $t = $(this);
+                               if( $t.val() == $t.data(name) )
+                                       $t.val('').removeClass( name );
+                       }).blur( function(){
+                               var $t = $(this);
+                               if( '' == $t.val() )
+                                       $t.addClass( name ).val( $t.data(name) );
+                       });
+               },
+
+               attachThemeLocationsListeners : function() {
+                       var loc = $('#nav-menu-theme-locations'), params = {};
+                       params['action'] = 'menu-locations-save';
+                       params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val();
+                       loc.find('input[type=submit]').click(function() {
+                               loc.find('select').each(function() {
+                                       params[this.name] = $(this).val();
+                               });
+                               loc.find('.waiting').show();
+                               $.post( ajaxurl, params, function(r) {
+                                       loc.find('.waiting').hide();
+                               });
+                               return false;
+                       });
+               },
+
+               attachQuickSearchListeners : function() {
+                       var searchTimer;
+
+                       $('.quick-search').keypress(function(e){
+                               var t = $(this);
+
+                               if( 13 == e.which ) {
+                                       api.updateQuickSearchResults( t );
+                                       return false;
+                               }
+
+                               if( searchTimer ) clearTimeout(searchTimer);
+
+                               searchTimer = setTimeout(function(){
+                                       api.updateQuickSearchResults( t );
+                               }, 400);
+                       }).attr('autocomplete','off');
+               },
+
+               updateQuickSearchResults : function(input) {
+                       var panel, params,
+                       minSearchLength = 2,
+                       q = input.val();
+
+                       if( q.length < minSearchLength ) return;
+
+                       panel = input.parents('.tabs-panel');
+                       params = {
+                               'action': 'menu-quick-search',
+                               'response-format': 'markup',
+                               'menu': $('#menu').val(),
+                               'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(),
+                               'q': q,
+                               'type': input.attr('name')
+                       };
+
+                       $('img.waiting', panel).show();
+
+                       $.post( ajaxurl, params, function(menuMarkup) {
+                               api.processQuickSearchQueryResponse(menuMarkup, params, panel);
+                       });
+               },
+
+               addCustomLink : function( processMethod ) {
+                       var url = $('#custom-menu-item-url').val(),
+                               label = $('#custom-menu-item-name').val();
+
+                       processMethod = processMethod || api.addMenuItemToBottom;
+
+                       if ( '' == url || 'http://' == url )
+                               return false;
+
+                       // Show the ajax spinner
+                       $('.customlinkdiv img.waiting').show();
+                       this.addLinkToMenu( url, label, processMethod, function() {
+                               // Remove the ajax spinner
+                               $('.customlinkdiv img.waiting').hide();
+                               // Set custom link form back to defaults
+                               $('#custom-menu-item-name').val('').blur();
+                               $('#custom-menu-item-url').val('http://');
+                       });
+               },
+
+               addLinkToMenu : function(url, label, processMethod, callback) {
+                       processMethod = processMethod || api.addMenuItemToBottom;
+                       callback = callback || function(){};
+
+                       api.addItemToMenu({
+                               '-1': {
+                                       'menu-item-type': 'custom',
+                                       'menu-item-url': url,
+                                       'menu-item-title': label
+                               }
+                       }, processMethod, callback);
+               },
+
+               addItemToMenu : function(menuItem, processMethod, callback) {
+                       var menu = $('#menu').val(),
+                               nonce = $('#menu-settings-column-nonce').val();
+
+                       processMethod = processMethod || function(){};
+                       callback = callback || function(){};
+
+                       params = {
+                               'action': 'add-menu-item',
+                               'menu': menu,
+                               'menu-settings-column-nonce': nonce,
+                               'menu-item': menuItem
+                       };
+
+                       $.post( ajaxurl, params, function(menuMarkup) {
+                               var ins = $('#menu-instructions');
+                               processMethod(menuMarkup, params);
+                               if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length )
+                                       ins.addClass('menu-instructions-inactive');
+                               callback();
+                       });
+               },
+
+               /**
+                * Process the add menu item request response into menu list item.
+                *
+                * @param string menuMarkup The text server response of menu item markup.
+                * @param object req The request arguments.
+                */
+               addMenuItemToBottom : function( menuMarkup, req ) {
+                       $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
+               },
+
+               addMenuItemToTop : function( menuMarkup, req ) {
+                       $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
+               },
+
+               attachUnsavedChangesListener : function() {
+                       $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){
+                               api.registerChange();
+                       });
+
+                       if ( 0 != $('#menu-to-edit').length ) {
+                               window.onbeforeunload = function(){
+                                       if ( api.menusChanged )
+                                               return navMenuL10n.saveAlert;
+                               };
+                       } else {
+                               // Make the post boxes read-only, as they can't be used yet
+                               $('#menu-settings-column').find('input,select').attr('disabled', 'disabled').end().find('a').attr('href', '#').unbind('click');
+                       }
+               },
+
+               registerChange : function() {
+                       api.menusChanged = true;
+               },
+
+               attachTabsPanelListeners : function() {
+                       $('#menu-settings-column').bind('click', function(e) {
+                               var selectAreaMatch, panelId, wrapper, items,
+                                       target = $(e.target);
+
+                               if ( target.hasClass('nav-tab-link') ) {
+                                       panelId = /#(.*)$/.exec(e.target.href);
+                                       if ( panelId && panelId[1] )
+                                               panelId = panelId[1]
+                                       else
+                                               return false;
+
+                                       wrapper = target.parents('.inside').first();
+
+                                       // upon changing tabs, we want to uncheck all checkboxes
+                                       $('input', wrapper).removeAttr('checked');
+
+                                       $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive');
+                                       $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active');
+
+                                       $('.tabs', wrapper).removeClass('tabs');
+                                       target.parent().addClass('tabs');
+
+                                       // select the search bar
+                                       $('.quick-search', wrapper).focus();
+
+                                       return false;
+                               } else if ( target.hasClass('select-all') ) {
+                                       selectAreaMatch = /#(.*)$/.exec(e.target.href);
+                                       if ( selectAreaMatch && selectAreaMatch[1] ) {
+                                               items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input');
+                                               if( items.length === items.filter(':checked').length )
+                                                       items.removeAttr('checked');
+                                               else
+                                                       items.attr('checked', 'checked');
+                                               return false;
+                                       }
+                               } else if ( target.hasClass('submit-add-to-menu') ) {
+                                       api.registerChange();
+
+                                       if ( e.target.id && 'submit-customlinkdiv' == e.target.id )
+                                               api.addCustomLink( api.addMenuItemToBottom );
+                                       else if ( e.target.id && -1 != e.target.id.indexOf('submit-') )
+                                               $('#' + e.target.id.replace(/submit-/, '')).addSelectedToMenu( api.addMenuItemToBottom );
+                                       return false;
+                               } else if ( target.hasClass('page-numbers') ) {
+                                       $.post( ajaxurl, e.target.href.replace(/.*\?/, '').replace(/action=([^&]*)/, '') + '&action=menu-get-metabox',
+                                               function( resp ) {
+                                                       if ( -1 == resp.indexOf('replace-id') )
+                                                               return;
+
+                                                       var metaBoxData = $.parseJSON(resp),
+                                                       toReplace = document.getElementById(metaBoxData['replace-id']),
+                                                       placeholder = document.createElement('div'),
+                                                       wrap = document.createElement('div');
+
+                                                       if ( ! metaBoxData['markup'] || ! toReplace )
+                                                               return;
+
+                                                       wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : '';
+
+                                                       toReplace.parentNode.insertBefore( placeholder, toReplace );
+                                                       placeholder.parentNode.removeChild( toReplace );
+
+                                                       placeholder.parentNode.insertBefore( wrap, placeholder );
+
+                                                       placeholder.parentNode.removeChild( placeholder );
+
+                                               }
+                                       );
+
+                                       return false;
+                               }
+                       });
+               },
+
+               initTabManager : function() {
+                       var fixed = $('.nav-tabs-wrapper'),
+                               fluid = fixed.children('.nav-tabs'),
+                               active = fluid.children('.nav-tab-active'),
+                               tabs = fluid.children('.nav-tab'),
+                               tabsWidth = 0,
+                               fixedRight, fixedLeft,
+                               arrowLeft, arrowRight, resizeTimer, css = {},
+                               marginFluid = api.isRTL ? 'margin-right' : 'margin-left',
+                               marginFixed = api.isRTL ? 'margin-left' : 'margin-right',
+                               msPerPx = 2;
+
+                       /**
+                        * Refreshes the menu tabs.
+                        * Will show and hide arrows where necessary.
+                        * Scrolls to the active tab by default.
+                        *
+                        * @param savePosition {boolean} Optional. Prevents scrolling so
+                        *                that the current position is maintained. Default false.
+                        **/
+                       api.refreshMenuTabs = function( savePosition ) {
+                               var fixedWidth = fixed.width(),
+                                       margin = 0, css = {};
+                               fixedLeft = fixed.offset().left;
+                               fixedRight = fixedLeft + fixedWidth;
+
+                               if( !savePosition )
+                                       active.makeTabVisible();
+
+                               // Prevent space from building up next to the last tab if there's more to show
+                               if( tabs.last().isTabVisible() ) {
+                                       margin = fixed.width() - tabsWidth;
+                                       margin = margin > 0 ? 0 : margin;
+                                       css[marginFluid] = margin + 'px';
+                                       fluid.animate( css, 100, "linear" );
+                               }
+
+                               // Show the arrows only when necessary
+                               if( fixedWidth > tabsWidth )
+                                       arrowLeft.add( arrowRight ).hide();
+                               else
+                                       arrowLeft.add( arrowRight ).show();
+                       }
+
+                       $.fn.extend({
+                               makeTabVisible : function() {
+                                       var t = this.eq(0), left, right, css = {}, shift = 0;
+
+                                       if( ! t.length ) return this;
+
+                                       left = t.offset().left;
+                                       right = left + t.outerWidth();
+
+                                       if( right > fixedRight )
+                                               shift = fixedRight - right;
+                                       else if ( left < fixedLeft )
+                                               shift = fixedLeft - left;
+
+                                       if( ! shift ) return this;
+
+                                       css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px';
+                                       fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" );
+                                       return this;
+                               },
+                               isTabVisible : function() {
+                                       var t = this.eq(0),
+                                               left = t.offset().left,
+                                               right = left + t.outerWidth();
+                                       return ( right <= fixedRight && left >= fixedLeft ) ? true : false;
+                               }
+                       });
+
+                       // Find the width of all tabs
+                       tabs.each(function(){
+                               tabsWidth += $(this).outerWidth(true);
+                       });
+
+                       // Set up fixed margin for overflow, unset padding
+                       css['padding'] = 0;
+                       css[marginFixed] = (-1 * tabsWidth) + 'px';
+                       fluid.css( css );
+
+                       // Build tab navigation
+                       arrowLeft = $('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');
+                       arrowRight = $('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');
+                       // Attach to the document
+                       fixed.wrap('<div class="nav-tabs-nav"/>').parent().prepend( arrowLeft ).append( arrowRight );
+
+                       // Set the menu tabs
+                       api.refreshMenuTabs();
+                       // Make sure the tabs reset on resize
+                       $(window).resize(function() {
+                               if( resizeTimer ) clearTimeout(resizeTimer);
+                               resizeTimer = setTimeout( api.refreshMenuTabs, 200);
+                       });
+
+                       // Build arrow functions
+                       $.each([{
+                                       arrow : arrowLeft,
+                                       next : "next",
+                                       last : "first",
+                                       operator : "+="
+                               },{
+                                       arrow : arrowRight,
+                                       next : "prev",
+                                       last : "last",
+                                       operator : "-="
+                               }], function(){
+                               var that = this;
+                               this.arrow.mousedown(function(){
+                                       var marginFluidVal = Math.abs( parseInt( fluid.css(marginFluid) ) ),
+                                               shift = marginFluidVal,
+                                               css = {};
+
+                                       if( "-=" == that.operator )
+                                               shift = Math.abs( tabsWidth - fixed.width() ) - marginFluidVal;
+
+                                       if( ! shift ) return;
+
+                                       css[marginFluid] = that.operator + shift + 'px';
+                                       fluid.animate( css, shift * msPerPx, "linear" );
+                               }).mouseup(function(){
+                                       var tab, next;
+                                       fluid.stop(true);
+                                       tab = tabs[that.last]();
+                                       while( (next = tab[that.next]()) && next.length && ! next.isTabVisible() ) {
+                                               tab = next;
+                                       }
+                                       tab.makeTabVisible();
+                               });
+                       });
+               },
+
+               eventOnClickEditLink : function(clickedEl) {
+                       var settings, item,
+                       matchedSection = /#(.*)$/.exec(clickedEl.href);
+                       if ( matchedSection && matchedSection[1] ) {
+                               settings = $('#'+matchedSection[1]);
+                               item = settings.parent();
+                               if( 0 != item.length ) {
+                                       if( item.hasClass('menu-item-edit-inactive') ) {
+                                               if( ! settings.data('menu-item-data') ) {
+                                                       settings.data( 'menu-item-data', settings.getItemData() );
+                                               }
+                                               settings.slideDown('fast');
+                                               item.removeClass('menu-item-edit-inactive')
+                                                       .addClass('menu-item-edit-active');
+                                       } else {
+                                               settings.slideUp('fast');
+                                               item.removeClass('menu-item-edit-active')
+                                                       .addClass('menu-item-edit-inactive');
+                                       }
+                                       return false;
+                               }
+                       }
+               },
+
+               eventOnClickCancelLink : function(clickedEl) {
+                       var settings = $(clickedEl).closest('.menu-item-settings');
+                       settings.setItemData( settings.data('menu-item-data') );
+                       return false;
+               },
+
+               eventOnClickMenuSave : function(clickedEl) {
+                       var locs = '',
+                       menuName = $('#menu-name'),
+                       menuNameVal = menuName.val();
+                       // Cancel and warn if invalid menu name
+                       if( !menuNameVal || menuNameVal == menuName.attr('title') || !menuNameVal.replace(/\s+/, '') ) {
+                               menuName.parent().addClass('form-invalid');
+                               return false;
+                       }
+                       // Copy menu theme locations
+                       $('#nav-menu-theme-locations select').each(function() {
+                               locs += '<input type="hidden" name="' + this.name + '" value="' + $(this).val() + '" />';
+                       });
+                       $('#update-nav-menu').append( locs );
+                       // Update menu item position data
+                       api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
+                       window.onbeforeunload = null;
+
+                       return true;
+               },
+
+               eventOnClickMenuDelete : function(clickedEl) {
+                       // Delete warning AYS
+                       if ( confirm( navMenuL10n.warnDeleteMenu ) ) {
+                               window.onbeforeunload = null;
+                               return true;
+                       }
+                       return false;
+               },
+
+               eventOnClickMenuItemDelete : function(clickedEl) {
+                       var itemID = parseInt(clickedEl.id.replace('delete-', ''), 10);
+                       api.removeMenuItem( $('#menu-item-' + itemID) );
+                       api.registerChange();
+                       return false;
+               },
+
+               /**
+                * Process the quick search response into a search result
+                *
+                * @param string resp The server response to the query.
+                * @param object req The request arguments.
+                * @param jQuery panel The tabs panel we're searching in.
+                */
+               processQuickSearchQueryResponse : function(resp, req, panel) {
+                       var i, matched, newID,
+                       takenIDs = {},
+                       form = document.getElementById('nav-menu-meta'),
+                       pattern = new RegExp('menu-item\\[(\[^\\]\]*)', 'g'),
+                       items = resp.match(/<li>.*<\/li>/g);
+
+                       if( ! items ) {
+                               $('.categorychecklist', panel).html( '<li><p>' + navMenuL10n.noResultsFound + '</p></li>' );
+                               $('img.waiting', panel).hide();
+                               return;
+                       }
+
+                       i = items.length;
+                       while( i-- ) {
+                               // make a unique DB ID number
+                               matched = pattern.exec(items[i]);
+                               if ( matched && matched[1] ) {
+                                       newID = matched[1];
+                                       while( form.elements['menu-item[' + newID + '][menu-item-type]'] || takenIDs[ newID ] ) {
+                                               newID--;
+                                       }
+
+                                       takenIDs[newID] = true;
+                                       if ( newID != matched[1] ) {
+                                               items[i] = items[i].replace(new RegExp('menu-item\\[' + matched[1] + '\\]', 'g'), 'menu-item[' + newID + ']');
+                                       }
+                               }
+                       }
+
+                       $('.categorychecklist', panel).html( items.join('') );
+                       $('img.waiting', panel).hide();
+               },
+
+               removeMenuItem : function(el) {
+                       var children = el.childMenuItems();
+
+                       el.addClass('deleting').animate({
+                                       opacity : 0,
+                                       height: 0
+                               }, 350, function() {
+                                       var ins = $('#menu-instructions');
+                                       el.remove();
+                                       children.shiftDepthClass(-1).updateParentMenuItemDBId();
+                                       if( ! ins.siblings().length )
+                                               ins.removeClass('menu-instructions-inactive');
+                               });
+               },
+
+               depthToPx : function(depth) {
+                       return depth * api.options.menuItemDepthPerLevel;
+               },
+
+               pxToDepth : function(px) {
+                       return Math.floor(px / api.options.menuItemDepthPerLevel);
+               }
+
+       };
+
+       $(document).ready(function(){ wpNavMenu.init(); });
+
+})(jQuery);
diff --git a/wp-admin/js/nav-menu.js b/wp-admin/js/nav-menu.js
new file mode 100644 (file)
index 0000000..43d2589
--- /dev/null
@@ -0,0 +1 @@
+var wpNavMenu;(function(b){var a=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:undefined,targetList:undefined,menusChanged:false,isRTL:!!("undefined"!=typeof isRtl&&isRtl),negateIfRTL:("undefined"!=typeof isRtl&&isRtl)?-1:1,init:function(){a.menuList=b("#menu-to-edit");a.targetList=a.menuList;this.jQueryExtensions();this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachQuickSearchListeners();this.attachThemeLocationsListeners();this.attachTabsPanelListeners();this.attachUnsavedChangesListener();if(a.menuList.length){this.initSortables()}this.initToggles();this.initTabManager()},jQueryExtensions:function(){b.fn.extend({menuItemDepth:function(){var c=a.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return a.pxToDepth(c&&-1!=c.indexOf("px")?c.slice(0,-2):0)},updateDepthClass:function(d,c){return this.each(function(){var e=b(this);c=c||e.menuItemDepth();b(this).removeClass("menu-item-depth-"+c).addClass("menu-item-depth-"+d)})},shiftDepthClass:function(c){return this.each(function(){var d=b(this),e=d.menuItemDepth();b(this).removeClass("menu-item-depth-"+e).addClass("menu-item-depth-"+(e+c))})},childMenuItems:function(){var c=b();this.each(function(){var d=b(this),f=d.menuItemDepth(),e=d.next();while(e.length&&e.menuItemDepth()>f){c=c.add(e);e=e.next()}});return c},updateParentMenuItemDBId:function(){return this.each(function(){var e=b(this),c=e.find(".menu-item-data-parent-id"),f=e.menuItemDepth(),d=e.prev();if(f==0){c.val(0)}else{while(!d[0]||!d[0].className||-1==d[0].className.indexOf("menu-item")||(d.menuItemDepth()!=f-1)){d=d.prev()}c.val(d.find(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var c=b(this);b(".hide-column-tog").not(":checked").each(function(){c.find(".field-"+b(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(c){if(0==b("#menu-to-edit").length){return false}return this.each(function(){var e=b(this),d={},g=e.find(".tabs-panel-active .categorychecklist li input:checked"),f=new RegExp("menu-item\\[([^\\]]*)");c=c||a.addMenuItemToBottom;if(!g.length){return false}e.find("img.waiting").show();b(g).each(function(){var i=b(this),h=f.exec(i.attr("name")),j="undefined"==typeof h[1]?0:parseInt(h[1],10);if(this.className&&-1!=this.className.indexOf("add-to-top")){c=a.addMenuItemToTop}d[j]=i.closest("li").getItemData("add-menu-item",j)});a.addItemToMenu(d,c,function(){g.removeAttr("checked");e.find("img.waiting").hide()})})},getItemData:function(f,g){f=f||"menu-item";var d={},e,c=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];if(!g&&f=="menu-item"){g=this.find(".menu-item-data-db-id").val()}if(!g){return d}this.find("input").each(function(){var h;e=c.length;while(e--){if(f=="menu-item"){h=c[e]+"["+g+"]"}else{if(f=="add-menu-item"){h="menu-item["+g+"]["+c[e]+"]"}}if(this.name&&h==this.name){d[c[e]]=this.value}}});return d},setItemData:function(c,d,e){d=d||"menu-item";if(!e&&d=="menu-item"){e=b(".menu-item-data-db-id",this).val()}if(!e){return this}this.find("input").each(function(){var f=b(this),g;b.each(c,function(h,i){if(d=="menu-item"){g=h+"["+e+"]"}else{if(d=="add-menu-item"){g="menu-item["+e+"]["+h+"]"}}if(g==f.attr("name")){f.val(i)}})});return this}})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(c){b(".field-"+c).removeClass("hidden-field")};columns.unchecked=function(c){b(".field-"+c).addClass("hidden-field")};a.menuList.hideAdvancedMenuItemFields()},initSortables:function(){var p=0,e,t,d,l,o,f,c,i,s,m=a.menuList.offset().left,h=b("body"),q,n=r();m+=a.isRTL?a.menuList.width():0;a.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(A,z){var u,x,w,v,y;if(a.isRTL){z.item[0].style.right="auto"}s=z.item.children(".menu-item-transport");e=z.item.menuItemDepth();j(z,e);w=(z.item.next()[0]==z.placeholder[0])?z.item.next():z.item;v=w.childMenuItems();s.append(v);u=s.outerHeight();u+=(u>0)?(z.placeholder.css("margin-top").slice(0,-2)*1):0;u+=z.helper.outerHeight();i=u;u-=2;z.placeholder.height(u);q=e;v.each(function(){var B=b(this).menuItemDepth();q=(B>q)?B:q});x=z.helper.find(".menu-item-handle").outerWidth();x+=a.depthToPx(q-e);x-=2;z.placeholder.width(x);y=z.placeholder.next();y.css("margin-top",i+"px");z.placeholder.detach();b(this).sortable("refresh");z.item.after(z.placeholder);y.css("margin-top",0);k(z)},stop:function(x,w){var v,u=p-e;v=s.children().insertAfter(w.item);if(u!=0){w.item.updateDepthClass(p);v.shiftDepthClass(u);g(u)}a.registerChange();w.item.updateParentMenuItemDBId();w.item[0].style.top=0;if(a.isRTL){w.item[0].style.left="auto";w.item[0].style.right=0}a.refreshMenuTabs(true)},change:function(v,u){if(!u.placeholder.parent().hasClass("menu")){(l.length)?l.after(u.placeholder):a.menuList.prepend(u.placeholder)}k(u)},sort:function(w,v){var y=v.helper.offset(),u=a.isRTL?y.left+v.helper.width():y.left,x=a.negateIfRTL*a.pxToDepth(u-m);if(x>d||y.top<f){x=d}else{if(x<t){x=t}}if(x!=p){j(v,x)}if(c&&y.top+i>c){o.after(v.placeholder);k(v);b(this).sortable("refreshPositions")}}});function k(u){var v;l=u.placeholder.prev();o=u.placeholder.next();if(l[0]==u.item[0]){l=l.prev()}if(o[0]==u.item[0]){o=o.next()}f=(l.length)?l.offset().top+l.height():0;c=(o.length)?o.offset().top+o.height()/3:0;t=(o.length)?o.menuItemDepth():0;if(l.length){d=((v=l.menuItemDepth()+1)>a.options.globalMaxDepth)?a.options.globalMaxDepth:v}else{d=0}}function j(u,v){u.placeholder.updateDepthClass(v,p);p=v}function r(){if(!h[0].className){return 0}var u=h[0].className.match(/menu-max-depth-(\d+)/);return u&&u[1]?parseInt(u[1]):0}function g(u){var v,w=n;if(u===0){return}else{if(u>0){v=q+u;if(v>n){w=v}}else{if(u<0&&q==n){while(!b(".menu-item-depth-"+w,a.menuList).length&&w>0){w--}}}}h.removeClass("menu-max-depth-"+n).addClass("menu-max-depth-"+w);n=w}},attachMenuEditListeners:function(){var c=this;b("#update-nav-menu").bind("click",function(d){if(d.target&&d.target.className){if(-1!=d.target.className.indexOf("item-edit")){return c.eventOnClickEditLink(d.target)}else{if(-1!=d.target.className.indexOf("menu-save")){return c.eventOnClickMenuSave(d.target)}else{if(-1!=d.target.className.indexOf("menu-delete")){return c.eventOnClickMenuDelete(d.target)}else{if(-1!=d.target.className.indexOf("item-delete")){return c.eventOnClickMenuItemDelete(d.target)}else{if(-1!=d.target.className.indexOf("item-cancel")){return c.eventOnClickCancelLink(d.target)}}}}}}})},setupInputWithDefaultTitle:function(){var c="input-with-default-title";b("."+c).each(function(){var f=b(this),e=f.attr("title"),d=f.val();f.data(c,e);if(""==d){f.val(e)}else{if(e==d){return}else{f.removeClass(c)}}}).focus(function(){var d=b(this);if(d.val()==d.data(c)){d.val("").removeClass(c)}}).blur(function(){var d=b(this);if(""==d.val()){d.addClass(c).val(d.data(c))}})},attachThemeLocationsListeners:function(){var d=b("#nav-menu-theme-locations"),c={};c.action="menu-locations-save";c["menu-settings-column-nonce"]=b("#menu-settings-column-nonce").val();d.find("input[type=submit]").click(function(){d.find("select").each(function(){c[this.name]=b(this).val()});d.find(".waiting").show();b.post(ajaxurl,c,function(e){d.find(".waiting").hide()});return false})},attachQuickSearchListeners:function(){var c;b(".quick-search").keypress(function(f){var d=b(this);if(13==f.which){a.updateQuickSearchResults(d);return false}if(c){clearTimeout(c)}c=setTimeout(function(){a.updateQuickSearchResults(d)},400)}).attr("autocomplete","off")},updateQuickSearchResults:function(d){var c,g,e=2,f=d.val();if(f.length<e){return}c=d.parents(".tabs-panel");g={action:"menu-quick-search","response-format":"markup",menu:b("#menu").val(),"menu-settings-column-nonce":b("#menu-settings-column-nonce").val(),q:f,type:d.attr("name")};b("img.waiting",c).show();b.post(ajaxurl,g,function(h){a.processQuickSearchQueryResponse(h,g,c)})},addCustomLink:function(c){var e=b("#custom-menu-item-url").val(),d=b("#custom-menu-item-name").val();c=c||a.addMenuItemToBottom;if(""==e||"http://"==e){return false}b(".customlinkdiv img.waiting").show();this.addLinkToMenu(e,d,c,function(){b(".customlinkdiv img.waiting").hide();b("#custom-menu-item-name").val("").blur();b("#custom-menu-item-url").val("http://")})},addLinkToMenu:function(e,d,c,f){c=c||a.addMenuItemToBottom;f=f||function(){};a.addItemToMenu({"-1":{"menu-item-type":"custom","menu-item-url":e,"menu-item-title":d}},c,f)},addItemToMenu:function(e,c,g){var f=b("#menu").val(),d=b("#menu-settings-column-nonce").val();c=c||function(){};g=g||function(){};params={action:"add-menu-item",menu:f,"menu-settings-column-nonce":d,"menu-item":e};b.post(ajaxurl,params,function(h){var i=b("#menu-instructions");c(h,params);if(!i.hasClass("menu-instructions-inactive")&&i.siblings().length){i.addClass("menu-instructions-inactive")}g()})},addMenuItemToBottom:function(c,d){b(c).hideAdvancedMenuItemFields().appendTo(a.targetList)},addMenuItemToTop:function(c,d){b(c).hideAdvancedMenuItemFields().prependTo(a.targetList)},attachUnsavedChangesListener:function(){b("#menu-management input, #menu-management select, #menu-management, #menu-management textarea").change(function(){a.registerChange()});if(0!=b("#menu-to-edit").length){window.onbeforeunload=function(){if(a.menusChanged){return navMenuL10n.saveAlert}}}else{b("#menu-settings-column").find("input,select").attr("disabled","disabled").end().find("a").attr("href","#").unbind("click")}},registerChange:function(){a.menusChanged=true},attachTabsPanelListeners:function(){b("#menu-settings-column").bind("click",function(h){var f,d,i,c,g=b(h.target);if(g.hasClass("nav-tab-link")){d=/#(.*)$/.exec(h.target.href);if(d&&d[1]){d=d[1]}else{return false}i=g.parents(".inside").first();b("input",i).removeAttr("checked");b(".tabs-panel-active",i).removeClass("tabs-panel-active").addClass("tabs-panel-inactive");b("#"+d,i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active");b(".tabs",i).removeClass("tabs");g.parent().addClass("tabs");b(".quick-search",i).focus();return false}else{if(g.hasClass("select-all")){f=/#(.*)$/.exec(h.target.href);if(f&&f[1]){c=b("#"+f[1]+" .tabs-panel-active .menu-item-title input");if(c.length===c.filter(":checked").length){c.removeAttr("checked")}else{c.attr("checked","checked")}return false}}else{if(g.hasClass("submit-add-to-menu")){a.registerChange();if(h.target.id&&"submit-customlinkdiv"==h.target.id){a.addCustomLink(a.addMenuItemToBottom)}else{if(h.target.id&&-1!=h.target.id.indexOf("submit-")){b("#"+h.target.id.replace(/submit-/,"")).addSelectedToMenu(a.addMenuItemToBottom)}}return false}else{if(g.hasClass("page-numbers")){b.post(ajaxurl,h.target.href.replace(/.*\?/,"").replace(/action=([^&]*)/,"")+"&action=menu-get-metabox",function(m){if(-1==m.indexOf("replace-id")){return}var l=b.parseJSON(m),e=document.getElementById(l["replace-id"]),k=document.createElement("div"),j=document.createElement("div");if(!l.markup||!e){return}j.innerHTML=l.markup?l.markup:"";e.parentNode.insertBefore(k,e);k.parentNode.removeChild(e);k.parentNode.insertBefore(j,k);k.parentNode.removeChild(k)});return false}}}}})},initTabManager:function(){var h=b(".nav-tabs-wrapper"),j=h.children(".nav-tabs"),g=j.children(".nav-tab-active"),m=j.children(".nav-tab"),e=0,o,f,l,d,k,i={},c=a.isRTL?"margin-right":"margin-left",p=a.isRTL?"margin-left":"margin-right",n=2;a.refreshMenuTabs=function(q){var t=h.width(),s=0,r={};f=h.offset().left;o=f+t;if(!q){g.makeTabVisible()}if(m.last().isTabVisible()){s=h.width()-e;s=s>0?0:s;r[c]=s+"px";j.animate(r,100,"linear")}if(t>e){l.add(d).hide()}else{l.add(d).show()}};b.fn.extend({makeTabVisible:function(){var u=this.eq(0),v,s,r={},q=0;if(!u.length){return this}v=u.offset().left;s=v+u.outerWidth();if(s>o){q=o-s}else{if(v<f){q=f-v}}if(!q){return this}r[c]="+="+a.negateIfRTL*q+"px";j.animate(r,Math.abs(q)*n,"linear");return this},isTabVisible:function(){var r=this.eq(0),s=r.offset().left,q=s+r.outerWidth();return(q<=o&&s>=f)?true:false}});m.each(function(){e+=b(this).outerWidth(true)});i.padding=0;i[p]=(-1*e)+"px";j.css(i);l=b('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');d=b('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');h.wrap('<div class="nav-tabs-nav"/>').parent().prepend(l).append(d);a.refreshMenuTabs();b(window).resize(function(){if(k){clearTimeout(k)}k=setTimeout(a.refreshMenuTabs,200)});b.each([{arrow:l,next:"next",last:"first",operator:"+="},{arrow:d,next:"prev",last:"last",operator:"-="}],function(){var q=this;this.arrow.mousedown(function(){var t=Math.abs(parseInt(j.css(c))),r=t,s={};if("-="==q.operator){r=Math.abs(e-h.width())-t}if(!r){return}s[c]=q.operator+r+"px";j.animate(s,r*n,"linear")}).mouseup(function(){var s,r;j.stop(true);s=m[q.last]();while((r=s[q.next]())&&r.length&&!r.isTabVisible()){s=r}s.makeTabVisible()})})},eventOnClickEditLink:function(d){var c,e,f=/#(.*)$/.exec(d.href);if(f&&f[1]){c=b("#"+f[1]);e=c.parent();if(0!=e.length){if(e.hasClass("menu-item-edit-inactive")){if(!c.data("menu-item-data")){c.data("menu-item-data",c.getItemData())}c.slideDown("fast");e.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{c.slideUp("fast");e.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCancelLink:function(d){var c=b(d).closest(".menu-item-settings");c.setItemData(c.data("menu-item-data"));return false},eventOnClickMenuSave:function(e){var f="",c=b("#menu-name"),d=c.val();if(!d||d==c.attr("title")||!d.replace(/\s+/,"")){c.parent().addClass("form-invalid");return false}b("#nav-menu-theme-locations select").each(function(){f+='<input type="hidden" name="'+this.name+'" value="'+b(this).val()+'" />'});b("#update-nav-menu").append(f);a.menuList.find(".menu-item-data-position").val(function(g){return g+1});window.onbeforeunload=null;return true},eventOnClickMenuDelete:function(c){if(confirm(navMenuL10n.warnDeleteMenu)){window.onbeforeunload=null;return true}return false},eventOnClickMenuItemDelete:function(c){var d=parseInt(c.id.replace("delete-",""),10);a.removeMenuItem(b("#menu-item-"+d));a.registerChange();return false},processQuickSearchQueryResponse:function(g,m,c){var h,e,j,f={},d=document.getElementById("nav-menu-meta"),l=new RegExp("menu-item\\[([^\\]]*)","g"),k=g.match(/<li>.*<\/li>/g);if(!k){b(".categorychecklist",c).html("<li><p>"+navMenuL10n.noResultsFound+"</p></li>");b("img.waiting",c).hide();return}h=k.length;while(h--){e=l.exec(k[h]);if(e&&e[1]){j=e[1];while(d.elements["menu-item["+j+"][menu-item-type]"]||f[j]){j--}f[j]=true;if(j!=e[1]){k[h]=k[h].replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+j+"]")}}}b(".categorychecklist",c).html(k.join(""));b("img.waiting",c).hide()},removeMenuItem:function(d){var c=d.childMenuItems();d.addClass("deleting").animate({opacity:0,height:0},350,function(){var e=b("#menu-instructions");d.remove();c.shiftDepthClass(-1).updateParentMenuItemDBId();if(!e.siblings().length){e.removeClass("menu-instructions-inactive")}})},depthToPx:function(c){return c*a.options.menuItemDepthPerLevel},pxToDepth:function(c){return Math.floor(c/a.options.menuItemDepthPerLevel)}};b(document).ready(function(){wpNavMenu.init()})})(jQuery);
\ No newline at end of file
index 0adb4ecc9b1e03e7e3c884205c85eaf097d68376..0f07a93785dbf34daba8af50f40dab0930b6e2a8 100644 (file)
@@ -1,21 +1,36 @@
 // Password strength meter
-function passwordStrength(password,username) {
-    var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, symbolSize = 0, natLog, score;
+function passwordStrength(password1, username, password2) {
+       var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, mismatch = 5, symbolSize = 0, natLog, score;
+
+       // password 1 != password 2
+       if ( (password1 != password2) && password2.length > 0)
+               return mismatch
 
        //password < 4
-    if (password.length < 4 ) { return shortPass };
+       if ( password1.length < 4 )
+               return shortPass
 
-    //password == username
-    if (password.toLowerCase()==username.toLowerCase()) return badPass;
+       //password1 == username
+       if ( password1.toLowerCase() == username.toLowerCase() )
+               return badPass;
 
-       if (password.match(/[0-9]/)) symbolSize +=10;
-       if (password.match(/[a-z]/)) symbolSize +=26;
-       if (password.match(/[A-Z]/)) symbolSize +=26;
-       if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31;
+       if ( password1.match(/[0-9]/) )
+               symbolSize +=10;
+       if ( password1.match(/[a-z]/) )
+               symbolSize +=26;
+       if ( password1.match(/[A-Z]/) )
+               symbolSize +=26;
+       if ( password1.match(/[^a-zA-Z0-9]/) )
+               symbolSize +=31;
 
-       natLog = Math.log( Math.pow(symbolSize,password.length) );
+       natLog = Math.log( Math.pow(symbolSize, password1.length) );
        score = natLog / Math.LN2;
-       if (score < 40 )  return badPass
-       if (score < 56 )  return goodPass
+
+       if (score < 40 )
+               return badPass
+
+       if (score < 56 )
+               return goodPass
+
     return strongPass;
 }
index f79937ec9b09111a0ab987ea876b76b002c1ce37..957d454a6e9d9151090427b42a0e1d54ed5d9150 100644 (file)
@@ -1 +1 @@
-function passwordStrength(i,f){var h=1,e=2,b=3,a=4,d=0,g,c;if(i.length<4){return h}if(i.toLowerCase()==f.toLowerCase()){return e}if(i.match(/[0-9]/)){d+=10}if(i.match(/[a-z]/)){d+=26}if(i.match(/[A-Z]/)){d+=26}if(i.match(/[^a-zA-Z0-9]/)){d+=31}g=Math.log(Math.pow(d,i.length));c=g/Math.LN2;if(c<40){return e}if(c<56){return b}return a};
\ No newline at end of file
+function passwordStrength(f,i,d){var k=1,h=2,b=3,a=4,c=5,g=0,j,e;if((f!=d)&&d.length>0){return c}if(f.length<4){return k}if(f.toLowerCase()==i.toLowerCase()){return h}if(f.match(/[0-9]/)){g+=10}if(f.match(/[a-z]/)){g+=26}if(f.match(/[A-Z]/)){g+=26}if(f.match(/[^a-zA-Z0-9]/)){g+=31}j=Math.log(Math.pow(g,f.length));e=j/Math.LN2;if(e<40){return h}if(e<56){return b}return a};
\ No newline at end of file
index fabb1aa6b1d807448e9e46ef675b9bd0f2c034f4..2cf108141b60c6c1ba7ea9d5f25fd03f394f1a9e 100644 (file)
@@ -22,6 +22,8 @@ jQuery(document).ready(function($) {
        };
 
        thickDims().click( function() {
+               tb_click.call(this);
+
                $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
                $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
                return false;
@@ -38,4 +40,8 @@ jQuery(document).ready(function($) {
                $('#section-' + tab).show();
                return false;
        });
+
+       $('#install-plugins .action-links .install-now').click( function() {
+               return confirm( plugininstallL10n.ays );
+       });
 });
index cbe0c5e26b596a40ed21cd7e8f8ae42757ec7c6a..51dc3cf1868031824ba13e52a3740e15e0c9d797 100644 (file)
@@ -1 +1 @@
-jQuery(document).ready(function(b){var a=function(){var f=b("#TB_window"),e=b(window).width(),d=b(window).height(),c=(720<e)?720:e;if(f.size()){f.width(c-50).height(d-45);b("#TB_iframeContent").width(c-50).height(d-75);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(!(b.browser.msie&&b.browser.version.substr(0,1)<7)){f.css({top:"20px","margin-top":"0"})}}return b("#dashboard_plugins a.thickbox, .plugins a.thickbox").each(function(){var g=b(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");b(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85))})};a().click(function(){b("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});b("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong>&nbsp;"+b(this).attr("title"));return false});b("#plugin-information #sidemenu a").click(function(){var c=b(this).attr("name");b("#plugin-information-header a.current").removeClass("current");b(this).addClass("current");b("#section-holder div.section").hide();b("#section-"+c).show();return false})});
\ No newline at end of file
+jQuery(document).ready(function(b){var a=function(){var f=b("#TB_window"),e=b(window).width(),d=b(window).height(),c=(720<e)?720:e;if(f.size()){f.width(c-50).height(d-45);b("#TB_iframeContent").width(c-50).height(d-75);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(!(b.browser.msie&&b.browser.version.substr(0,1)<7)){f.css({top:"20px","margin-top":"0"})}}return b("#dashboard_plugins a.thickbox, .plugins a.thickbox").each(function(){var g=b(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");b(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85))})};a().click(function(){tb_click.call(this);b("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});b("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong>&nbsp;"+b(this).attr("title"));return false});b("#plugin-information #sidemenu a").click(function(){var c=b(this).attr("name");b("#plugin-information-header a.current").removeClass("current");b(this).addClass("current");b("#section-holder div.section").hide();b("#section-"+c).show();return false});b("#install-plugins .action-links .install-now").click(function(){return confirm(plugininstallL10n.ays)})});
\ No newline at end of file
index 6621003693da347077853554560adecfcda72bb8..fb9a00f08cf757043d6299e896045115f3cdbcf1 100644 (file)
@@ -41,6 +41,8 @@ tagBox = {
                if ( !thetags.length )
                        return;
 
+               var disabled = thetags.attr('disabled');
+
                current_tags = thetags.val().split(',');
                tagchecklist.empty();
 
@@ -50,9 +52,13 @@ tagBox = {
                        val = $.trim(val);
                        if ( !val.match(/^\s+$/) && '' != val ) {
                                button_id = id + '-check-num-' + key;
-                               txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
+                               if ( disabled )
+                                       txt = '<span>' + val + '</span> ';
+                               else
+                                       txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
                                tagchecklist.append(txt);
-                               $( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
+                               if ( ! disabled )
+                                       $( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
                        }
                });
        },
@@ -107,14 +113,14 @@ tagBox = {
                });
 
                $('div.taghint', ajaxtag).click(function(){
-                       $(this).css('visibility', 'hidden').siblings('.newtag').focus();
+                       $(this).css('visibility', 'hidden').parent().siblings('.newtag').focus();
                });
 
                $('input.newtag', ajaxtag).blur(function() {
                        if ( this.value == '' )
-                   $(this).siblings('.taghint').css('visibility', '');
+                   $(this).parent().siblings('.taghint').css('visibility', '');
            }).focus(function(){
-                       $(this).siblings('.taghint').css('visibility', 'hidden');
+                       $(this).parent().siblings('.taghint').css('visibility', 'hidden');
                }).keyup(function(e){
                        if ( 13 == e.which ) {
                                tagBox.flushTags( $(this).closest('.tagsdiv') );
@@ -127,7 +133,7 @@ tagBox = {
                        }
                }).each(function(){
                        var tax = $(this).closest('div.tagsdiv').attr('id');
-                       $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+                       $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: "," } );
                });
 
            // save tags on post save/publish
@@ -212,9 +218,9 @@ WPSetThumbnailID = function(id){
        }
 };
 
-WPRemoveThumbnail = function(){
+WPRemoveThumbnail = function(nonce){
        $.post(ajaxurl, {
-               action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, cookie: encodeURIComponent(document.cookie)
+               action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
        }, function(str){
                if ( str == '0' ) {
                        alert( setPostThumbnailL10n.error );
@@ -228,13 +234,9 @@ WPRemoveThumbnail = function(){
 })(jQuery);
 
 jQuery(document).ready( function($) {
-       var catAddAfter, stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
+       var stamp, visibility, sticky = '';
 
-       // postboxes
-       if ( post )
-               postboxes.add_postbox_toggles('post');
-       else if ( page )
-               postboxes.add_postbox_toggles('page');
+       postboxes.add_postbox_toggles(pagenow);
 
        // multi-taxonomies
        if ( $('#tagsdiv-post_tag').length ) {
@@ -249,35 +251,54 @@ jQuery(document).ready( function($) {
        }
 
        // categories
-       if ( $('#categorydiv').length ) {
+       $('.categorydiv').each( function(){
+               var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, taxonomyParts, taxonomy, settingName;
+
+               taxonomyParts = this_id.split('-');
+               taxonomyParts.shift();
+               taxonomy = taxonomyParts.join('-');
+               settingName = taxonomy + '_tab';
+               if ( taxonomy == 'category' )
+                       settingName = 'cats';
+
                // TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.dev.js
-               $('a', '#category-tabs').click(function(){
+               $('a', '#' + taxonomy + '-tabs').click( function(){
                        var t = $(this).attr('href');
                        $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
-                       $('#category-tabs').siblings('.tabs-panel').hide();
+                       $('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
                        $(t).show();
-                       if ( '#categories-all' == t )
-                               deleteUserSetting('cats');
+                       if ( '#' + taxonomy + '-all' == t )
+                               deleteUserSetting(settingName);
                        else
-                               setUserSetting('cats','pop');
+                               setUserSetting(settingName, 'pop');
                        return false;
                });
-               if ( getUserSetting('cats') )
-                       $('a[href="#categories-pop"]', '#category-tabs').click();
+
+               if ( getUserSetting(settingName) )
+                       $('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
 
                // Ajax Cat
-               $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
-               $('#category-add-sumbit').click( function(){ $('#newcat').focus(); } );
+               $('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+               $('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); });
+
+               syncChecks = function() {
+                       if ( noSyncChecks )
+                               return;
+                       noSyncChecks = true;
+                       var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
+                       $('#in-' + taxonomy + '-' + id + ', #in-' + taxonomy + '-category-' + id).attr( 'checked', c );
+                       noSyncChecks = false;
+               };
 
                catAddBefore = function( s ) {
-                       if ( !$('#newcat').val() )
+                       if ( !$('#new'+taxonomy).val() )
                                return false;
-                       s.data += '&' + $( ':checked', '#categorychecklist' ).serialize();
+                       s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();
                        return s;
                };
 
                catAddAfter = function( r, s ) {
-                       var sup, drop = $('#newcat_parent');
+                       var sup, drop = $('#new'+taxonomy+'_parent');
 
                        if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
                                drop.before(sup);
@@ -285,33 +306,32 @@ jQuery(document).ready( function($) {
                        }
                };
 
-               $('#categorychecklist').wpList({
+               $('#' + taxonomy + 'checklist').wpList({
                        alt: '',
-                       response: 'category-ajax-response',
+                       response: taxonomy + '-ajax-response',
                        addBefore: catAddBefore,
                        addAfter: catAddAfter
                });
 
-               $('#category-add-toggle').click( function() {
-                       $('#category-adder').toggleClass( 'wp-hidden-children' );
-                       $('a[href="#categories-all"]', '#category-tabs').click();
+               $('#' + taxonomy + '-add-toggle').click( function() {
+                       $('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
+                       $('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
+                       $('#new'+taxonomy).focus();
                        return false;
                });
 
-               $('#categorychecklist').children('li.popular-category').add( $('#categorychecklist-pop').children() ).find(':checkbox').live( 'click', function(){
+               $('#' + taxonomy + 'checklist li.popular-category :checkbox, #' + taxonomy + 'checklist-pop :checkbox').live( 'click', function(){
                        var t = $(this), c = t.is(':checked'), id = t.val();
-                       $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+                       if ( id && t.parents('#taxonomy-'+taxonomy).length )
+                               $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).attr( 'checked', c );
                });
 
-       } // end cats
+       }); // end cats
 
        // Custom Fields
        if ( $('#postcustom').length ) {
                $('#the-list').wpList( { addAfter: function( xml, s ) {
                        $('table#list-table').show();
-                       if ( typeof( autosave_update_post_ID ) != 'undefined' ) {
-                               autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
-                       }
                }, addBefore: function( s ) {
                        s.data += '&post_id=' + $('#post_ID').val();
                        return s;
@@ -340,8 +360,8 @@ jQuery(document).ready( function($) {
                }
 
                function updateText() {
-                       var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'),
-                               optPublish = $('option[value=publish]', postStatus), aa = $('#aa').val(),
+                       var attemptedDate, originalDate, currentDate, publishOn, page = 'page' == pagenow || 'page-new' == pagenow,
+                               postStatus = $('#post_status'), optPublish = $('option[value=publish]', postStatus), aa = $('#aa').val(),
                                mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
 
                        attemptedDate = new Date( aa, mm - 1, jj, hh, mn );
@@ -448,7 +468,7 @@ jQuery(document).ready( function($) {
 
                        if ( $('input:radio:checked', pvSelect).val() != 'public' ) {
                                $('#sticky').attr('checked', false);
-                       }
+                       } // WEAPON LOCKED
 
                        if ( true == $('#sticky').attr('checked') ) {
                                sticky = 'Sticky';
@@ -519,7 +539,7 @@ jQuery(document).ready( function($) {
        // permalink
        if ( $('#edit-slug-box').length ) {
                editPermalink = function(post_id) {
-                       var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.html(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
+                       var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
 
                        $('#view-post-btn').hide();
                        b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
@@ -577,4 +597,19 @@ jQuery(document).ready( function($) {
                }
                makeSlugeditClickable();
        }
+
+       if ( $('#title').val() == '' )
+               $('#title').siblings('#title-prompt-text').css('visibility', '');
+       $('#title-prompt-text').click(function(){
+               $(this).css('visibility', 'hidden').siblings('#title').focus();
+       });
+       $('#title').blur(function(){
+               if (this.value == '')
+                       $(this).siblings('#title-prompt-text').css('visibility', '');
+       }).focus(function(){
+               $(this).siblings('#title-prompt-text').css('visibility', 'hidden');
+       }).keydown(function(e){
+               $(this).siblings('#title-prompt-text').css('visibility', 'hidden');
+               $(this).unbind(e);
+       });
 });
index 94da7e900f1b8db6e01db88e0c47c8dee9b43405..15733ad5d206799785dcce8ab2d47861528a237c 100644 (file)
@@ -1 +1 @@
-var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(f){var d,a,b,h="",i="post"==pagenow||"post-new"==pagenow,g="page"==pagenow||"page-new"==pagenow;if(i){postboxes.add_postbox_toggles("post")}else{if(g){postboxes.add_postbox_toggles("page")}}if(f("#tagsdiv-post_tag").length){tagBox.init()}else{f("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}if(f("#categorydiv").length){f("a","#category-tabs").click(function(){var j=f(this).attr("href");f(this).parent().addClass("tabs").siblings("li").removeClass("tabs");f("#category-tabs").siblings(".tabs-panel").hide();f(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){f('a[href="#categories-pop"]',"#category-tabs").click()}f("#newcat").one("focus",function(){f(this).val("").removeClass("form-input-tip")});f("#category-add-sumbit").click(function(){f("#newcat").focus()});catAddBefore=function(j){if(!f("#newcat").val()){return false}j.data+="&"+f(":checked","#categorychecklist").serialize();return j};d=function(m,l){var k,j=f("#newcat_parent");if("undefined"!=l.parsed.responses[0]&&(k=l.parsed.responses[0].supplemental.newcat_parent)){j.before(k);j.remove()}};f("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:d});f("#category-add-toggle").click(function(){f("#category-adder").toggleClass("wp-hidden-children");f('a[href="#categories-all"]',"#category-tabs").click();return false});f("#categorychecklist").children("li.popular-category").add(f("#categorychecklist-pop").children()).find(":checkbox").live("click",function(){var j=f(this),l=j.is(":checked"),k=j.val();f("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l)})}if(f("#postcustom").length){f("#the-list").wpList({addAfter:function(j,k){f("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+f("#post_ID").val();return j}})}if(f("#submitdiv").length){a=f("#timestamp").html();b=f("#post-visibility-display").html();function e(){var j=f("#post-visibility-select");if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false);f("#sticky-span").hide()}else{f("#sticky-span").show()}if(f("input:radio:checked",j).val()!="password"){f("#password-span").hide()}else{f("#password-span").show()}}function c(){var q,r,k,t,s=f("#post_status"),l=f("option[value=publish]",s),j=f("#aa").val(),o=f("#mm").val(),p=f("#jj").val(),n=f("#hh").val(),m=f("#mn").val();q=new Date(j,o-1,p,n,m);r=new Date(f("#hidden_aa").val(),f("#hidden_mm").val()-1,f("#hidden_jj").val(),f("#hidden_hh").val(),f("#hidden_mn").val());k=new Date(f("#cur_aa").val(),f("#cur_mm").val()-1,f("#cur_jj").val(),f("#cur_hh").val(),f("#cur_mn").val());if(q.getFullYear()!=j||(1+q.getMonth())!=o||q.getDate()!=p||q.getMinutes()!=m){f(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{f(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(q>k&&f("#original_post_status").val()!="future"){t=postL10n.publishOnFuture;f("#publish").val(postL10n.schedule)}else{if(q<=k&&f("#original_post_status").val()!="publish"){t=postL10n.publishOn;f("#publish").val(postL10n.publish)}else{t=postL10n.publishOnPast;if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}}}if(r.toUTCString()==q.toUTCString()){f("#timestamp").html(a)}else{f("#timestamp").html(t+" <b>"+f("option[value="+f("#mm").val()+"]","#mm").text()+" "+p+", "+j+" @ "+n+":"+m+"</b> ")}if(f("input:radio:checked","#post-visibility-select").val()=="private"){if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}if(l.length==0){s.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{l.html(postL10n.privatelyPublished)}f("option[value=publish]",s).attr("selected",true);f(".edit-post-status","#misc-publishing-actions").hide()}else{if(f("#original_post_status").val()=="future"||f("#original_post_status").val()=="draft"){if(l.length){l.remove();s.val(f("#hidden_post_status").val())}}else{l.html(postL10n.published)}if(s.is(":hidden")){f(".edit-post-status","#misc-publishing-actions").show()}}f("#post-status-display").html(f("option:selected",s).text());if(f("option:selected",s).val()=="private"||f("option:selected",s).val()=="publish"){f("#save-post").hide()}else{f("#save-post").show();if(f("option:selected",s).val()=="pending"){f("#save-post").show().val(postL10n.savePending)}else{f("#save-post").show().val(postL10n.saveDraft)}}return true}f(".edit-visibility","#visibility").click(function(){if(f("#post-visibility-select").is(":hidden")){e();f("#post-visibility-select").slideDown("normal");f(this).hide()}return false});f(".cancel-post-visibility","#post-visibility-select").click(function(){f("#post-visibility-select").slideUp("normal");f("#visibility-radio-"+f("#hidden-post-visibility").val()).attr("checked",true);f("#post_password").val(f("#hidden_post_password").val());f("#sticky").attr("checked",f("#hidden-post-sticky").attr("checked"));f("#post-visibility-display").html(b);f(".edit-visibility","#visibility").show();c();return false});f(".save-post-visibility","#post-visibility-select").click(function(){var j=f("#post-visibility-select");j.slideUp("normal");f(".edit-visibility","#visibility").show();c();if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false)}if(true==f("#sticky").attr("checked")){h="Sticky"}else{h=""}f("#post-visibility-display").html(postL10n[f("input:radio:checked",j).val()+h]);return false});f("input:radio","#post-visibility-select").change(function(){e()});f("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(f("#timestampdiv").is(":hidden")){f("#timestampdiv").slideDown("normal");f(this).hide()}return false});f(".cancel-timestamp","#timestampdiv").click(function(){f("#timestampdiv").slideUp("normal");f("#mm").val(f("#hidden_mm").val());f("#jj").val(f("#hidden_jj").val());f("#aa").val(f("#hidden_aa").val());f("#hh").val(f("#hidden_hh").val());f("#mn").val(f("#hidden_mn").val());f("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});f(".save-timestamp","#timestampdiv").click(function(){if(c()){f("#timestampdiv").slideUp("normal");f("#timestampdiv").siblings("a.edit-timestamp").show()}return false});f("#post-status-select").siblings("a.edit-post-status").click(function(){if(f("#post-status-select").is(":hidden")){f("#post-status-select").slideDown("normal");f(this).hide()}return false});f(".save-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post-status-select").siblings("a.edit-post-status").show();c();return false});f(".cancel-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post_status").val(f("#hidden_post_status").val());f("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(f("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=f("#editable-post-name"),o=m.html(),r=f("#post_name"),s=r.html(),p=f("#edit-slug-buttons"),q=p.html(),l=f("#editable-post-name-full").html();f("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var t=m.children("input").val();f.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:t,new_title:f("#title").val(),samplepermalinknonce:f("#samplepermalinknonce").val()},function(u){f("#edit-slug-box").html(u);p.html(q);r.attr("value",t);makeSlugeditClickable();f("#view-post-btn").show()});return false});f(".cancel","#edit-slug-buttons").click(function(){f("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(u){var t=u.keyCode||0;if(13==t){p.children(".save").click();return false}if(27==t){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){f("#editable-post-name").click(function(){f("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
\ No newline at end of file
+var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
\ No newline at end of file
index 1badadccc470a07bcd1fef77eadcd545e2b709b0..54f93666b72e5ea7281efba6c1f6fee40c32b335 100644 (file)
@@ -5,6 +5,7 @@ var postboxes;
                        this.init(page,args);
                        $('.postbox h3, .postbox .handlediv').click( function() {
                                var p = $(this).parent('.postbox'), id = p.attr('id');
+
                                p.toggleClass('closed');
                                postboxes.save_state(page);
                                if ( id ) {
@@ -19,6 +20,7 @@ var postboxes;
                        } );
                        $('.hide-postbox-tog').click( function() {
                                var box = $(this).val();
+
                                if ( $(this).attr('checked') ) {
                                        $('#' + box).show();
                                        if ( $.isFunction( postboxes.pbshow ) )
@@ -115,7 +117,8 @@ var postboxes;
 
                save_state : function(page) {
                        var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','),
-                       hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
+                               hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
+
                        $.post(ajaxurl, {
                                action: 'closed-postboxes',
                                closed: closed,
@@ -127,6 +130,7 @@ var postboxes;
 
                save_order : function(page) {
                        var postVars, page_columns = $('.columns-prefs input:checked').val() || 0;
+
                        postVars = {
                                action: 'meta-box-order',
                                _ajax_nonce: $('#meta-box-order-nonce').val(),
index 508577fc8e6a3af7d859c1492d8ed6274fe4f7fb..e6ac87542c053229af4e76effe6cd9198eab5229 100644 (file)
@@ -1,9 +1,9 @@
-function WPSetAsThumbnail(id){
+function WPSetAsThumbnail(id, nonce){
        var $link = jQuery('a#wp-post-thumbnail-' + id);
 
        $link.text( setPostThumbnailL10n.saving );
        jQuery.post(ajaxurl, {
-               action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
+               action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
        }, function(str){
                var win = window.dialogArguments || opener || parent || top;
                $link.text( setPostThumbnailL10n.setThumbnail );
index a2c63af42fcd1a69a4fea296d5dda7912a37fcce..ffe08d86ac09c72b9707563729f55caed001869a 100644 (file)
@@ -1 +1 @@
-function WPSetAsThumbnail(id){var $link=jQuery("a#wp-post-thumbnail-"+id);$link.text(setPostThumbnailL10n.saving);jQuery.post(ajaxurl,{action:"set-post-thumbnail",post_id:post_id,thumbnail_id:id,cookie:encodeURIComponent(document.cookie)},function(str){var win=window.dialogArguments||opener||parent||top;$link.text(setPostThumbnailL10n.setThumbnail);if(str=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").show();$link.text(setPostThumbnailL10n.done);$link.fadeOut(2000);win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str)}})};
\ No newline at end of file
+function WPSetAsThumbnail(c,b){var a=jQuery("a#wp-post-thumbnail-"+c);a.text(setPostThumbnailL10n.saving);jQuery.post(ajaxurl,{action:"set-post-thumbnail",post_id:post_id,thumbnail_id:c,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(e){var d=window.dialogArguments||opener||parent||top;a.text(setPostThumbnailL10n.setThumbnail);if(e=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").show();a.text(setPostThumbnailL10n.done);a.fadeOut(2000);d.WPSetThumbnailID(c);d.WPSetThumbnailHTML(e)}})};
\ No newline at end of file
index 968738e8ca8a91dd0ca5e035d14cd17fc92b7a39..abb8ecc07c7111c34db06e6b86cfbbbd339c02de 100644 (file)
@@ -10,6 +10,9 @@ jQuery(document).ready(function($) {
                                if ( '1' == r ) {
                                        $('#ajax-response').empty();
                                        tr.fadeOut('normal', function(){ tr.remove(); });
+                                       // Remove the term from the parent box and tag cloud
+                                       $('select#parent option[value=' + data.match(/tag_ID=(\d+)/)[1] + ']').remove();
+                                       $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove();
                                } else if ( '-1' == r ) {
                                        $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>');
                                        tr.children().css('backgroundColor', '');
@@ -30,16 +33,34 @@ jQuery(document).ready(function($) {
                        return false;
 
                $.post(ajaxurl, $('#addtag').serialize(), function(r){
-                       if ( r.indexOf('<div class="error"') === 0 ) {
-                               $('#ajax-response').append(r);
-                       } else {
-                               $('#ajax-response').empty();
-                               $('#the-list').prepend(r);
-                               $('input[type="text"]:visible, textarea:visible', form).val('');
+                  $('#ajax-response').empty();
+                       var res = wpAjax.parseAjaxResponse(r, 'ajax-response');
+                       if ( ! res )
+                               return;
+
+                       var parent = form.find('select#parent').val();
+
+                       if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
+                               $('#the-list #tag-' + parent).after( res.responses[0].supplemental['noparents'] ); // As the parent exists, Insert the version with - - - prefixed
+                       else
+                               $('#the-list').prepend( res.responses[0].supplemental['parents'] ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
+
+                       if ( form.find('select#parent') ) {
+                               // Parents field exists, Add new term to the list.
+                               var term = res.responses[1].supplemental;
+
+                               // Create an indent for the Parent field
+                               var indent = '';
+                               for ( var i = 0; i < res.responses[1].position; i++ )
+                                       indent += '&nbsp;&nbsp;&nbsp;';
+
+                               form.find('select#parent option:selected').after('<option value="' + term['term_id'] + '">' + indent + term['name'] + '</option>');
                        }
+
+                       $('input[type="text"]:visible, textarea:visible', form).val('');
                });
 
                return false;
        });
 
-});
+});
\ No newline at end of file
index 7501fa0dbc1834f49b448dfff32b5633a92a1d57..8431c8351fedc62c12582267175e236f91332d90 100644 (file)
@@ -1 +1 @@
-jQuery(document).ready(function(a){a(".delete-tag").live("click",function(g){var b=a(this),f=b.parents("tr"),c=true,d;if("undefined"!=showNotice){c=showNotice.warn()}if(c){d=b.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");a.post(ajaxurl,d,function(e){if("1"==e){a("#ajax-response").empty();f.fadeOut("normal",function(){f.remove()})}else{if("-1"==e){a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.noPerm+"</p></div>");f.children().css("backgroundColor","")}else{a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.broken+"</p></div>");f.children().css("backgroundColor","")}}});f.children().css("backgroundColor","#f33")}return false});a("#submit").click(function(){var b=a(this).parents("form");if(!validateForm(b)){return false}a.post(ajaxurl,a("#addtag").serialize(),function(c){if(c.indexOf('<div class="error"')===0){a("#ajax-response").append(c)}else{a("#ajax-response").empty();a("#the-list").prepend(c);a('input[type="text"]:visible, textarea:visible',b).val("")}});return false})});
\ No newline at end of file
+jQuery(document).ready(function(a){a(".delete-tag").live("click",function(g){var b=a(this),f=b.parents("tr"),c=true,d;if("undefined"!=showNotice){c=showNotice.warn()}if(c){d=b.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");a.post(ajaxurl,d,function(e){if("1"==e){a("#ajax-response").empty();f.fadeOut("normal",function(){f.remove()});a("select#parent option[value="+d.match(/tag_ID=(\d+)/)[1]+"]").remove();a("a.tag-link-"+d.match(/tag_ID=(\d+)/)[1]).remove()}else{if("-1"==e){a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.noPerm+"</p></div>");f.children().css("backgroundColor","")}else{a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.broken+"</p></div>");f.children().css("backgroundColor","")}}});f.children().css("backgroundColor","#f33")}return false});a("#submit").click(function(){var b=a(this).parents("form");if(!validateForm(b)){return false}a.post(ajaxurl,a("#addtag").serialize(),function(h){a("#ajax-response").empty();var f=wpAjax.parseAjaxResponse(h,"ajax-response");if(!f){return}var g=b.find("select#parent").val();if(g>0&&a("#tag-"+g).length>0){a("#the-list #tag-"+g).after(f.responses[0].supplemental.noparents)}else{a("#the-list").prepend(f.responses[0].supplemental.parents)}if(b.find("select#parent")){var e=f.responses[1].supplemental;var c="";for(var d=0;d<f.responses[1].position;d++){c+="&nbsp;&nbsp;&nbsp;"}b.find("select#parent option:selected").after('<option value="'+e.term_id+'">'+c+e.name+"</option>")}a('input[type="text"]:visible, textarea:visible',b).val("")});return false})});
\ No newline at end of file
index 5c67e999b5dd94ac9d51a3b3894dd865b69f0837..6ba6542929c31895caef647a382b424fbc5b60f4 100644 (file)
@@ -21,6 +21,8 @@ jQuery(document).ready(function($) {
        $(window).resize( function() { thickDims() } );
 
        $('a.thickbox-preview').click( function() {
+               tb_click.call(this);
+
                var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text;
 
                if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
@@ -48,6 +50,7 @@ jQuery(document).ready(function($) {
 
                $('#TB_iframeContent').width('100%');
                thickDims();
+
                return false;
        } );
 
index 2555af1625f069240e2763cbf53d8298f5221763..f942b51fd2bb1c26dfffd2ff90d445e13d755799 100644 (file)
@@ -1 +1 @@
-var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e='&nbsp; <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e='&nbsp; <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false});a(".theme-detail").click(function(){a(this).siblings(".themedetaildiv").toggle();return false})});
\ No newline at end of file
+var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){tb_click.call(this);var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e='&nbsp; <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e='&nbsp; <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false});a(".theme-detail").click(function(){a(this).siblings(".themedetaildiv").toggle();return false})});
\ No newline at end of file
index 9c5e03e474566537d28a79670f2a4e262ace834c..c0f44b8f46450d6390231bb4b538a7a0a7a6d977 100644 (file)
@@ -1,15 +1,15 @@
 (function($){
 
        function check_pass_strength() {
-               var pass = $('#pass1').val(), user = $('#user_login').val(), strength;
+               var pass1 = $('#pass1').val(), user = $('#user_login').val(), pass2 = $('#pass2').val(), strength;
 
                $('#pass-strength-result').removeClass('short bad good strong');
-               if ( ! pass ) {
+               if ( ! pass1 ) {
                        $('#pass-strength-result').html( pwsL10n.empty );
                        return;
                }
 
-               strength = passwordStrength(pass, user);
+               strength = passwordStrength(pass1, user, pass2);
 
                switch ( strength ) {
                        case 2:
@@ -21,6 +21,9 @@
                        case 4:
                                $('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
                                break;
+                       case 5:
+                               $('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] );
+                               break;
                        default:
                                $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
                }
 
        $(document).ready( function() {
                $('#pass1').val('').keyup( check_pass_strength );
+               $('#pass2').val('').keyup( check_pass_strength );
                $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
                $('#nickname').blur(function(){
                        var str = $(this).val() || $('#user_login').val();
-                       $('#display_name #display_nickname').val(str).html(str);
+                       var select = $('#display_name');
+                       var sel = select.children('option:selected').attr('id');
+                       select.children('#display_nickname').remove();
+                       if ( ! select.children('option[value=' + str + ']').length )
+                               select.append('<option id="display_nickname" value="' + str + '">' + str + '</option>');
+                       $('#'+sel).attr('selected', 'selected');
                });
                $('#first_name, #last_name').blur(function(){
+                       var select = $('#display_name');
                        var first = $('#first_name').val(), last = $('#last_name').val();
+                       var sel = select.children('option:selected').attr('id');
                        $('#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst').remove();
+                       if ( first && ! select.children('option[value=' + first + ']').length )
+                               select.append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
+                       if ( last && ! select.children('option[value=' + last + ']').length )
+                               select.append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
                        if ( first && last ) {
-                               $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>' +
-                                       '<option id="display_lastname" value="' + last + '">' + last + '</option>' +
-                                       '<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>' +
-                                       '<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
-                       } else if ( first && !last ) {
-                               $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
-                       } else if ( !first && last ) {
-                               $('#display_name').append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
+                               if ( ! select.children('option[value=' + first + ' ' + last + ']').length )
+                                       select.append('<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>');
+                               if ( ! select.children('option[value=' + last + ' ' + first + ']').length )
+                                       select.append('<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
                        }
+                       $('#'+sel).attr('selected', 'selected');
                });
     });
 
index 535b6c6fd9fbba1fc6e4c7c8b572ca218c86d834..1a7087eda842f7722f2dd13729b13e9d85adedfa 100644 (file)
@@ -1 +1 @@
-(function(a){function b(){var d=a("#pass1").val(),c=a("#user_login").val(),e;a("#pass-strength-result").removeClass("short bad good strong");if(!d){a("#pass-strength-result").html(pwsL10n.empty);return}e=passwordStrength(d,c);switch(e){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a(".color-palette").click(function(){a(this).siblings("input[name=admin_color]").attr("checked","checked")});a("#nickname").blur(function(){var c=a(this).val()||a("#user_login").val();a("#display_name #display_nickname").val(c).html(c)});a("#first_name, #last_name").blur(function(){var d=a("#first_name").val(),c=a("#last_name").val();a("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(d&&c){a("#display_name").append('<option id="display_firstname" value="'+d+'">'+d+'</option><option id="display_lastname" value="'+c+'">'+c+'</option><option id="display_firstlast" value="'+d+" "+c+'">'+d+" "+c+'</option><option id="display_lastfirst" value="'+c+" "+d+'">'+c+" "+d+"</option>")}else{if(d&&!c){a("#display_name").append('<option id="display_firstname" value="'+d+'">'+d+"</option>")}else{if(!d&&c){a("#display_name").append('<option id="display_lastname" value="'+c+'">'+c+"</option>")}}}})})})(jQuery);
\ No newline at end of file
+(function(a){function b(){var e=a("#pass1").val(),d=a("#user_login").val(),c=a("#pass2").val(),f;a("#pass-strength-result").removeClass("short bad good strong");if(!e){a("#pass-strength-result").html(pwsL10n.empty);return}f=passwordStrength(e,d,c);switch(f){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a("#pass2").val("").keyup(b);a(".color-palette").click(function(){a(this).siblings("input[name=admin_color]").attr("checked","checked")});a("#nickname").blur(function(){var e=a(this).val()||a("#user_login").val();var c=a("#display_name");var d=c.children("option:selected").attr("id");c.children("#display_nickname").remove();if(!c.children("option[value="+e+"]").length){c.append('<option id="display_nickname" value="'+e+'">'+e+"</option>")}a("#"+d).attr("selected","selected")});a("#first_name, #last_name").blur(function(){var c=a("#display_name");var f=a("#first_name").val(),d=a("#last_name").val();var e=c.children("option:selected").attr("id");a("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(f&&!c.children("option[value="+f+"]").length){c.append('<option id="display_firstname" value="'+f+'">'+f+"</option>")}if(d&&!c.children("option[value="+d+"]").length){c.append('<option id="display_lastname" value="'+d+'">'+d+"</option>")}if(f&&d){if(!c.children("option[value="+f+" "+d+"]").length){c.append('<option id="display_firstlast" value="'+f+" "+d+'">'+f+" "+d+"</option>")}if(!c.children("option[value="+d+" "+f+"]").length){c.append('<option id="display_lastfirst" value="'+d+" "+f+'">'+d+" "+f+"</option>")}}a("#"+e).attr("selected","selected")})})})(jQuery);
\ No newline at end of file
index e88dcc2e45405af34ae193a90283412b382b8186..87a0c3c68878555a8461df7c01294ca79268a90d 100644 (file)
@@ -29,7 +29,7 @@ wpWidgets = {
 
                $('a.widget-action').live('click', function(){
                        var css = {}, widget = $(this).closest('div.widget'), inside = widget.children('.widget-inside'), w = parseInt( widget.find('input.widget-width').val(), 10 );
-                       
+
                        if ( inside.is(':hidden') ) {
                                if ( w > 250 && inside.closest('div.widgets-sortables').length ) {
                                        css['width'] = w + 30 + 'px';
diff --git a/wp-admin/js/wp-gears.dev.js b/wp-admin/js/wp-gears.dev.js
deleted file mode 100644 (file)
index b91ace7..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-
-var wpGears = {
-
-       createStore : function() {
-               if ( 'undefined' == typeof google || ! google.gears ) return;
-
-               if ( 'undefined' == typeof localServer )
-                       localServer = google.gears.factory.create("beta.localserver");
-
-               store = localServer.createManagedStore(this.storeName());
-               store.manifestUrl = "gears-manifest.php";
-               store.checkForUpdate();
-               this.message(3);
-       },
-
-       getPermission : function() {
-               var perm = true;
-
-               if ( 'undefined' != typeof google && google.gears ) {
-                       if ( ! google.gears.factory.hasPermission )
-                               perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
-
-                       if ( perm )
-                               try { this.createStore(); } catch(e) { this.message(); } // silence if canceled
-                       else
-                               this.message(4);
-               }
-       },
-
-       storeName : function() {
-               var name, host = window.location.host;
-
-               if ( host.match(/[^a-z0-9._-]/i) )
-                       host = encodeURIComponent(host);
-               
-               name = window.location.protocol + host;
-               name = name.replace(/[^a-z0-9._-]+/gi, '_');
-               name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
-
-               return name;
-       },
-
-       message : function(show) {
-               var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
-
-               if ( ! msg1 ) return;
-
-               if ( 'undefined' != typeof google && google.gears ) {
-                       if ( show && show == 4 ) {
-                               msg1.style.display = msg2.style.display = msg3.style.display = 'none';
-                               msg4.style.display = 'block';
-                       } else if ( google.gears.factory.hasPermission ) {
-                               msg1.style.display = msg2.style.display = msg4.style.display = 'none';
-                               msg3.style.display = 'block';
-
-                               if ( 'undefined' == typeof store )
-                                       t.createStore();
-
-                               store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
-                               store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
-                               store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
-                       } else {
-                               msg1.style.display = msg3.style.display = msg4.style.display = 'none';
-                               msg2.style.display = 'block';
-                       }
-               }
-       },
-
-       I : function(id) {
-               return document.getElementById(id);
-       }
-};
-
-(function() {
-       if ( 'undefined' != typeof google && google.gears ) return;
-
-       var gf = false;
-       if ( 'undefined' != typeof GearsFactory ) {
-               gf = new GearsFactory();
-       } else {
-               try {
-                       gf = new ActiveXObject('Gears.Factory');
-                       if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
-                               gf.privateSetGlobalObject(this);
-               } catch (e) {
-                       if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
-                               gf = document.createElement("object");
-                               gf.style.display = "none";
-                               gf.width = 0;
-                               gf.height = 0;
-                               gf.type = "application/x-googlegears";
-                               document.documentElement.appendChild(gf);
-                       }
-               }
-       }
-
-       if ( ! gf ) return;
-       if ( 'undefined' == typeof google ) google = {};
-       if ( ! google.gears ) google.gears = { factory : gf };
-})();
diff --git a/wp-admin/js/wp-gears.js b/wp-admin/js/wp-gears.js
deleted file mode 100644 (file)
index 55bec52..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var wpGears={createStore:function(){if("undefined"==typeof google||!google.gears){return}if("undefined"==typeof localServer){localServer=google.gears.factory.create("beta.localserver")}store=localServer.createManagedStore(this.storeName());store.manifestUrl="gears-manifest.php";store.checkForUpdate();this.message(3)},getPermission:function(){var a=true;if("undefined"!=typeof google&&google.gears){if(!google.gears.factory.hasPermission){a=google.gears.factory.getPermission("WordPress","images/logo.gif")}if(a){try{this.createStore()}catch(b){this.message()}}else{this.message(4)}}},storeName:function(){var a,b=window.location.host;if(b.match(/[^a-z0-9._-]/i)){b=encodeURIComponent(b)}a=window.location.protocol+b;a=a.replace(/[^a-z0-9._-]+/gi,"_");a="wp_"+a.substring(0,60);return a},message:function(a){var d=this,g=d.I("gears-msg1"),f=d.I("gears-msg2"),e=d.I("gears-msg3"),c=d.I("gears-msg4"),b=d.I("gears-upd-number"),h=d.I("gears-wait");if(!g){return}if("undefined"!=typeof google&&google.gears){if(a&&a==4){g.style.display=f.style.display=e.style.display="none";c.style.display="block"}else{if(google.gears.factory.hasPermission){g.style.display=f.style.display=c.style.display="none";e.style.display="block";if("undefined"==typeof store){d.createStore()}store.oncomplete=function(){h.innerHTML=(" "+wpGearsL10n.updateCompleted)};store.onerror=function(){h.innerHTML=(" "+wpGearsL10n.error+" "+store.lastErrorMessage)};store.onprogress=function(i){if(b){b.innerHTML=(" "+i.filesComplete+" / "+i.filesTotal)}}}else{g.style.display=e.style.display=c.style.display="none";f.style.display="block"}}}},I:function(a){return document.getElementById(a)}};(function(){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if("undefined"==typeof google){google={}}if(!google.gears){google.gears={factory:a}}})();
\ No newline at end of file
index fdb59697260be7ca61c6105e9cdb0dd5f49f5923..053ae7eb503ba29ddc9dd18cf59faeaada307433 100644 (file)
@@ -1,41 +1,16 @@
-function GetElementsWithClassName(elementName, className) {
-       var allElements = document.getElementsByTagName(elementName), elemColl = new Array(), i;
-       for (i = 0; i < allElements.length; i++) {
-               if (allElements[i].className == className) {
-                       elemColl[elemColl.length] = allElements[i];
-               }
-       }
-       return elemColl;
-}
-
-function meChecked() {
-       var undefined, eMe = document.getElementById('me');
-       if (eMe == undefined) return false;
-       else return eMe.checked;
-}
-
-function upit() {
-       var isMe = meChecked(), inputColl = GetElementsWithClassName('input', 'valinp'), results = document.getElementById('link_rel'), inputs = '', i;
-       for (i = 0; i < inputColl.length; i++) {
-                inputColl[i].disabled = isMe;
-                inputColl[i].parentNode.className = isMe ? 'disabled' : '';
-                if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
-                       inputs += inputColl[i].value + ' ';
-                               }
-                }
-       inputs = inputs.substr(0,inputs.length - 1);
-       if (isMe) inputs='me';
-       results.value = inputs;
-       }
-
-function blurry() {
-       if (!document.getElementById) return;
-
-       var aInputs = document.getElementsByTagName('input'), i;
-
-       for ( i = 0; i < aInputs.length; i++) {
-                aInputs[i].onclick = aInputs[i].onkeyup = upit;
-       }
-}
-
-addLoadEvent(blurry);
\ No newline at end of file
+jQuery(document).ready( function($) {
+       $('#link_rel').attr('readonly', 'readonly');
+       $('#linkxfndiv input').bind('click keyup', function() {
+               var isMe = $('#me').is(':checked'), inputs = '';
+               $('input.valinp').each( function() {
+                       if (isMe) {
+                               $(this).attr('disabled', 'disabled').parent().addClass('disabled');
+                       } else {
+                               $(this).removeAttr('disabled').parent().removeClass('disabled');
+                               if ( $(this).is(':checked') && $(this).val() != '')
+                                       inputs += $(this).val() + ' ';
+                       }
+               });
+               $('#link_rel').val( (isMe) ? 'me' : inputs.substr(0,inputs.length - 1) );
+       });
+});
\ No newline at end of file
index d37a80af91b5d7e2e0405fa6e36f8b84b775a80c..c243a9fdfb06984fa2fb940566704b552b068dac 100644 (file)
@@ -1 +1 @@
-function GetElementsWithClassName(a,c){var d=document.getElementsByTagName(a),e=new Array(),b;for(b=0;b<d.length;b++){if(d[b].className==c){e[e.length]=d[b]}}return e}function meChecked(){var b,a=document.getElementById("me");if(a==b){return false}else{return a.checked}}function upit(){var b=meChecked(),e=GetElementsWithClassName("input","valinp"),d=document.getElementById("link_rel"),a="",c;for(c=0;c<e.length;c++){e[c].disabled=b;e[c].parentNode.className=b?"disabled":"";if(!b&&e[c].checked&&e[c].value!=""){a+=e[c].value+" "}}a=a.substr(0,a.length-1);if(b){a="me"}d.value=a}function blurry(){if(!document.getElementById){return}var b=document.getElementsByTagName("input"),a;for(a=0;a<b.length;a++){b[a].onclick=b[a].onkeyup=upit}}addLoadEvent(blurry);
\ No newline at end of file
+jQuery(document).ready(function(a){a("#link_rel").attr("readonly","readonly");a("#linkxfndiv input").bind("click keyup",function(){var c=a("#me").is(":checked"),b="";a("input.valinp").each(function(){if(c){a(this).attr("disabled","disabled").parent().addClass("disabled")}else{a(this).removeAttr("disabled").parent().removeClass("disabled");if(a(this).is(":checked")&&a(this).val()!=""){b+=a(this).val()+" "}}});a("#link_rel").val((c)?"me":b.substr(0,b.length-1))})});
\ No newline at end of file
index e0e4489a7de7f2f122174222eac7362309a47da2..808886a6ebe341638e5fe5508489d1775a054329 100644 (file)
@@ -7,10 +7,10 @@
  */
 
 /** Load WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( ! current_user_can('manage_links') )
-       wp_die(__('You do not have sufficient permissions to add links to this blog.'));
+       wp_die(__('You do not have sufficient permissions to add links to this site.'));
 
 $title = __('Add New Link');
 $parent_file = 'link-manager.php';
@@ -24,7 +24,7 @@ wp_enqueue_script('link');
 wp_enqueue_script('xfn');
 
 $link = get_default_link_to_edit();
-include('edit-link-form.php');
+include('./edit-link-form.php');
 
-require('admin-footer.php');
-?>
\ No newline at end of file
+require('./admin-footer.php');
+?>
index bcfbf2e8785dc1ccf0e2d1c05e6b2a835b647c52..caf73923e803d10a3b9667a4d83ffae838fe2e2a 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /** Load WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 wp_reset_vars(array('action', 'cat'));
 
@@ -67,8 +67,8 @@ case 'edit':
        require_once ('admin-header.php');
        $cat_ID = (int) $_GET['cat_ID'];
        $category = get_term_to_edit($cat_ID, 'link_category');
-       include('edit-link-category-form.php');
-       include('admin-footer.php');
+       include('./edit-link-category-form.php');
+       include('./admin-footer.php');
        exit;
 break;
 
index e818e392aaa39348a2a749dcc325a59e96e11e8d..2243d6b0e4b4726b37c4c7ffacb110237de670f0 100644 (file)
@@ -15,7 +15,7 @@ if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
        $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.') );
+               wp_die( __('You do not have sufficient permissions to edit the links for this site.') );
 
        if ( 'delete' == $doaction ) {
                $bulklinks = (array) $_GET['linkcheck'];
@@ -28,7 +28,7 @@ if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
                wp_safe_redirect( wp_get_referer() );
                exit;
        }
-} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+} elseif ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
@@ -41,12 +41,23 @@ if ( empty($cat_id) )
 if ( empty($order_by) )
        $order_by = 'order_name';
 
-$title = __('Edit Links');
+$title = __('Links');
 $this_file = $parent_file = 'link-manager.php';
-include_once ("./admin-header.php");
 
-if (!current_user_can('manage_links'))
-       wp_die(__("You do not have sufficient permissions to edit the links for this blog."));
+add_contextual_help( $current_screen,
+       '<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
+    '<p>' . __('Links may be separated into categories; these are different than the categories used on your posts.') . '</p>' .
+    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>' .
+    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Links_Edit_SubPanel" target="_blank">Link Management Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include_once ('./admin-header.php');
+
+if ( ! current_user_can('manage_links') )
+       wp_die(__("You do not have sufficient permissions to edit the links for this site."));
 
 switch ($order_by) {
        case 'order_id' :
@@ -72,14 +83,14 @@ switch ($order_by) {
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php
-if ( isset($_GET['s']) && $_GET['s'] )
+<h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
+if ( !empty($_GET['s']) )
        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php
 if ( isset($_GET['deleted']) ) {
-       echo '<div id="message" class="updated fade"><p>';
+       echo '<div id="message" class="updated"><p>';
        $deleted = (int) $_GET['deleted'];
        printf(_n('%s link deleted.', '%s links deleted', $deleted), $deleted);
        echo '</p></div>';
@@ -99,6 +110,16 @@ if ( isset($_GET['deleted']) ) {
 <form id="posts-filter" action="" method="get">
 <div class="tablenav">
 
+<?php
+if ( 'all' == $cat_id )
+       $cat_id = '';
+$args = array( 'category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0 );
+if ( ! empty( $_GET['s'] ) )
+       $args['search'] = $_GET['s'];
+$links = get_bookmarks( $args );
+if ( $links ) {
+?>
+
 <div class="alignleft actions">
 <select name="action">
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
@@ -107,7 +128,7 @@ if ( isset($_GET['deleted']) ) {
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 
 <?php
-$categories = get_terms('link_category', "hide_empty=1");
+$categories = get_terms('link_category', array("hide_empty" => 1));
 $select_cat = "<select name=\"cat_id\">\n";
 $select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
 foreach ((array) $categories as $cat)
@@ -135,13 +156,6 @@ echo $select_order;
 <div class="clear"></div>
 
 <?php
-if ( 'all' == $cat_id )
-       $cat_id = '';
-$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
-if ( !empty($_GET['s']) )
-       $args['search'] = $_GET['s'];
-$links = get_bookmarks( $args );
-if ( $links ) {
        $link_columns = get_column_headers('link-manager');
        $hidden = get_hidden_columns('link-manager');
 ?>
@@ -239,7 +253,7 @@ if ( $links ) {
                                        break;
                                default:
                                        ?>
-                                       <td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
+                                       <td <?php echo $attributes ?>><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
                                        <?php
                                        break;
 
@@ -251,10 +265,6 @@ if ( $links ) {
        </tbody>
 </table>
 
-<?php } else { ?>
-<p><?php _e('No links found.') ?></p>
-<?php } ?>
-
 <div class="tablenav">
 
 <div class="alignleft actions">
@@ -265,6 +275,10 @@ if ( $links ) {
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
+<?php } else { ?>
+<p><?php _e( 'No links found.' ) ?></p>
+<?php } ?>
+
 <br class="clear" />
 </div>
 
@@ -275,4 +289,4 @@ if ( $links ) {
 </div>
 
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
index 73ba281492a50b24e59ce1fcac9ce73b2527e6a9..1eca284631a8f2510e1d35d435053fa5e526b164 100644 (file)
@@ -15,7 +15,7 @@ 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[]'));
 
 if ( ! current_user_can('manage_links') )
-       wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
+       wp_die( __('You do not have sufficient permissions to edit the links for this site.') );
 
 if ( !empty($_POST['deletebookmarks']) )
        $action = 'deletebookmarks';
@@ -67,9 +67,11 @@ switch ($action) {
        case 'add' :
                check_admin_referer('add-bookmark');
 
-               add_link();
+               $redir = wp_get_referer();
+               if ( add_link() )
+                       $redir = add_query_arg( 'added', 'true', $redir );
 
-               wp_redirect( wp_get_referer() . '?added=true' );
+               wp_redirect( $redir );
                exit;
                break;
 
index b01ba30e2c231d5ca46a3ebd4a581e730b7b4f90..17998b0670348eece008e8c5e7ba1a56a275365d 100644 (file)
@@ -16,11 +16,6 @@ define( 'WPINC', 'wp-includes' );
  */
 function __() {}
 
-/**
- * @ignore
- */
-function _c() {}
-
 /**
  * @ignore
  */
@@ -82,6 +77,11 @@ function site_url() {}
  */
 function admin_url() {}
 
+/**
+ * @ignore
+ */
+function home_url() {}
+
 /**
  * @ignore
  */
index 1e10c47a94ebca0af86c6527a8c1d7989e433d75..e9673e26b0e4738ba5ff80aea3b2e9926e8a02bd 100644 (file)
@@ -16,11 +16,6 @@ define( 'WPINC', 'wp-includes' );
  */
 function __() {}
 
-/**
- * @ignore
- */
-function _c() {}
-
 /**
  * @ignore
  */
index 9f2c26f14d20e3e8ffbd94cf8124ebd47f38b7fd..6daa5d5283f06cc50d174fd7889062aa92a808a2 100644 (file)
@@ -19,7 +19,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
 <?php
 
 if ( !defined('WP_ALLOW_REPAIR') ) {
-       _e("<p>To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file.  Once this line is added to your config, reload this page.</p><code>define('WP_ALLOW_REPAIR', true);</code>");
+       echo '<p>'.__('To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file.  Once this line is added to your config, reload this page.')."</p><code>define('WP_ALLOW_REPAIR', true);</code>";
 } elseif ( isset($_GET['repair']) ) {
        $problems = array();
        check_admin_referer('repair_db');
@@ -31,48 +31,50 @@ if ( !defined('WP_ALLOW_REPAIR') ) {
 
        $okay = true;
 
-       // Loop over the WP tables, checking and repairing as needed.
-       foreach ($wpdb->tables as $table) {
-               if ( in_array($table, $wpdb->old_tables) )
-                       continue;
-
-               $check = $wpdb->get_row("CHECK TABLE {$wpdb->prefix}$table");
+       $tables = $wpdb->tables();
+       // Sitecategories may not exist if global terms are disabled.
+       if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) )
+               unset( $tables['sitecategories'] );
+       $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes.
+       // Loop over the tables, checking and repairing as needed.
+       foreach ( $tables as $table ) {
+               $check = $wpdb->get_row("CHECK TABLE $table");
                if ( 'OK' == $check->Msg_text ) {
-                       echo "<p>The {$wpdb->prefix}$table table is okay.";
+                       echo "<p>The $table table is okay.";
                } else {
-                       echo "<p>The {$wpdb->prefix}$table table is not okay. It is reporting the following error: <code>$check->Msg_text</code>.  WordPress will attempt to repair this table&hellip;";
-                       $repair = $wpdb->get_row("REPAIR TABLE {$wpdb->prefix}$table");
+                       echo "<p>The $table table is not okay. It is reporting the following error: <code>$check->Msg_text</code>.  WordPress will attempt to repair this table&hellip;";
+                       $repair = $wpdb->get_row("REPAIR TABLE $table");
                        if ( 'OK' == $check->Msg_text ) {
-                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Sucessfully repaired the {$wpdb->prefix}$table table.";
+                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Successfully repaired the $table table.";
                        } else {
-                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Failed to repair the {$wpdb->prefix}$table table. Error: $check->Msg_text<br />";
-                               $problems["{$wpdb->prefix}$table"] = $check->Msg_text;
+                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Failed to repair the $table table. Error: $check->Msg_text<br />";
+                               $problems["$table"] = $check->Msg_text;
                                $okay = false;
                        }
                }
                if ( $okay && $optimize ) {
-                       $check = $wpdb->get_row("ANALYZE TABLE {$wpdb->prefix}$table");
+                       $check = $wpdb->get_row("ANALYZE TABLE $table");
                        if ( 'Table is already up to date' == $check->Msg_text )  {
-                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;The {$wpdb->prefix}$table table is already optimized.";
+                               echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;The $table table is already optimized.";
                        } else {
-                               $check = $wpdb->get_row("OPTIMIZE TABLE {$wpdb->prefix}$table");
+                               $check = $wpdb->get_row("OPTIMIZE TABLE $table");
                                if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text )
-                                       echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Sucessfully optimized the {$wpdb->prefix}$table table.";
+                                       echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Successfully optimized the $table table.";
                                else
-                                       echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Failed to optimize the {$wpdb->prefix}$table table. Error: $check->Msg_text";
+                                       echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;Failed to optimize the $table table. Error: $check->Msg_text";
                        }
                }
                echo '</p>';
        }
 
        if ( !empty($problems) ) {
-               printf(__('<p>Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.</p>'), 'http://wordpress.org/support/forum/3');
+               printf('<p>'.__('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.').'</p>', 'http://wordpress.org/support/forum/3');
                $problem_output = array();
                foreach ( $problems as $table => $problem )
                        $problem_output[] = "$table: $problem";
                echo '<textarea name="errors" id="errors" rows="20" cols="60">' . format_to_edit(implode("\n", $problem_output)) . '</textarea>';
        } else {
-               _e("<p>Repairs complete.  Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.</p><code>define('WP_ALLOW_REPAIR', true);</code>");
+               echo '<p>'.__('Repairs complete.  Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.')."</p><code>define('WP_ALLOW_REPAIR', true);</code>";
        }
 } else {
        if ( isset($_GET['referrer']) && 'is_blog_installed' == $_GET['referrer'] )
index 4cba71f98e6f190664d1ba696b82e82ba02ab0bd..2e4590c24320ea81d765a7432d9fc1f328f09255 100644 (file)
@@ -8,7 +8,7 @@
 
 $_GET['inline'] = 'true';
 /** Administration bootstrap */
-require_once('admin.php');
-require_once('media-upload.php');
+require_once('./admin.php');
+require_once('./media-upload.php');
 
 ?>
\ No newline at end of file
index 0bb74557792ef79a4c88bbb61e3720f464e7faa9..bd21e4bc4982534b13b197b6ee4073e3d97e69af 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /** 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.'));
@@ -56,12 +56,21 @@ if ( isset($_GET['inline']) ) {
 
        $title = __('Upload New Media');
        $parent_file = 'upload.php';
-       require_once('admin-header.php'); ?>
+
+       add_contextual_help( $current_screen,
+'<p>' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share.') . '</p>' .
+               '<p>' . __('There are two options for uploading files: <em>Select Files</em> will open the Flash-based uploader (multiple file upload allowed), or you can use the <em>Browser Uploader</em>. Clicking <em>Select Files</em> opens a navigation window showing you files in your operating system. Selecting <em>Open</em> after clicking on the file you want activates a progress bar on the uploader screen. Basic image editing is available after upload is complete. Make sure you click <em>Save</em> before leaving this screen.') . '</p>' .
+               '<p><strong>' . __('For more information:') . '</strong></p>' .
+               '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_SubPanel" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' .
+               '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+
+       require_once('./admin-header.php'); ?>
        <div class="wrap">
        <?php screen_icon(); ?>
        <h2><?php echo esc_html( $title ); ?></h2>
 
-       <form enctype="multipart/form-data" method="post" action="media-upload.php?inline=&amp;upload-page-form=" class="media-upload-form type-form validate" id="file-form">
+       <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-upload.php?inline=&amp;upload-page-form='); ?>" class="media-upload-form type-form validate" id="file-form">
 
        <?php media_upload_form(); ?>
 
@@ -78,15 +87,15 @@ if ( isset($_GET['inline']) ) {
        </script>
        <input type="hidden" name="post_id" id="post_id" value="0" />
        <?php wp_nonce_field('media-form'); ?>
-       <div id="media-items"> </div>
+       <div id="media-items" class="hide-if-no-js"> </div>
        <p>
-       <input type="submit" class="button savebutton" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
+       <input type="submit" class="button savebutton hide-if-no-js" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
        </p>
        </form>
        </div>
 
 <?php
-       include('admin-footer.php');
+       include('./admin-footer.php');
 
 } else {
 
index 09776b48512fca2785a403463fc50ecebfdce335..6715773b7a5eaf7fd42adac93ee7e3f0f7cb06f9 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** Load WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 $parent_file = 'upload.php';
 $submenu_file = 'upload.php';
@@ -67,7 +67,7 @@ case 'edit' :
        wp_enqueue_script('image-edit');
        wp_enqueue_style('imgareaselect');
 
-       require( 'admin-header.php' );
+       require( './admin-header.php' );
 
        $parent_file = 'upload.php';
        $message = '';
@@ -76,7 +76,7 @@ case 'edit' :
                switch ( $_GET['message'] ) :
                case 'updated' :
                        $message = __('Media attachment updated.');
-                       $class = 'updated fade';
+                       $class = 'updated';
                        break;
                endswitch;
        }
@@ -89,7 +89,11 @@ case 'edit' :
 <?php screen_icon(); ?>
 <h2><?php _e( 'Edit Media' ); ?></h2>
 
-<form method="post" action="<?php echo esc_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
+<form method="post" action="" class="media-upload-form" id="media-single-form">
+<p class="submit" style="padding-bottom: 0;">
+<input type="submit" class="button-primary" name="save" value="<?php esc_attr_e('Update Media'); ?>" />
+</p>
+
 <div class="media-single">
 <div id='media-item-<?php echo $att_id; ?>' class='media-item'>
 <?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
@@ -110,7 +114,7 @@ case 'edit' :
 
 <?php
 
-       require( 'admin-footer.php' );
+       require( './admin-footer.php' );
 
        exit;
 
index df97ad6ac703ea78ea3d480e1faf9be8f89dd6b0..2a9ee7294c266c9098482bcd96c5a8a8a5243fae 100644 (file)
  */
 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
 $self = preg_replace('|^.*/plugins/|i', '', $self);
+$self = preg_replace('|^.*/mu-plugins/|i', '', $self);
 
 global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+$parent_file = apply_filters("parent_file", $parent_file); // For plugins to move submenu tabs around.
 
 get_admin_page_parent();
 
@@ -31,7 +33,7 @@ get_admin_page_parent();
  * @param bool $submenu_as_parent
  */
 function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
-       global $self, $parent_file, $submenu_file, $plugin_page, $pagenow;
+       global $self, $parent_file, $submenu_file, $plugin_page, $pagenow, $typenow;
 
        $first = true;
        // 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
@@ -45,21 +47,21 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                if ( !empty($submenu[$item[2]]) )
                        $class[] = 'wp-has-submenu';
 
-               if ( ( $parent_file && $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) {
+               if ( ( $parent_file && $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') && $self == $item[2] ) ) {
                        if ( !empty($submenu[$item[2]]) )
                                $class[] = 'wp-has-current-submenu wp-menu-open';
                        else
                                $class[] = 'current';
                }
 
-               if ( isset($item[4]) && ! empty($item[4]) )
+               if ( ! 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] ) . '"' : '';
+               $id = ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
                $img = '';
-               if ( isset($item[6]) && ! empty($item[6]) ) {
+               if ( ! empty($item[6]) ) {
                        if ( 'div' === $item[6] )
                                $img = '<br />';
                        else
@@ -67,6 +69,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                }
                $toggle = '<div class="wp-menu-toggle"><br /></div>';
 
+               $title = wptexturize($item[0]);
+
                echo "\n\t<li$class$id>";
 
                if ( false !== strpos($class, 'wp-menu-separator') ) {
@@ -79,9 +83,9 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                                $menu_file = substr($menu_file, 0, $pos);
                        if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {
                                $admin_is_parent = true;
-                               echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";
                        } else {
-                               echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";
                        }
                } else if ( current_user_can($item[1]) ) {
                        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
@@ -110,15 +114,22 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                                }
 
                                $menu_file = $item[2];
+
                                if ( false !== $pos = strpos($menu_file, '?') )
                                        $menu_file = substr($menu_file, 0, $pos);
 
+                               // Handle current for post_type=post|page|foo pages, which won't match $self.
+                               if ( !empty($typenow) )
+                                       $self_type = $self . '?post_type=' . $typenow;
+                               else
+                                       $self_type = 'nothing';
+
                                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($menu_file) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
+                               } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self) || ($item[2] == $self_type))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
                                        $class[] = 'current';
                                }
 
@@ -129,18 +140,18 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                                if ( false !== $pos = strpos($sub_file, '?') )
                                        $sub_file = substr($sub_file, 0, $pos);
 
+                               $title = wptexturize($sub_item[0]);
+
                                if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! 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 . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
-                                       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>";
+                                       if ( (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}")) || file_exists($menu_file) )
+                                               $sub_item_url = add_query_arg( array('page' => $sub_item[2]), $item[2] );
                                        else
-                                               echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                                               $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' );
+                                       $sub_item_url = esc_url($sub_item_url);
+                                       echo "<li$class><a href='$sub_item_url'$class$tabindex>$title</a></li>";
                                } else {
-                                       echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                                       echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>$title</a></li>";
                                }
                        }
                        echo "</ul></div>";
index 31a876ea8ce82d7e230bca208345afd41db8c3f3..7d447c63e179c3082b883e87583fd40df3841f65 100644 (file)
 $awaiting_mod = wp_count_comments();
 $awaiting_mod = $awaiting_mod->moderated;
 
-$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
+if ( is_multisite() && is_super_admin() ) {
+       /* translators: Network menu item */
+       $menu[0] = array(__('Super Admin'), 'manage_network', 'ms-admin.php', '', 'menu-top menu-top-first menu-icon-site', 'menu-site', 'div');
+       $submenu[ 'ms-admin.php' ][1] = array( __('Admin'), 'manage_network', 'ms-admin.php' );
+       /* translators: Sites menu item */
+       $submenu[ 'ms-admin.php' ][5] = array( __('Sites'), 'manage_sites', 'ms-sites.php' );
+       $submenu[ 'ms-admin.php' ][10] = array( __('Users'), 'manage_network_users', 'ms-users.php' );
+       $submenu[ 'ms-admin.php' ][20] = array( __('Themes'), 'manage_network_themes', 'ms-themes.php' );
+       $submenu[ 'ms-admin.php' ][25] = array( __('Options'), 'manage_network_options', 'ms-options.php' );
+       $submenu[ 'ms-admin.php' ][30] = array( __('Update'), 'manage_network', 'ms-upgrade-network.php' );
+
+       $menu[1] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
+
+       $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-icon-dashboard', 'menu-dashboard', 'div' );
+} else {
+       $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' );
+}
+
+if ( is_multisite() || is_super_admin() ) {
+       $submenu[ 'index.php' ][0] = array( __('Dashboard'), 'read', 'index.php' );
+
+       if ( is_multisite() )
+               $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
+
+       if ( is_super_admin() ) {
+               $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
+               $update_plugins = get_site_transient( 'update_plugins' );
+               if ( !empty($update_plugins->response) )
+                       $plugin_update_count = count( $update_plugins->response );
+               $update_themes = get_site_transient( 'update_themes' );
+               if ( !empty($update_themes->response) )
+                       $theme_update_count = count( $update_themes->response );
+               $update_wordpress = get_core_updates( array('dismissed' => false) );
+               if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
+                       $wordpress_update_count = 1;
+
+               $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
+               $update_title = array();
+               if ( $wordpress_update_count )
+                       $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
+               if ( $plugin_update_count )
+                       $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
+               if ( $theme_update_count )
+                       $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
+
+               $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
+
+               $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php');
+               unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title);
+       }
+}
 
 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
 
-$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top', 'menu-posts', 'div' );
-       $submenu['edit.php'][5]  = array( __('Edit'), 'edit_posts', 'edit.php' );
+$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
+       $submenu['edit.php'][5]  = array( __('Posts'), 'edit_posts', 'edit.php' );
        /* translators: add new post */
        $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );
 
        $i = 15;
        foreach ( $wp_taxonomies as $tax ) {
-               if ( $tax->hierarchical || ! in_array('post', (array) $tax->object_type, true) )
+               if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
                        continue;
 
-               $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
-               ++$i;
+               $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
        }
+       unset($tax);
 
-       $submenu['edit.php'][50] = array( __('Categories'), 'manage_categories', 'categories.php' );
-
-$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
+$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' );
        $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
        /* translators: add new file */
        $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
 
-$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top', 'menu-links', 'div' );
-       $submenu['link-manager.php'][5] = array( __('Edit'), 'manage_links', 'link-manager.php' );
+$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
+       $submenu['link-manager.php'][5] = array( __('Links'), 'manage_links', 'link-manager.php' );
        /* translators: add new links */
-       $submenu['link-manager.php'][10] = array( _x('Add New', 'links'), 'manage_links', 'link-add.php' );
+       $submenu['link-manager.php'][10] = array( _x('Add New', 'link'), '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' );
+$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' );
+       $submenu['edit.php?post_type=page'][5] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page' );
        /* translators: add new page */
-       $submenu['edit-pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'page-new.php' );
+       $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
+       $i = 15;
+       foreach ( $wp_taxonomies as $tax ) {
+               if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
+                       continue;
+
+               $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
+       }
+       unset($tax);
 
-$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' );
+$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-icon-comments', 'menu-comments', 'div' );
 
 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
 
+foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false) ) as $ptype ) {
+       $ptype_obj = get_post_type_object( $ptype );
+       $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : $_wp_last_object_menu++; // If we're to use $_wp_last_object_menu, increment it first.
+       $ptype_for_id = sanitize_html_class( $ptype );
+       if ( is_string( $ptype_obj->menu_icon ) ) {
+               $menu_icon   = esc_url( $ptype_obj->menu_icon );
+               $ptype_class = $ptype_for_id;
+       } else {
+               $menu_icon   = 'div';
+               $ptype_class = 'post';
+       }
+
+       // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position.
+       $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
+       while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
+               $ptype_menu_position++;
+
+       $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
+       $submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->name, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype");
+       $submenu["edit.php?post_type=$ptype"][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" );
+
+       $i = 15;
+       foreach ( $wp_taxonomies as $tax ) {
+               if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
+                       continue;
+
+               $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
+       }
+}
+unset($ptype, $ptype_obj);
+
 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
 
-$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
-       $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
-       $submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
-       $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php');
+if ( current_user_can( 'switch_themes') ) {
+       $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
+               $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
+               if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
+                       $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
+} else {
+       $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
+               $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php');
+               if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
+                       $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
+}
+
+// Add 'Editor' to the bottom of the Appearence menu.
+add_action('admin_menu', '_add_themes_utility_last', 101);
+function _add_themes_utility_last() {
+       // Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
+       add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
+}
 
-$update_plugins = get_transient( 'update_plugins' );
+$update_plugins = get_site_transient( 'update_plugins' );
 $update_count = 0;
 if ( !empty($update_plugins->response) )
        $update_count = count( $update_plugins->response );
 
-$menu[65] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' );
-       $submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' );
-       /* translators: add new plugin */
-       $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
-       $submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );
+$menu_perms = get_site_option('menu_items', array());
+if ( is_super_admin() || ( is_multisite() && isset($menu_perms['plugins']) && $menu_perms['plugins'] ) ) {
+       $menu[65] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' );
+               $submenu['plugins.php'][5]  = array( __('Plugins'), 'activate_plugins', 'plugins.php' );
+               /* translators: add new plugin */
+               $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
+               $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
+}
+unset($menu_perms, $update_plugins, $update_count);
 
-if ( current_user_can('edit_users') )
-       $menu[70] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );
+if ( current_user_can('list_users') )
+       $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
 else
-       $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top', 'menu-users', 'div' );
+       $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
 
-if ( current_user_can('edit_users') ) {
+if ( current_user_can('list_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'][5] = array(__('Users'), 'list_users', 'users.php');
        $submenu['users.php'][10] = array(_x('Add New', 'user'), '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');
+       $submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');
 }
 
-$menu[75] = array( __('Tools'), 'read', 'tools.php', '', 'menu-top', 'menu-tools', 'div' );
-       $submenu['tools.php'][5] = array( __('Tools'), 'read', 'tools.php' );
+$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' );
+       $submenu['tools.php'][5] = array( __('Tools'), 'edit_posts', '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');
+       if ( is_multisite() && !is_main_site() )
+               $submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' );
+       if ( ( ! is_multisite() || defined( 'MULTISITE' ) ) && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE && is_super_admin() )
+               $submenu['tools.php'][50] = array(__('Network'), 'manage_options', 'network.php');
 
-$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
-       $submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
+$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div' );
+       $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), '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');
 
 $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
 
@@ -121,21 +230,39 @@ $menu[99] = array( '', 'read', 'separator-last', '', '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';
+$_wp_real_parent_file['edit-pages.php'] = 'edit.php?post_type=page';
+$_wp_real_parent_file['page-new.php'] = 'edit.php?post_type=page';
+$_wp_real_parent_file['wpmu-admin.php'] = 'ms-admin.php';
 
 do_action('_admin_menu');
 
 // Create list of page plugin hook names.
 foreach ($menu as $menu_page) {
-       $hook_name = sanitize_title(basename($menu_page[2], '.php'));
+       if ( false !== $pos = strpos($menu_page[2], '?') ) {
+               // Handle post_type=post|page|foo pages.
+               $hook_name = substr($menu_page[2], 0, $pos);
+               $hook_args = substr($menu_page[2], $pos + 1);
+               wp_parse_str($hook_args, $hook_args);
+               // Set the hook name to be the post type.
+               if ( isset($hook_args['post_type']) )
+                       $hook_name = $hook_args['post_type'];
+               else
+                       $hook_name = basename($hook_name, '.php');
+               unset($hook_args);
+       } else {
+               $hook_name = basename($menu_page[2], '.php');
+       }
+       $hook_name = sanitize_title($hook_name);
 
        // ensure we're backwards compatible
        $compat = array(
                'index' => 'dashboard',
                'edit' => 'posts',
+               'post' => 'posts',
                'upload' => 'media',
                'link-manager' => 'links',
                'edit-pages' => 'pages',
+               'page' => 'pages',
                'edit-comments' => 'comments',
                'options-general' => 'settings',
                'themes' => 'appearance',
@@ -148,6 +275,7 @@ foreach ($menu as $menu_page) {
 
        $admin_page_hooks[$menu_page[2]] = $hook_name;
 }
+unset($menu_page);
 
 $_wp_submenu_nopriv = array();
 $_wp_menu_nopriv = array();
@@ -160,14 +288,17 @@ foreach ( array( 'submenu' ) as $sub_loop ) {
                                $_wp_submenu_nopriv[$parent][$data[2]] = true;
                        }
                }
+               unset($index, $data);
 
                if ( empty(${$sub_loop}[$parent]) )
                        unset(${$sub_loop}[$parent]);
        }
+       unset($sub, $parent);
 }
+unset($sub_loop);
 
 // Loop over the top-level menu.
-// Menus for which the original parent is not acessible due to lack of privs will have the next
+// Menus for which the original parent is not accessible due to lack of privs will have the next
 // submenu in line be assigned as the new menu parent.
 foreach ( $menu as $id => $data ) {
        if ( empty($submenu[$data[2]]) )
@@ -186,12 +317,13 @@ foreach ( $menu as $id => $data ) {
                        $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
                        unset($submenu[$old_parent][$index]);
                }
-               unset($submenu[$old_parent]);
+               unset($submenu[$old_parent], $index);
 
                if ( isset($_wp_submenu_nopriv[$old_parent]) )
                        $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
        }
 }
+unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
 
 do_action('admin_menu', '');
 
@@ -209,6 +341,7 @@ foreach ( $menu as $id => $data ) {
                }
        }
 }
+unset($id, $data);
 
 // Remove any duplicated seperators
 $seperator_found = false;
@@ -224,8 +357,7 @@ foreach ( $menu as $id => $data ) {
                $seperator_found = false;
        }
 }
-
-unset($id);
+unset($id, $data);
 
 function add_cssclass($add, $class) {
        $class = empty($class) ? $add : $class .= ' ' . $add;
@@ -306,7 +438,7 @@ if ( apply_filters('custom_menu_order', false) ) {
 
 $menu = add_menu_classes($menu);
 
-if (! user_can_access_admin_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.') );
 }
diff --git a/wp-admin/ms-admin.php b/wp-admin/ms-admin.php
new file mode 100644 (file)
index 0000000..0461c5c
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Multisite administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( !is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Network Admin' );
+$parent_file = 'ms-admin.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('Until WordPress 3.0, running multiple sites required using WordPress MU instead of regular WordPress. In version 3.0, these applications have merged. If you are a former MU user, you should be aware of the following changes:') . '</p>' .
+       '<ul><li>' . __('Site Admin is now Super Admin (we highly encourage you to get yourself a cape!).') . '</li>' .
+       '<li>' . __('Blogs are now called Sites; Site is now called Network.') . '</li></ul>' .
+       '<p>' . __('This screen provides the network administrator with links to the screens for Sites and Users to either create a new site or user, or to search existing users and sites. Those screens are also accessible through the left-hand navigation in the Super Admin section.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Super_Admin_Menu" target="_blank">Documentation on Super Admin Menu</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( './admin-header.php' );
+
+$c_users = get_user_count();
+$c_blogs = get_blog_count();
+
+$user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
+$blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
+
+$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
+?>
+
+<div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php echo esc_html( $title ); ?></h2>
+
+       <ul class="subsubsub">
+       <li><a href="ms-sites.php#form-add-site"><?php _e( 'Create a New Site' ); ?></a> |</li>
+       <li><a href="ms-users.php#form-add-user"><?php _e( 'Create a New User' ); ?></a></li>
+       </ul>
+       <br class="clear" />
+
+       <p class="youhave"><?php echo $sentence; ?></p>
+       <?php do_action( 'wpmuadminresult', '' ); ?>
+
+       <form name="searchform" action="ms-users.php" method="get">
+               <p>
+                       <input type="hidden" name="action" value="users" />
+                       <input type="text" name="s" value="" size="17" />
+                       <input class="button" type="submit" name="submit" value="<?php esc_attr_e( 'Search Users' ); ?>" />
+               </p>
+       </form>
+
+       <form name="searchform" action="ms-sites.php" method="get">
+               <p>
+                       <input type="hidden" name="action" value="blogs" />
+                       <input type="hidden" name="searchaction" value="name" />
+                       <input type="text" name="s" value="" size="17" />
+                       <input class="button" type="submit" name="blog_name" value="<?php esc_attr_e( 'Search Sites' ); ?>" />
+               </p>
+       </form>
+
+       <?php do_action( 'mu_rightnow_end' ); ?>
+       <?php do_action( 'mu_activity_box_end' ); ?>
+</div>
+
+<?php include( './admin-footer.php' ); ?>
diff --git a/wp-admin/ms-delete-site.php b/wp-admin/ms-delete-site.php
new file mode 100644 (file)
index 0000000..62f5b80
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Multisite delete site panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( !is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+// @todo Create a delete blog cap.
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die(__( 'You do not have sufficient permissions to delete this site.'));
+
+if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
+       if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) {
+               wpmu_delete_blog( $wpdb->blogid );
+               wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );
+       } else {
+               wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
+       }
+}
+
+$title = __( 'Delete Site' );
+$parent_file = 'tools.php';
+require_once( './admin-header.php' );
+
+echo '<div class="wrap">';
+screen_icon();
+echo '<h2>' . esc_html( $title ) . '</h2>';
+
+if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
+       $hash = wp_generate_password( 20, false );
+       update_option( 'delete_blog_hash', $hash );
+
+       $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
+
+       $content = apply_filters( 'delete_site_email_content', __( "Dear User,
+You recently clicked the 'Delete Site' link on your site and filled in a
+form on that page.
+If you really want to delete your site, click the link below. You will not
+be asked to confirm again so only click this link if you are absolutely certain:
+###URL_DELETE###
+
+If you delete your site, please consider opening a new site here
+some time in the future! (But remember your current site and username
+are gone forever.)
+
+Thanks for using the site,
+Webmaster
+###SITE_NAME###" ) );
+
+       $content = str_replace( '###URL_DELETE###', $url_delete, $content );
+       $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
+
+       wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content );
+       ?>
+
+       <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p>
+
+<?php } else {
+       ?>
+       <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>
+       <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
+
+       <form method="post" name="deletedirect">
+               <input type="hidden" name="action" value="deleteblog" />
+               <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_blog->domain . $current_blog->path ); ?></strong></label></p>
+               <p class="submit"><input type="submit" value="<?php esc_attr_e( 'Delete My Site Permanently' ) ?>" /></p>
+       </form>
+       <?php
+}
+echo '</div>';
+
+include( './admin-footer.php' );
+?>
diff --git a/wp-admin/ms-edit.php b/wp-admin/ms-edit.php
new file mode 100644 (file)
index 0000000..a4c131e
--- /dev/null
@@ -0,0 +1,636 @@
+<?php
+/**
+ * Action handler for Multisite administration panels.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( ! is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( empty( $_GET['action'] ) )
+       wp_redirect( admin_url( 'ms-admin.php' ) );
+
+do_action( 'wpmuadminedit' , '');
+
+if ( isset( $_GET['id' ]) )
+       $id = intval( $_GET['id'] );
+elseif ( isset( $_POST['id'] ) )
+       $id = intval( $_POST['id'] );
+
+switch ( $_GET['action'] ) {
+       case 'siteoptions':
+               check_admin_referer( 'siteoptions' );
+               if ( ! current_user_can( 'manage_network_options' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( empty( $_POST ) )
+                       wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">options page</a>.', esc_url( admin_url( 'ms-options.php' ) ) ) ) );
+
+               if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
+                       update_site_option( 'WPLANG', $_POST['WPLANG'] );
+
+               if ( is_email( $_POST['admin_email'] ) )
+                       update_site_option( 'admin_email', $_POST['admin_email'] );
+
+               $illegal_names = split( ' ', $_POST['illegal_names'] );
+               foreach ( (array) $illegal_names as $name ) {
+                       $name = trim( $name );
+                       if ( $name != '' )
+                               $names[] = trim( $name );
+               }
+               update_site_option( 'illegal_names', $names );
+
+               if ( $_POST['limited_email_domains'] != '' ) {
+                       $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] );
+                       $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) );
+                       $limited_email = array();
+                       foreach ( (array) $limited_email_domains as $domain ) {
+                                       $domain = trim( $domain );
+                               if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
+                                       $limited_email[] = trim( $domain );
+                       }
+                       update_site_option( 'limited_email_domains', $limited_email );
+               } else {
+                       update_site_option( 'limited_email_domains', '' );
+               }
+
+               if ( $_POST['banned_email_domains'] != '' ) {
+                       $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) );
+                       $banned = array();
+                       foreach ( (array) $banned_email_domains as $domain ) {
+                               $domain = trim( $domain );
+                               if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
+                                       $banned[] = trim( $domain );
+                       }
+                       update_site_option( 'banned_email_domains', $banned );
+               } else {
+                       update_site_option( 'banned_email_domains', '' );
+               }
+               update_site_option( 'default_user_role', $_POST['default_user_role'] );
+               if ( trim( $_POST['dashboard_blog_orig'] ) == '' )
+                       $_POST['dashboard_blog_orig'] = $current_site->blog_id;
+               if ( trim( $_POST['dashboard_blog'] ) == '' ) {
+                       $_POST['dashboard_blog'] = $current_site->blog_id;
+                       $dashboard_blog_id = $current_site->blog_id;
+               } elseif ( ! preg_match( '/(--|\.)/', $_POST['dashboard_blog'] ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $_POST['dashboard_blog'] ) ) {
+                       $dashboard_blog = $_POST['dashboard_blog'];
+                       $blog_details = get_blog_details( $dashboard_blog );
+                       if ( false === $blog_details ) {
+                               if ( is_numeric( $dashboard_blog ) )
+                                       wp_die( __( 'A dashboard site referenced by ID must already exist' ) );
+                               if ( is_subdomain_install() ) {
+                                       $domain = $dashboard_blog . '.' . $current_site->domain;
+                                       $path = $current_site->path;
+                               } else {
+                                       $domain = $current_site->domain;
+                                       $path = trailingslashit( $current_site->path . $dashboard_blog );
+                               }
+                               $wpdb->hide_errors();
+                               $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( 'public' => 0 ), $current_site->id );
+                               $wpdb->show_errors();
+                       } else {
+                               $dashboard_blog_id = $blog_details->blog_id;
+                       }
+               }
+               if ( is_wp_error( $dashboard_blog_id ) )
+                       wp_die( __( 'Problem creating dashboard site: ' ) . $dashboard_blog_id->get_error_message() );
+               if ( $_POST['dashboard_blog_orig'] != $_POST['dashboard_blog'] ) {
+                       $users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
+                       $move_users = array();
+                       foreach ( (array)$users as $user ) {
+                               $user_meta_value = unserialize( $user->meta_value );
+                               if ( is_array( $user_meta_value ) && array_pop( array_keys( $user_meta_value ) ) == 'subscriber' )
+                                       $move_users[] = $user->user_id;
+                       }
+                       if ( false == empty( $move_users ) ) {
+                               foreach ( (array)$move_users as $user_id ) {
+                                       remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) );
+                                       add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
+                                       update_user_meta( $user_id, 'primary_blog', $dashboard_blog_id );
+                               }
+                       }
+               }
+               update_site_option( 'dashboard_blog', $dashboard_blog_id );
+
+               $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' );
+               $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 );
+               foreach ( $checked_options as $option_name => $option_unchecked_value ) {
+                       if ( ! isset( $_POST[$option_name] ) )
+                               $_POST[$option_name] = $option_unchecked_value;
+               }
+               foreach ( $options as $option_name ) {
+                       if ( ! isset($_POST[$option_name]) )
+                               continue;
+                       $value = stripslashes_deep( $_POST[$option_name] );
+                       update_site_option( $option_name, $value );
+               }
+
+               // Update more options here
+               do_action( 'update_wpmu_options' );
+
+               wp_redirect( add_query_arg( 'updated', 'true', admin_url( 'ms-options.php' ) ) );
+               exit();
+       break;
+       case 'addblog':
+               check_admin_referer( 'add-blog', '_wpnonce_add-blog' );
+
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( is_array( $_POST['blog'] ) == false )
+                       wp_die(  __( 'Can&#8217;t create an empty site.' ) );
+               $blog = $_POST['blog'];
+               $domain = '';
+               if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
+                       $domain = strtolower( $blog['domain'] );
+
+               // If not a subdomain install, make sure the domain isn't a reserved word
+               if ( ! is_subdomain_install() ) {
+                       $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) );
+                       if ( in_array( $domain, $subdirectory_reserved_names ) )
+                               wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
+               }
+
+               $email = sanitize_email( $blog['email'] );
+               $title = $blog['title'];
+
+               if ( empty( $domain ) )
+                       wp_die( __( 'Missing or invalid site address.' ) );
+               if ( empty( $email ) )
+                       wp_die( __( 'Missing email address.' ) );
+               if ( !is_email( $email ) )
+                       wp_die( __( 'Invalid email address.' ) );
+
+               if ( is_subdomain_install() ) {
+                       $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
+                       $path = $base;
+               } else {
+                       $newdomain = $current_site->domain;
+                       $path = $base . $domain . '/';
+               }
+
+               $password = 'N/A';
+               $user_id = email_exists($email);
+               if ( !$user_id ) { // Create a new user with a random password
+                       $password = wp_generate_password();
+                       $user_id = wpmu_create_user( $domain, $password, $email );
+                       if ( false == $user_id )
+                               wp_die( __( 'There was an error creating the user.' ) );
+                       else
+                               wp_new_user_notification( $user_id, $password );
+               }
+
+               $wpdb->hide_errors();
+               $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
+               $wpdb->show_errors();
+               if ( !is_wp_error( $id ) ) {
+                       $dashboard_blog = get_dashboard_blog();
+                       if ( !is_super_admin( $user_id ) && get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
+                               update_user_option( $user_id, 'primary_blog', $id, true );
+                       $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
+                       wp_mail( get_site_option('admin_email'),  sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
+                       wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
+                       wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add-blog' ), wp_get_referer() ) );
+                       exit();
+               } else {
+                       wp_die( $id->get_error_message() );
+               }
+       break;
+
+       case 'updateblog':
+               check_admin_referer( 'editblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( empty( $_POST ) )
+                       wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">sites page</a>', esc_url( admin_url( 'ms-sites.php' ) ) ) ) );
+
+               switch_to_blog( $id );
+
+               // themes
+               $allowedthemes = array();
+               if ( isset($_POST['theme']) && is_array( $_POST['theme'] ) ) {
+                       foreach ( $_POST['theme'] as $theme => $val ) {
+                               if ( 'on' == $val )
+                                       $allowedthemes[$theme] = true;
+                       }
+               }
+               update_option( 'allowedthemes',  $allowedthemes );
+
+               // options
+               if ( is_array( $_POST['option'] ) ) {
+                       $c = 1;
+                       $count = count( $_POST['option'] );
+                       foreach ( (array) $_POST['option'] as $key => $val ) {
+                               if ( $key === 0 || is_array( $val ) )
+                                       continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
+                               if ( $c == $count )
+                                       update_option( $key, stripslashes( $val ) );
+                               else
+                                       update_option( $key, stripslashes( $val ), false ); // no need to refresh blog details yet
+                               $c++;
+                       }
+               }
+
+               // home and siteurl
+               if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
+                       $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
+                       if ( get_option( 'siteurl' ) !=  $blog_address )
+                               update_option( 'siteurl', $blog_address );
+
+                       if ( get_option( 'home' ) != $blog_address )
+                               update_option( 'home', $blog_address );
+               }
+
+               // rewrite rules can't be flushed during switch to blog
+               delete_option( 'rewrite_rules' );
+
+               // update blogs table
+               $blog_data = stripslashes_deep( $_POST['blog'] );
+               update_blog_details( $id, $blog_data );
+
+               // get blog prefix
+               $blog_prefix = $wpdb->get_blog_prefix( $id );
+
+               // user roles
+               if ( isset( $_POST['role'] ) && is_array( $_POST['role'] ) == true ) {
+                       $newroles = $_POST['role'];
+
+                       reset( $newroles );
+                       foreach ( (array) $newroles as $userid => $role ) {
+                               $user = new WP_User( $userid );
+                               if ( ! $user )
+                                       continue;
+                               $user->for_blog( $id );
+                               $user->set_role( $role );
+                       }
+               }
+
+               // remove user
+               if ( isset( $_POST['blogusers'] ) && is_array( $_POST['blogusers'] ) ) {
+                       reset( $_POST['blogusers'] );
+                       foreach ( (array) $_POST['blogusers'] as $key => $val )
+                               remove_user_from_blog( $key, $id );
+               }
+
+               // change password
+               if ( isset( $_POST['user_password'] ) && is_array( $_POST['user_password'] ) ) {
+                       reset( $_POST['user_password'] );
+                       $newroles = $_POST['role'];
+                       foreach ( (array) $_POST['user_password'] as $userid => $pass ) {
+                               unset( $_POST['role'] );
+                               $_POST['role'] = $newroles[ $userid ];
+                               if ( $pass != '' ) {
+                                       $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
+                                       $userdata = get_userdata($userid);
+                                       $_POST['pass1'] = $_POST['pass2'] = $pass;
+                                       $_POST['email'] = $userdata->user_email;
+                                       $_POST['rich_editing'] = $userdata->rich_editing;
+                                       edit_user( $userid );
+                                       if ( $cap == null )
+                                               $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
+                               }
+                       }
+                       unset( $_POST['role'] );
+                       $_POST['role'] = $newroles;
+               }
+
+               // add user
+               if ( !empty( $_POST['newuser'] ) ) {
+                       $newuser = $_POST['newuser'];
+                       $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) );
+                       if ( $userid ) {
+                               $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" );
+                               if ( $user == false )
+                                       add_user_to_blog( $id, $userid, $_POST['new_role'] );
+                       }
+               }
+               do_action( 'wpmu_update_blog_options' );
+               restore_current_blog();
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'editblog', 'id' => $id ), wp_get_referer() ) );
+       break;
+
+       case 'deleteblog':
+               check_admin_referer('deleteblog');
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( $id != '0' && $id != $current_site->blog_id )
+                       wpmu_delete_blog( $id, true );
+
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'allblogs':
+               if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) {
+                       check_admin_referer( 'bulk-ms-sites', '_wpnonce_bulk-ms-sites' );
+
+                       if ( ! current_user_can( 'manage_sites' ) )
+                               wp_die( __( 'You do not have permission to access this page.' ) );
+
+                       if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+                               $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
+
+                       foreach ( (array) $_POST['allblogs'] as $key => $val ) {
+                               if ( $val != '0' && $val != $current_site->blog_id ) {
+                                       switch ( $doaction ) {
+                                               case 'delete':
+                                                       $blogfunction = 'all_delete';
+                                                       wpmu_delete_blog( $val, true );
+                                               break;
+
+                                               case 'spam':
+                                                       $blogfunction = 'all_spam';
+                                                       update_blog_status( $val, 'spam', '1', 0 );
+                                                       set_time_limit( 60 );
+                                               break;
+
+                                               case 'notspam':
+                                                       $blogfunction = 'all_notspam';
+                                                       update_blog_status( $val, 'spam', '0', 0 );
+                                                       set_time_limit( 60 );
+                                               break;
+                                       }
+                               } else {
+                                       wp_die( __( 'You are not allowed to change the current site.' ) );
+                               }
+                       }
+
+                       wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
+                       exit();
+               } else {
+                       wp_redirect( admin_url( 'ms-sites.php' ) );
+               }
+       break;
+
+       case 'archiveblog':
+               check_admin_referer( 'archiveblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               update_blog_status( $id, 'archived', '1' );
+               do_action( 'archive_blog', $id );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'unarchiveblog':
+               check_admin_referer( 'unarchiveblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               do_action( 'unarchive_blog', $id );
+               update_blog_status( $id, 'archived', '0' );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'activateblog':
+               check_admin_referer( 'activateblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               update_blog_status( $id, 'deleted', '0' );
+               do_action( 'activate_blog', $id );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'deactivateblog':
+               check_admin_referer( 'deactivateblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               do_action( 'deactivate_blog', $id );
+               update_blog_status( $id, 'deleted', '1' );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'unspamblog':
+               check_admin_referer( 'unspamblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               update_blog_status( $id, 'spam', '0' );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       case 'spamblog':
+               check_admin_referer( 'spamblog' );
+               if ( ! current_user_can( 'manage_sites' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               update_blog_status( $id, 'spam', '1' );
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       // Themes
+    case 'updatethemes':
+       if ( ! current_user_can( 'manage_network_themes' ) )
+               wp_die( __( 'You do not have permission to access this page.' ) );
+
+       if ( is_array( $_POST['theme'] ) ) {
+                       $themes = get_themes();
+                       reset( $themes );
+                       $allowed_themes = array();
+                       foreach ( (array) $themes as $key => $theme ) {
+                               if ( $_POST['theme'][ esc_html( $theme['Stylesheet'] ) ] == 'enabled' )
+                                       $allowed_themes[ esc_html( $theme['Stylesheet'] ) ] = true;
+                       }
+                       update_site_option( 'allowedthemes', $allowed_themes );
+               }
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes' ),  wp_get_referer() ) );
+               exit();
+       break;
+
+       // Common
+       case 'confirm':
+               if ( !headers_sent() ) {
+                       nocache_headers();
+                       header( 'Content-Type: text/html; charset=utf-8' );
+               }
+               if ( $current_site->blog_id == $id )
+                       wp_die( __( 'You are not allowed to change the current site.' ) );
+               ?>
+               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+               <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
+                       <head>
+                               <title><?php _e( 'WordPress &rsaquo; Confirm your action' ); ?></title>
+
+                               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+                               <?php
+                               wp_admin_css( 'install', true );
+                               wp_admin_css( 'ie', true );
+                               ?>
+                       </head>
+                       <body>
+                               <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1>
+                               <form action="ms-edit.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
+                                       <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
+                                       <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
+                                       <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
+                                       <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
+                                       <p><?php echo esc_html( stripslashes( $_GET['msg'] ) ); ?></p>
+                                       <p class="submit"><input class="button" type="submit" value="<?php _e( 'Confirm' ); ?>" /></p>
+                               </form>
+                       </body>
+               </html>
+               <?php
+       break;
+
+       // Users
+       case 'deleteuser':
+               if ( ! current_user_can( 'manage_network_users' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               check_admin_referer( 'deleteuser' );
+
+               if ( $id != '0' && $id != '1' ) {
+                       $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays
+                       $title = __( 'Users' );
+                       $parent_file = 'ms-admin.php';
+                       require_once( 'admin-header.php' );
+                       echo '<div class="wrap">';
+                       confirm_delete_users( $_POST['allusers'] );
+                       echo '</div>';
+            require_once( 'admin-footer.php' );
+            exit();
+               } else {
+                       wp_redirect( admin_url( 'ms-users.php' ) );
+               }
+       break;
+
+       case 'allusers':
+               if ( ! current_user_can( 'manage_network_users' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( isset( $_POST['doaction']) || isset($_POST['doaction2'] ) ) {
+                       check_admin_referer( 'bulk-ms-users', '_wpnonce_bulk-ms-users' );
+
+                       if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+                               $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
+                       foreach ( (array) $_POST['allusers'] as $key => $val ) {
+                               if ( !empty( $val ) ) {
+                                       switch ( $doaction ) {
+                                               case 'delete':
+                                                       $title = __( 'Users' );
+                                                       $parent_file = 'ms-admin.php';
+                                                       require_once( 'admin-header.php' );
+                                                       echo '<div class="wrap">';
+                                                       confirm_delete_users( $_POST['allusers'] );
+                                                       echo '</div>';
+                                           require_once( 'admin-footer.php' );
+                                           exit();
+                                               break;
+
+                                               case 'spam':
+                                                       $user = new WP_User( $val );
+                                                       if ( in_array( $user->user_login, get_super_admins() ) )
+                                                               wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
+
+                                                       $userfunction = 'all_spam';
+                                                       $blogs = get_blogs_of_user( $val, true );
+                                                       foreach ( (array) $blogs as $key => $details ) {
+                                                               if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
+                                                                       update_blog_status( $details->userblog_id, 'spam', '1' );
+                                                       }
+                                                       update_user_status( $val, 'spam', '1', 1 );
+                                               break;
+
+                                               case 'notspam':
+                                                       $userfunction = 'all_notspam';
+                                                       $blogs = get_blogs_of_user( $val, true );
+                                                       foreach ( (array) $blogs as $key => $details )
+                                                               update_blog_status( $details->userblog_id, 'spam', '0' );
+
+                                                       update_user_status( $val, 'spam', '0', 1 );
+                                               break;
+                                       }
+                               }
+                       }
+
+                       wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
+                       exit();
+               } else {
+                       wp_redirect( admin_url( 'ms-users.php' ) );
+               }
+       break;
+
+       case 'dodelete':
+               check_admin_referer( 'ms-users-delete' );
+               if ( ! current_user_can( 'manage_network_users' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
+                       foreach ( $_POST['blog'] as $id => $users ) {
+                               foreach ( $users as $blogid => $user_id ) {
+                                       if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] )
+                                               remove_user_from_blog( $id, $blogid, $user_id );
+                                       else
+                                               remove_user_from_blog( $id, $blogid );
+                               }
+                       }
+               }
+               $i = 0;
+               if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) )
+                       foreach( $_POST['user'] as $id ) {
+                               wpmu_delete_user( $id );
+                               $i++;
+                       }
+
+               if ( $i == 1 )
+                       $deletefunction = 'delete';
+               else
+                       $deletefunction = 'all_delete';
+
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), admin_url( 'ms-users.php' ) ) );
+       break;
+
+       case 'adduser':
+               check_admin_referer( 'add-user', '_wpnonce_add-user' );
+               if ( ! current_user_can( 'manage_network_users' ) )
+                       wp_die( __( 'You do not have permission to access this page.' ) );
+
+               if ( is_array( $_POST['user'] ) == false )
+                       wp_die( __( 'Cannot create an empty user.' ) );
+               $user = $_POST['user'];
+               if ( empty($user['username']) && empty($user['email']) )
+                       wp_die( __( 'Missing username and email.' ) );
+               elseif ( empty($user['username']) )
+                       wp_die( __( 'Missing username.' ) );
+               elseif ( empty($user['email']) )
+                       wp_die( __( 'Missing email.' ) );
+
+               $password = wp_generate_password();
+               $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
+
+               if ( false == $user_id )
+                       wp_die( __( 'Duplicated username or email address.' ) );
+               else
+                       wp_new_user_notification( $user_id, $password );
+
+               if ( get_site_option( 'dashboard_blog' ) == false )
+                       add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
+               else
+                       add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
+
+               wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
+               exit();
+       break;
+
+       default:
+               wp_redirect( admin_url( 'ms-admin.php' ) );
+       break;
+}
+?>
diff --git a/wp-admin/ms-options.php b/wp-admin/ms-options.php
new file mode 100644 (file)
index 0000000..f6121bf
--- /dev/null
@@ -0,0 +1,318 @@
+<?php
+/**
+ * Multisite network settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( ! is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network_options' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Network Options' );
+$parent_file = 'ms-admin.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site&#8217;s options.') . '</p>' .
+       '<p>' . __('Operational settings has fields for the network&#8217;s name and admin email.') . '</p>' .
+       '<p>' . __('Dashboard Site is an option to give a site to users who do not have a site on the system. Their default role is Subscriber, but that default can be changed. The Admin Notice Feed can provide a notice on all dashboards of the latest post via RSS or Atom, or provide no such notice if left blank.') . '</p>' .
+       '<p>' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '</p>' .
+       '<p>' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what&#8127;s put in the first post, page, comment, comment author, and comment URL.') . '</p>' .
+       '<p>' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '</p>' .
+       '<p>' . __('Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list.') . '</p>' .
+       '<p>' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '</p>' .
+       '<p>' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Super Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Options_SubPanel" target="_blank">Network Options Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( './admin-header.php' );
+
+if (isset($_GET['updated'])) {
+       ?>
+       <div id="message" class="updated"><p><?php _e( 'Options saved.' ) ?></p></div>
+       <?php
+}
+?>
+
+<div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php _e( 'Network Options' ) ?></h2>
+       <form method="post" action="ms-edit.php?action=siteoptions">
+               <?php wp_nonce_field( 'siteoptions' ); ?>
+               <h3><?php _e( 'Operational Settings' ); ?></h3>
+               <table class="form-table">
+                       <tr valign="top">
+                               <th scope="row"><label for="site_name"><?php _e( 'Network Name' ) ?></label></th>
+                               <td>
+                                       <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />
+                                       <br />
+                                       <?php _e( 'What you would like to call this website.' ) ?>
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th>
+                               <td>
+                                       <input name="admin_email" type="text" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option('admin_email') ) ?>" />
+                                       <br />
+                                       <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), $current_site->domain ); ?>
+                               </td>
+                       </tr>
+               </table>
+               <h3><?php _e( 'Dashboard Settings' ); ?></h3>
+               <table class="form-table">
+                       <tr valign="top">
+                               <th scope="row"><label for="dashboard_blog"><?php _e( 'Dashboard Site' ) ?></label></th>
+                               <td>
+                                       <?php
+                                       if ( $dashboard_blog = get_site_option( 'dashboard_blog' ) ) {
+                                               $details = get_blog_details( $dashboard_blog );
+                                               $blogname = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $details->domain . $details->path ) ) ) );
+                                       } else {
+                                               $blogname = '';
+                                       }?>
+                                       <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr( $blogname ); ?>" />
+                                       <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr( $blogname ); ?>" class="regular-text" />
+                                       <br />
+                                       <?php _e( 'Site path (&#8220;dashboard&#8221;, &#8220;control&#8221;, &#8220;manager&#8221;, etc.) or blog ID.<br />New users are added to this site as the user role defined below if they don&#8217;t have a site. Leave blank for the main site. Users with the Subscriber role on the old site will be moved to the new site if changed. The new site will be created if it does not exist.' ); ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="default_user_role"><?php _e( 'Dashboard User Default Role' ) ?></label></th>
+                               <td>
+                                       <select name="default_user_role" id="default_user_role"><?php
+                                       wp_dropdown_roles( get_site_option( 'default_user_role', 'subscriber' ) );
+                                       ?>
+                                       </select>
+                                       <br />
+                                       <?php _e( 'The default role for new users on the Dashboard site. &#8220;Subscriber&#8221; or &#8220;Contributor&#8221; roles are recommended.' ); ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="admin_notice_feed"><?php _e( 'Admin Notice Feed' ) ?></label></th>
+                               <td><input name="admin_notice_feed" class="large-text" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br />
+                               <?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br />
+
+                               <?php if ( get_site_option( 'admin_notice_feed' ) != get_home_url( $current_site->id, 'feed/' ) )
+                                       echo __( 'A good one to use would be the feed from your main site: ' ) . esc_url( get_home_url( $current_site->id, 'feed/' ) ) ?></td>
+                       </tr>
+               </table>
+               <h3><?php _e( 'Registration Settings' ); ?></h3>
+               <table class="form-table">
+                       <tr valign="top">
+                               <th scope="row"><?php _e( 'Allow new registrations' ) ?></th>
+                               <?php
+                               if ( !get_site_option( 'registration' ) )
+                                       update_site_option( 'registration', 'none' );
+                               $reg = get_site_option( 'registration' );
+                               ?>
+                               <td>
+                                       <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br />
+                                       <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br />
+                                       <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br />
+                                       <label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label><br />
+                                       <p><?php _e( 'Disable or enable registration and who or what can be registered. (Default is disabled.)' ); ?></p>
+                                       <?php if ( is_subdomain_install() ) {
+                                               echo '<p>' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' ) . '</p>';
+                                       } ?>
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><?php _e( 'Registration notification' ) ?></th>
+                               <?php
+                               if ( !get_site_option( 'registrationnotification' ) )
+                                       update_site_option( 'registrationnotification', 'yes' );
+                               ?>
+                               <td>
+                                       <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked( get_site_option( 'registrationnotification' ), 'yes' ) ?> /> <?php _e( 'Send the network admin an email notification every time someone registers a site or user account.' ) ?></label>
+                               </td>
+                       </tr>
+
+                       <tr valign="top" id="addnewusers">
+                               <th scope="row"><?php _e( 'Add New Users' ) ?></th>
+                               <td>
+                                       <label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked( get_site_option( 'add_new_users' ) ) ?> /> <?php _e( 'Allow site administrators to add new users to their site via the "Users->Add New" page.' ); ?></label>
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th>
+                               <td>
+                                       <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
+                                       <br />
+                                       <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?>
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th>
+                               <td>
+                                       <?php $limited_email_domains = get_site_option( 'limited_email_domains' );
+                                       $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
+                                       <textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5">
+<?php echo wp_htmledit_pre( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
+                                       <br />
+                                       <?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?>
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th>
+                               <td>
+                                       <textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5">
+<?php echo wp_htmledit_pre( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea>
+                                       <br />
+                                       <?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?>
+                               </td>
+                       </tr>
+
+               </table>
+               <h3><?php _e('New Site Settings'); ?></h3>
+               <table class="form-table">
+
+                       <tr valign="top">
+                               <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
+                               <td>
+                                       <textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text">
+<?php echo wp_htmledit_pre( stripslashes( get_site_option( 'welcome_email' ) ) ) ?></textarea>
+                                       <br />
+                                       <?php _e( 'The welcome email sent to new site owners.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
+                               <td>
+                                       <textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text">
+<?php echo wp_htmledit_pre( stripslashes( get_site_option( 'welcome_user_email' ) ) ) ?></textarea>
+                                       <br />
+                                       <?php _e( 'The welcome email sent to new users.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
+                               <td>
+                                       <textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text">
+<?php echo wp_htmledit_pre( stripslashes( get_site_option( 'first_post' ) ) ) ?></textarea>
+                                       <br />
+                                       <?php _e( 'The first post on a new site.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
+                               <td>
+                                       <textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text">
+<?php echo wp_htmledit_pre( stripslashes( get_site_option('first_page') ) ) ?></textarea>
+                                       <br />
+                                       <?php _e( 'The first page on a new site.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
+                               <td>
+                                       <textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
+<?php echo wp_htmledit_pre( stripslashes( get_site_option('first_comment') ) ) ?></textarea>
+                                       <br />
+                                       <?php _e( 'The first comment on a new site.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
+                               <td>
+                                       <input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
+                                       <br />
+                                       <?php _e( 'The author of the first comment on a new site.' ) ?>
+                               </td>
+                       </tr>
+                       <tr valign="top">
+                               <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th>
+                               <td>
+                                       <input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
+                                       <br />
+                                       <?php _e( 'The URL for the first comment on a new site.' ) ?>
+                               </td>
+                       </tr>
+               </table>
+               <h3><?php _e( 'Upload Settings' ); ?></h3>
+               <table class="form-table">
+                       <tr valign="top">
+                               <th scope="row"><?php _e( 'Media upload buttons' ) ?></th>
+                               <?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?>
+                               <td><label><input type="checkbox" id="mu_media_buttons_image" name="mu_media_buttons[image]" value="1"<?php checked( ! empty( $mu_media_buttons['image'] ) ) ?>/> <?php _e( 'Images' ); ?></label><br />
+                               <label><input type="checkbox" id="mu_media_buttons_video" name="mu_media_buttons[video]" value="1"<?php checked( ! empty( $mu_media_buttons['video'] ) ) ?>/> <?php _e( 'Videos' ); ?></label><br />
+                               <label><input type="checkbox" id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value="1"<?php checked( ! empty( $mu_media_buttons['audio'] ) ) ?>/> <?php _e( 'Music' ); ?></label><br />
+                               <?php _e( 'The media upload buttons to display on the &#8220;Write Post&#8221; page. Make sure you update the allowed upload file types below as well.' ); ?></td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><?php _e( 'Site upload space' ) ?></th>
+                               <td>
+                               <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="text" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 10) ) . '" size="3" />' ); ?></label><br />
+                               </td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th>
+                               <td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option('upload_filetypes', 'jpg jpeg png gif') ) ?>" size="45" /></td>
+                       </tr>
+
+                       <tr valign="top">
+                               <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th>
+                               <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="text" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" size="5" />' ); ?></td>
+                       </tr>
+               </table>
+
+<?php
+               $languages = get_available_languages();
+               if ( ! empty( $languages ) ) {
+                       $lang = get_site_option( 'WPLANG' );
+?>
+               <h3><?php _e( 'Network Wide Settings' ); ?></h3>
+               <div class="updated inline"><p><strong><?php _e( 'Notice:' ); ?></strong> <?php _e( 'These settings may be overridden by site owners.' ); ?></p></div>
+               <table class="form-table">
+                       <?php
+                               ?>
+                               <tr valign="top">
+                                       <th><label for="WPLANG"><?php _e( 'Default Language' ) ?></label></th>
+                                       <td>
+                                               <select name="WPLANG" id="WPLANG">
+                                                       <?php mu_dropdown_languages( $languages, get_site_option( 'WPLANG' ) ); ?>
+                                               </select>
+                                       </td>
+                               </tr>
+               </table>
+<?php
+               } // languages
+?>
+
+               <h3><?php _e( 'Menu Settings' ); ?></h3>
+               <table id="menu" class="form-table">
+                       <tr valign="top">
+                               <th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
+                               <td>
+                       <?php
+                       $menu_perms = get_site_option( 'menu_items' );
+                       $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
+                       foreach ( (array) $menu_items as $key => $val ) {
+                               echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" .  ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
+                       }
+                       ?>
+                               </td>
+                       </tr>
+               </table>
+
+               <?php do_action( 'wpmu_options' ); // Add more options here ?>
+
+               <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes' ) ?>" /></p>
+       </form>
+</div>
+
+<?php include( './admin-footer.php' ); ?>
diff --git a/wp-admin/ms-sites.php b/wp-admin/ms-sites.php
new file mode 100644 (file)
index 0000000..c5918d9
--- /dev/null
@@ -0,0 +1,744 @@
+<?php
+/**
+ * Multisite sites administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( ! is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Sites' );
+$parent_file = 'ms-admin.php';
+
+if ( isset( $_GET['action'] ) && 'editblog' == $_GET['action'] ) {
+       add_contextual_help($current_screen,
+               '<p>' . __('This extensive list of options has five modules: Site Info, Site Options, allowing Site Themes for this given site, changing user roles and passwords for that site, adding a new user, and Miscellaneous Site Actions (upload size limits).') . '</p>' .
+               '<p>' . __('Note that some fields in Site Options are grayed out and say Serialized Data. These are stored values in the database which you cannot change from here.') . '</p>' .
+               '<p><strong>' . __('For more information:') . '</strong></p>' .
+               '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Sites_Edit_Site" target="_blank">Documentation on Editing Sites</a>') . '</p>' .
+               '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+} else {
+       add_contextual_help($current_screen,
+               '<p>' . __('Add New takes you farther down on this same page. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '</p>' .
+               '<p>' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '</p>' .
+               '<p>' . __('Hovering over each site reveals seven options (three for the primary site):') . '</p>' .
+               '<ul><li>' . __('an Edit link to a separate Edit Site screen.') . '</li>' .
+               '<li>' . __('Backend means the Dashboard for that site.') . '</li>' .
+               '<li>' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '</li>' .
+               '<li>' . __('Delete which is a permanent action after the confirmations screen.') . '</li>' .
+               '<li>' . __('Visit to go to the frontend site live.') . '</li></ul>' .
+               '<p>' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '</p>' .
+               '<p>' . __('Clicking on bold settings can re-sort this table. The upper right icons switch between list and excerpt views.') . '</p>' .
+               '<p>' . __("Clicking on Add Site, after filling out the address, title, and admin's email address, adds the site instantly to the network and this table. You may want to then click on the action link to edit options for that site.") . '</p>' .
+               '<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>' .
+               '<p><strong>' . __('For more information:') . '</strong></p>' .
+               '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Sites_SubPanel" target="_blank">Documentation on Sites</a>') . '</p>' .
+               '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+}
+
+wp_enqueue_script( 'admin-forms' );
+
+require_once( './admin-header.php' );
+
+$id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
+
+if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
+       ?>
+       <div id="message" class="updated"><p>
+               <?php
+               switch ( $_GET['action'] ) {
+                       case 'all_notspam':
+                               _e( 'Sites removed from spam.' );
+                       break;
+                       case 'all_spam':
+                               _e( 'Sites marked as spam.' );
+                       break;
+                       case 'all_delete':
+                               _e( 'Sites deleted.' );
+                       break;
+                       case 'delete':
+                               _e( 'Site deleted.' );
+                       break;
+                       case 'add-blog':
+                               _e( 'Site added.' );
+                       break;
+                       case 'archive':
+                               _e( 'Site archived.' );
+                       break;
+                       case 'unarchive':
+                               _e( 'Site unarchived.' );
+                       break;
+                       case 'activate':
+                               _e( 'Site activated.' );
+                       break;
+                       case 'deactivate':
+                               _e( 'Site deactivated.' );
+                       break;
+                       case 'unspam':
+                               _e( 'Site removed from spam.' );
+                       break;
+                       case 'spam':
+                               _e( 'Site marked as spam.' );
+                       break;
+                       default:
+                               _e( 'Settings saved.' );
+                       break;
+               }
+               ?>
+       </p></div>
+       <?php
+}
+
+$action = isset( $_GET['action'] ) ? $_GET['action'] : 'list';
+
+switch ( $action ) {
+       // Edit site
+       case 'editblog':
+               $blog_prefix = $wpdb->get_blog_prefix( $id );
+               $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'" );
+               $details = get_blog_details( $id );
+               $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
+               $is_main_site = is_main_site( $id );
+               ?>
+               <div class="wrap">
+               <?php screen_icon(); ?>
+               <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2>
+               <form method="post" action="ms-edit.php?action=updateblog">
+                       <?php wp_nonce_field( 'editblog' ); ?>
+                       <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+                       <div class="metabox-holder" style="width:49%;float:left;">
+                               <div id="blogedit_bloginfo" class="postbox">
+                               <h3 class="hndle"><span><?php _e( 'Site info (wp_blogs)' ); ?></span></h3>
+                               <div class="inside">
+                                       <table class="form-table">
+                                               <tr class="form-field form-required">
+                                                       <th scope="row"><?php _e( 'Domain' ) ?></th>
+                                                       <?php
+                                                       $protocol = is_ssl() ? 'https://' : 'http://';
+                                                       if ( $is_main_site ) { ?>
+                                                       <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td>
+                                                       <?php } else { ?>
+                                                       <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
+                                                       <?php } ?>
+                                               </tr>
+                                               <tr class="form-field form-required">
+                                                       <th scope="row"><?php _e( 'Path' ) ?></th>
+                                                       <?php if ( $is_main_site ) { ?>
+                                                       <td><code><?php echo esc_attr( $details->path ) ?></code></td>
+                                                       <?php } else { ?>
+                                                       <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' />
+                                                       <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
+                                                       <?php } ?>
+                                               </tr>
+                                               <tr class="form-field">
+                                                       <th scope="row"><?php _ex( 'Registered', 'site' ) ?></th>
+                                                       <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td>
+                                               </tr>
+                                               <tr class="form-field">
+                                                       <th scope="row"><?php _e('Last Updated') ?></th>
+                                                       <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td>
+                                               </tr>
+                                               <?php
+                                               $radio_fields = array( 'public' => __( 'Public' ) );
+                                               if ( ! $is_main_site ) {
+                                                       $radio_fields['archived'] = __( 'Archived' );
+                                                       $radio_fields['spam']     = _x( 'Spam', 'site' );
+                                                       $radio_fields['deleted']  = __( 'Deleted' );
+                                               }
+                                               $radio_fields['mature'] = __( 'Mature' );
+                                               foreach ( $radio_fields as $field_key => $field_label ) {
+                                               ?>
+                                               <tr>
+                                                       <th scope="row"><?php echo $field_label; ?></th>
+                                                       <td>
+                                                               <input type="radio" name="blog[<?php echo $field_key; ?>]" id="blog_<?php echo $field_key; ?>_1" value="1"<?php checked( $details->$field_key, 1 ); ?> />
+                                                               <label for="blog_<?php echo $field_key; ?>_1"><?php _e('Yes'); ?></label>
+                                                               <input type="radio" name="blog[<?php echo $field_key; ?>]" id="blog_<?php echo $field_key; ?>_0" value="0"<?php checked( $details->$field_key, 0 ); ?> />
+                                                               <label for="blog_<?php echo $field_key; ?>_0"><?php _e('No'); ?></label>
+                                                       </td>
+                                               </tr>
+                                               <?php } ?>
+                                       </table>
+                                       <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                               </div>
+                               </div>
+
+                               <div id="blogedit_blogoptions" class="postbox" >
+                               <h3 class="hndle"><span><?php printf( __( 'Site options (%soptions)' ), $blog_prefix ); ?></span></h3>
+                               <div class="inside">
+                                       <table class="form-table">
+                                               <?php
+                                               $editblog_default_role = 'subscriber';
+                                               foreach ( $options as $option ) {
+                                                       if ( $option->option_name == 'default_role' )
+                                                               $editblog_default_role = $option->option_value;
+                                                       $disabled = false;
+                                                       $class = 'all-options';
+                                                       if ( is_serialized( $option->option_value ) ) {
+                                                               if ( is_serialized_string( $option->option_value ) ) {
+                                                                       $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' );
+                                                               } else {
+                                                                       $option->option_value = 'SERIALIZED DATA';
+                                                                       $disabled = true;
+                                                                       $class = 'all-options disabled';
+                                                               }
+                                                       }
+                                                       if ( strpos( $option->option_value, "\n" ) !== false ) {
+                                                       ?>
+                                                               <tr class="form-field">
+                                                                       <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
+                                                                       <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php wp_htmledit_pre( $option->option_value ) ?></textarea></td>
+                                                               </tr>
+                                                       <?php
+                                                       } else {
+                                                       ?>
+                                                               <tr class="form-field">
+                                                                       <th scope="row"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
+                                                                       <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
+                                                                       <td><code><?php echo esc_html( $option->option_value ) ?></code></td>
+                                                                       <?php } else { ?>
+                                                                       <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
+                                                                       <?php } ?>
+                                                               </tr>
+                                                       <?php
+                                                       }
+                                               } // End foreach
+                                               ?>
+                                       </table>
+                                       <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                               </div>
+                               </div>
+                       </div>
+
+                       <div class="metabox-holder" style="width:49%;float:right;">
+                               <?php
+                               // Site Themes
+                               $themes = get_themes();
+                               $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
+                               $allowed_themes = get_site_option( 'allowedthemes' );
+
+                               if ( ! $allowed_themes )
+                                       $allowed_themes = array_keys( $themes );
+
+                               $out = '';
+                               foreach ( $themes as $key => $theme ) {
+                                       $theme_key = esc_html( $theme['Stylesheet'] );
+                                       if ( ! isset( $allowed_themes[$theme_key] ) ) {
+                                               $checked = isset( $blog_allowed_themes[ $theme_key ] ) ? 'checked="checked"' : '';
+                                               $out .= '<tr class="form-field form-required">
+                                                               <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html( $key ) . '</th>
+                                                               <td><label><input name="theme[' . esc_attr( $theme_key ) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/> ' . __( 'Active' ) . '</label></td>
+                                                       </tr>';
+                                       }
+                               }
+
+                               if ( $out != '' ) {
+                               ?>
+                               <div id="blogedit_blogthemes" class="postbox">
+                               <h3 class="hndle"><span><?php esc_html_e( 'Site Themes' ); ?></span></h3>
+                               <div class="inside">
+                                       <p class="description"><?php _e( 'Activate the themename of an existing theme and hit "Update Options" to allow the theme for this site.' ) ?></p>
+                                       <table class="form-table">
+                                               <?php echo $out; ?>
+                                       </table>
+                                       <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                               </div></div>
+                               <?php }
+
+                               // Site users
+                               $blogusers = get_users_of_blog( $id );
+                               if ( is_array( $blogusers ) ) {
+                                       echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">';
+                                       echo '<table class="form-table">';
+                                       echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>";
+                                       reset( $blogusers );
+                                       foreach ( (array) $blogusers as $key => $val ) {
+                                               if ( isset( $val->meta_value ) && ! $val->meta_value )
+                                                       continue;
+                                               $t = @unserialize( $val->meta_value );
+                                               if ( is_array( $t ) ) {
+                                                       reset( $t );
+                                                       $existing_role = key( $t );
+                                               }
+                                               echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
+                                               if ( $val->user_id != $current_user->data->ID ) {
+                                                       ?>
+                                                       <td>
+                                                               <select name="role[<?php echo $val->user_id ?>]" id="new_role_1"><?php
+                                                                       foreach ( $editblog_roles as $role => $role_assoc ){
+                                                                               $name = translate_user_role( $role_assoc['name'] );
+                                                                               echo '<option ' . selected( $role, $existing_role, false ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
+                                                                       }
+                                                                       ?>
+                                                               </select>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" name="user_password[<?php echo esc_attr( $val->user_id ) ?>]" />
+                                                       </td>
+                                                       <?php
+                                                       echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $val->user_id ) . ']" /></td>';
+                                               } else {
+                                                       echo "<td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __( 'N/A' ) . "</strong></td>";
+                                               }
+                                               echo '</tr>';
+                                       }
+                                       echo "</table>";
+                                       echo '<p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="' . esc_attr__( 'Update Options' ) . '" /></p>';
+                                       echo "</div></div>";
+                               }
+                               ?>
+
+                               <div id="blogedit_blogadduser" class="postbox">
+                               <h3 class="hndle"><span><?php _e( 'Add a new user' ); ?></span></h3>
+                               <div class="inside">
+                                       <p class="description"><?php _e( 'Enter the username of an existing user and hit &#8220;Update Options&#8221; to add the user.' ) ?></p>
+                                       <table class="form-table">
+                                                       <tr>
+                                                               <th scope="row"><?php _e( 'User&nbsp;Login:' ) ?></th>
+                                                               <td><input type="text" name="newuser" id="newuser" /></td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th scope="row"><?php _e( 'Role:' ) ?></th>
+                                                               <td>
+                                                                       <select name="new_role" id="new_role_0">
+                                                                       <?php
+                                                                       reset( $editblog_roles );
+                                                                       foreach ( $editblog_roles as $role => $role_assoc ){
+                                                                               $name = translate_user_role( $role_assoc['name'] );
+                                                                               $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
+                                                                               echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
+                                                                       }
+                                                                       ?>
+                                                                       </select>
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                               </div>
+                               </div>
+
+                               <div id="blogedit_miscoptions" class="postbox">
+                               <h3 class="hndle"><span><?php _e( 'Misc Site Actions' ) ?></span></h3>
+                               <div class="inside">
+                                       <table class="form-table">
+                                                       <?php do_action( 'wpmueditblogaction', $id ); ?>
+                                       </table>
+                                       <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
+                               </div>
+                               </div>
+                       </div>
+
+                       <div style="clear:both;"></div>
+               </form>
+               </div>
+               <?php
+       break;
+
+       // List sites
+       case 'list':
+       default:
+               $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
+               if ( empty($pagenum) )
+                       $pagenum = 1;
+
+               $per_page = (int) get_user_option( 'ms_sites_per_page' );
+               if ( empty( $per_page ) || $per_page < 1 )
+                       $per_page = 15;
+
+               $per_page = apply_filters( 'ms_sites_per_page', $per_page );
+
+               $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
+               $like_s = esc_sql( like_escape( $s ) );
+
+               $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
+
+               if ( isset( $_GET['searchaction'] ) ) {
+                       if ( 'name' == $_GET['searchaction'] ) {
+                               $query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
+                       } elseif ( 'id' == $_GET['searchaction'] ) {
+                               $query .= " AND {$wpdb->blogs}.blog_id = '{$like_s}' ";
+                       } elseif ( 'ip' == $_GET['searchaction'] ) {
+                               $query = "SELECT *
+                                       FROM {$wpdb->blogs}, {$wpdb->registration_log}
+                                       WHERE site_id = '{$wpdb->siteid}'
+                                       AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
+                                       AND {$wpdb->registration_log}.IP LIKE ('%{$like_s}%')";
+                       }
+               }
+
+               $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
+               if ( $order_by == 'registered' ) {
+                       $query .= ' ORDER BY registered ';
+               } elseif ( $order_by == 'lastupdated' ) {
+                       $query .= ' ORDER BY last_updated ';
+               } elseif ( $order_by == 'blogname' ) {
+                       $query .= ' ORDER BY domain ';
+               } else {
+                       $order_by = 'id';
+                       $query .= " ORDER BY {$wpdb->blogs}.blog_id ";
+               }
+
+               $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? "DESC" : "ASC";
+               $query .= $order;
+
+               $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query ) );
+
+               $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page );
+               $blog_list = $wpdb->get_results( $query, ARRAY_A );
+
+               $num_pages = ceil($total / $per_page);
+               $page_links = paginate_links( array(
+                       'base' => add_query_arg( 'paged', '%#%' ),
+                       'format' => '',
+                       'prev_text' => __( '&laquo;' ),
+                       'next_text' => __( '&raquo;' ),
+                       'total' => $num_pages,
+                       'current' => $pagenum
+               ));
+
+               if ( empty( $_GET['mode'] ) )
+                       $mode = 'list';
+               else
+                       $mode = esc_attr( $_GET['mode'] );
+               ?>
+
+               <div class="wrap">
+               <?php screen_icon(); ?>
+               <h2><?php _e('Sites') ?>
+               <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a>
+               <?php
+               if ( isset( $_GET['s'] ) && $_GET['s'] )
+               printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
+               ?>
+               </h2>
+
+               <form action="ms-sites.php" method="get" id="ms-search">
+               <p class="search-box">
+               <input type="hidden" name="action" value="blogs" />
+               <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" />
+               <input type="submit" class="button" value="<?php esc_attr_e( 'Search Site by' ) ?>" />
+               <select name="searchaction">
+                       <option value="name" selected="selected"><?php _e( 'Name' ); ?></option>
+                       <option value="id"><?php _e( 'ID' ); ?></option>
+                       <option value="ip"><?php _e( 'IP address' ); ?></option>
+               </select>
+               </p>
+               </form>
+
+               <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post">
+               <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" />
+               <div class="tablenav">
+               <div class="alignleft actions">
+                       <select name="action">
+                               <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
+                               <option value="delete"><?php _e( 'Delete' ); ?></option>
+                               <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option>
+                               <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option>
+                       </select>
+                       <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+                       <?php wp_nonce_field( 'bulk-ms-sites', '_wpnonce_bulk-ms-sites' ); ?>
+               </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( ( $pagenum - 1 ) * $per_page + 1 ),
+               number_format_i18n( min( $pagenum * $per_page, $total ) ),
+               number_format_i18n( $total ),
+               $page_links
+               ); echo $page_links_text; ?>
+               </div>
+               <?php } ?>
+
+               <div class="view-switch">
+                       <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a>
+                       <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a>
+               </div>
+
+               </div>
+
+               <div class="clear"></div>
+
+               <?php
+               // define the columns to display, the syntax is 'internal name' => 'display name'
+               $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' );
+               $sites_columns = array(
+                       'id'           => __( 'ID' ),
+                       'blogname'     => $blogname_columns,
+                       'lastupdated'  => __( 'Last Updated'),
+                       'registered'   => _x( 'Registered', 'site' ),
+                       'users'        => __( 'Users' )
+               );
+
+               if ( has_filter( 'wpmublogsaction' ) )
+                       $sites_columns['plugins'] = __( 'Actions' );
+
+               $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns );
+               ?>
+
+               <table class="widefat">
+                       <thead>
+                               <tr>
+                               <th class="manage-column column-cb check-column" id="cb" scope="col">
+                                       <input type="checkbox" />
+                               </th>
+                               <?php
+                               $col_url = '';
+                               foreach($sites_columns as $column_id => $column_display_name) {
+                                       $column_link = "<a href='";
+                                       $order2 = '';
+                                       if ( $order_by == $column_id )
+                                               $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC';
+
+                                       $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );
+                                       $column_link .= "'>{$column_display_name}</a>";
+                                       $col_url .= '<th scope="col">' . ( ( $column_id == 'users' || $column_id == 'plugins' ) ? $column_display_name : $column_link ) . '</th>';
+                               }
+                               echo $col_url ?>
+                               </tr>
+                       </thead>
+                       <tfoot>
+                               <tr>
+                               <th class="manage-column column-cb check-column" id="cb1" scope="col">
+                                       <input type="checkbox" />
+                               </th>
+                                       <?php echo $col_url ?>
+                               </tr>
+                       </tfoot>
+                       <tbody id="the-site-list" class="list:site">
+                       <?php
+                       $status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ) );
+                       if ( $blog_list ) {
+                               $class = '';
+                               foreach ( $blog_list as $blog ) {
+                                       $class = ( 'alternate' == $class ) ? '' : 'alternate';
+                                       reset( $status_list );
+
+                                       $blog_states = array();
+                                       foreach ( $status_list as $status => $col ) {
+                                               if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
+                                                       $class = $col[0];
+                                                       $blog_states[] = $col[1];
+                                               }
+                                       }
+                                       $blog_state = '';
+                                       if ( ! empty( $blog_states ) ) {
+                                               $state_count = count( $blog_states );
+                                               $i = 0;
+                                               $blog_state .= ' - ';
+                                               foreach ( $blog_states as $state ) {
+                                                       ++$i;
+                                                       ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+                                                       $blog_state .= "<span class='post-state'>$state$sep</span>";
+                                               }
+                                       }
+                                       echo "<tr class='$class'>";
+
+                                       $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
+                                       foreach ( $sites_columns as $column_name=>$column_display_name ) {
+                                               switch ( $column_name ) {
+                                                       case 'id': ?>
+                                                               <th scope="row" class="check-column">
+                                                                       <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
+                                                               </th>
+                                                               <th valign="top" scope="row">
+                                                                       <?php echo $blog['blog_id'] ?>
+                                                               </th>
+                                                       <?php
+                                                       break;
+
+                                                       case 'blogname': ?>
+                                                               <td class="column-title">
+                                                                       <a href="<?php echo esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
+                                                                       <?php
+                                                                       if ( 'list' != $mode )
+                                                                               echo '<p>' . sprintf( _x( '%1$s &#8211; <em>%2$s</em>', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '</p>';
+
+                                                                       // Preordered.
+                                                                       $actions = array(
+                                                                               'edit' => '', 'backend' => '',
+                                                                               'activate' => '', 'deactivate' => '',
+                                                                               'archive' => '', 'unarchive' => '',
+                                                                               'spam' => '', 'unspam' => '',
+                                                                               'delete' => '',
+                                                                               'visit' => '',
+                                                                       );
+
+                                                                       $actions['edit']        = '<span class="edit"><a href="' . esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
+                                                                       $actions['backend']     = "<span class='backend'><a href='" . esc_url( get_admin_url($blog['blog_id']) ) . "' class='edit'>" . __( 'Backend' ) . '</a></span>';
+                                                                       if ( $current_site->blog_id != $blog['blog_id'] ) {
+                                                                               if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
+                                                                                       $actions['activate']    = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ) ) . '">' . __( 'Activate' ) . '</a></span>';
+                                                                               else
+                                                                                       $actions['deactivate']  = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
+
+                                                                               if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
+                                                                                       $actions['unarchive']   = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' .  $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
+                                                                               else
+                                                                                       $actions['archive']     = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
+
+                                                                               if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
+                                                                                       $actions['unspam']      = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
+                                                                               else
+                                                                                       $actions['spam']        = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
+
+                                                                               $actions['delete']      = '<span class="delete"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ) ) . '">' . __( 'Delete' ) . '</a></span>';
+                                                                       }
+
+                                                                       $actions['visit']       = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
+                                                                       $actions = array_filter( $actions );
+                                                                       if ( count( $actions ) ) : ?>
+                                                                       <div class="row-actions">
+                                                                               <?php echo implode( ' | ', $actions ); ?>
+                                                                       </div>
+                                                                       <?php endif; ?>
+                                                               </td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'lastupdated': ?>
+                                                               <td valign="top">
+                                                                       <?php
+                                                                       if ( 'list' == $mode )
+                                                                               $date = 'Y/m/d';
+                                                                       else
+                                                                               $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+                                                                       echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( __( $date ), $blog['last_updated'] ); ?>
+                                                               </td>
+                                                       <?php
+                                                       break;
+                                               case 'registered': ?>
+                                                               <td valign="top">
+                                                               <?php
+                                                               if ( $blog['registered'] == '0000-00-00 00:00:00' )
+                                                                       echo '&#x2014;';
+                                                               else
+                                                                       echo mysql2date( __( $date ), $blog['registered'] );
+                                                               ?>
+                                                               </td>
+                                               <?php
+                                               break;
+                                                       case 'users': ?>
+                                                               <td valign="top">
+                                                                       <?php
+                                                                       $blogusers = get_users_of_blog( $blog['blog_id'] );
+                                                                       if ( is_array( $blogusers ) ) {
+                                                                               $blogusers_warning = '';
+                                                                               if ( count( $blogusers ) > 5 ) {
+                                                                                       $blogusers = array_slice( $blogusers, 0, 5 );
+                                                                                       $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>';
+                                                                               }
+                                                                               foreach ( $blogusers as $key => $val ) {
+                                                                                       echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> ';
+                                                                                       if ( 'list' != $mode )
+                                                                                               echo '(' . $val->user_email . ')';
+                                                                                       echo '<br />';
+                                                                               }
+                                                                               if ( $blogusers_warning != '' )
+                                                                                       echo '<strong>' . $blogusers_warning . '</strong><br />';
+                                                                       }
+                                                                       ?>
+                                                               </td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'plugins': ?>
+                                                               <?php if ( has_filter( 'wpmublogsaction' ) ) { ?>
+                                                               <td valign="top">
+                                                                       <?php do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
+                                                               </td>
+                                                               <?php } ?>
+                                                       <?php break;
+
+                                                       default: ?>
+                                                               <?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?>
+                                                               <td valign="top">
+                                                                       <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id'] ); ?>
+                                                               </td>
+                                                               <?php } ?>
+                                                       <?php break;
+                                               }
+                                       }
+                                       ?>
+                                       </tr>
+                                       <?php
+                               }
+                       } else { ?>
+                               <tr>
+                                       <td colspan="<?php echo (int) count( $sites_columns ); ?>"><?php _e( 'No sites found.' ) ?></td>
+                               </tr>
+                       <?php
+                       } // end if ($blogs)
+                       ?>
+
+                       </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>
+                               <option value="delete"><?php _e( 'Delete' ); ?></option>
+                               <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option>
+                               <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option>
+                       </select>
+                       <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+                       </div>
+                       <br class="clear" />
+               </div>
+
+               </form>
+               </div>
+
+               <div id="form-add-site" class="wrap">
+                       <h3><?php _e( 'Add Site' ) ?></h3>
+                       <form method="post" action="ms-edit.php?action=addblog">
+                               <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?>
+                               <table class="form-table">
+                                       <tr class="form-field form-required">
+                                               <th scope="row"><?php _e( 'Site Address' ) ?></th>
+                                               <td>
+                                               <?php if ( is_subdomain_install() ) { ?>
+                                                       <input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'Domain' ) ?>"/>.<?php echo preg_replace( '|^www\.|', '', $current_site->domain );?>
+                                               <?php } else {
+                                                       echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e( 'Domain' ) ?>"/>
+                                               <?php }
+                                               echo '<p>' . __( 'Only the characters a-z and 0-9 recommended.' ) . '</p>';
+                                               ?>
+                                               </td>
+                                       </tr>
+                                       <tr class="form-field form-required">
+                                               <th scope="row"><?php _e( 'Site Title' ) ?></th>
+                                               <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e( 'Title' ) ?>"/></td>
+                                       </tr>
+                                       <tr class="form-field form-required">
+                                               <th scope="row"><?php _e( 'Admin Email' ) ?></th>
+                                               <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e( 'Email' ) ?>"/></td>
+                                       </tr>
+                                       <tr class="form-field">
+                                               <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td>
+                                       </tr>
+                               </table>
+                               <p class="submit">
+                                       <input class="button" type="submit" name="go" value="<?php esc_attr_e( 'Add Site' ) ?>" /></p>
+                       </form>
+               </div>
+               <?php
+       break;
+} // end switch( $action )
+
+include( './admin-footer.php' ); ?>
diff --git a/wp-admin/ms-themes.php b/wp-admin/ms-themes.php
new file mode 100644 (file)
index 0000000..e6fd9b5
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Multisite themes administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( ! current_user_can( 'manage_network_themes' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Network Themes' );
+$parent_file = 'ms-admin.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '</p>' .
+       '<p>' . __('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site&#8217;s Appearance > Themes screen.') . '</p>' .
+       '<p>' . __('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen you go to via the Edit action link on the Sites screen.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Themes_SubPanel" target="_blank">Documentation on Network Themes</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( './admin-header.php' );
+
+if ( isset( $_GET['updated'] ) ) {
+       ?>
+       <div id="message" class="updated"><p><?php _e( 'Site themes saved.' ) ?></p></div>
+       <?php
+}
+
+$themes = get_themes();
+$allowed_themes = get_site_allowed_themes();
+?>
+<div class="wrap">
+       <form action="<?php echo esc_url( admin_url( 'ms-edit.php?action=updatethemes' ) ); ?>" method="post">
+               <?php screen_icon(); ?>
+               <h2><?php _e( 'Network Themes' ) ?></h2>
+               <p><?php _e( 'Themes must be enabled for your network before they will be available to individual sites.' ) ?></p>
+               <p class="submit">
+                       <input type="submit" value="<?php _e( 'Apply Changes' ) ?>" /></p>
+               <table class="widefat">
+                       <thead>
+                               <tr>
+                                       <th style="width:15%;"><?php _e( 'Enable' ) ?></th>
+                                       <th style="width:25%;"><?php _e( 'Theme' ) ?></th>
+                                       <th style="width:10%;"><?php _e( 'Version' ) ?></th>
+                                       <th style="width:60%;"><?php _e( 'Description' ) ?></th>
+                               </tr>
+                       </thead>
+                       <tbody id="plugins">
+                       <?php
+                       $total_theme_count = $activated_themes_count = 0;
+                       $class = '';
+                       foreach ( (array) $themes as $key => $theme ) {
+                               $total_theme_count++;
+                               $theme_key = esc_html( $theme['Stylesheet'] );
+                               $class = ( 'alt' == $class ) ? '' : 'alt';
+                               $class1 = $enabled = $disabled = '';
+                               $enabled = $disabled = false;
+
+                               if ( isset( $allowed_themes[$theme_key] ) == true ) {
+                                       $enabled = true;
+                                       $activated_themes_count++;
+                                       $class1 = 'active';
+                               } else {
+                                       $disabled = true;
+                               }
+                               ?>
+                               <tr valign="top" class="<?php echo $class . ' ' . $class1; ?>">
+                                       <td>
+                                               <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php checked( $enabled ) ?> /> <?php _e( 'Yes' ) ?></label>
+                                               &nbsp;&nbsp;&nbsp;
+                                               <label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php checked( $disabled ) ?> /> <?php _e( 'No' ) ?></label>
+                                       </td>
+                                       <th scope="row" style="text-align:left;"><?php echo $key ?></th>
+                                       <td><?php echo $theme['Version'] ?></td>
+                                       <td><?php echo $theme['Description'] ?></td>
+                               </tr>
+                       <?php } ?>
+                       </tbody>
+               </table>
+
+               <p class="submit">
+                       <input type="submit" value="<?php _e( 'Apply Changes' ) ?>" /></p>
+       </form>
+
+       <h3><?php _e( 'Total' )?></h3>
+       <p>
+               <?php printf( __( 'Themes Installed: %d' ), $total_theme_count); ?>
+               <br />
+               <?php printf( __( 'Themes Enabled: %d' ), $activated_themes_count); ?>
+       </p>
+</div>
+
+<?php include( './admin-footer.php' ); ?>
diff --git a/wp-admin/ms-upgrade-network.php b/wp-admin/ms-upgrade-network.php
new file mode 100644 (file)
index 0000000..5bcee65
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Multisite upgrade administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once('admin.php');
+
+if ( !is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+require_once( ABSPATH . WPINC . '/http.php' );
+
+$title = __( 'Update Network' );
+$parent_file = 'ms-admin.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('Only use this screen once you have updated to a new version of WordPress through Dashboard > Updates. Clicking the Update Network button will step through each site in the network, five at a time, and make sure any database upgrades are applied.') . '</p>' .
+       '<p>' . __('If a version update to core has not happened, clicking this button won&#8217;t affect anything.') . '</p>' .
+       '<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Update_SubPanel" target="_blank">Update Network Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once('admin-header.php');
+
+if ( ! current_user_can( 'manage_network' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+echo '<div class="wrap">';
+screen_icon();
+echo '<h2>' . __( 'Update Network' ) . '</h2>';
+
+$action = isset($_GET['action']) ? $_GET['action'] : 'show';
+
+switch ( $action ) {
+       case "upgrade":
+               $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
+
+               if ( $n < 5 ) {
+                       global $wp_db_version;
+                       update_site_option( 'wpmu_upgrade_site', $wp_db_version );
+               }
+
+               $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
+               if ( empty( $blogs ) ) {
+                       echo '<p>' . __( 'All done!' ) . '</p>';
+                       break;
+               }
+               echo "<ul>";
+               foreach ( (array) $blogs as $details ) {
+                       $siteurl = get_blog_option( $details['blog_id'], 'siteurl' );
+                       echo "<li>$siteurl</li>";
+                       $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=upgrade_db", array( 'timeout' => 120, 'httpversion' => '1.1' ) );
+                       if ( is_wp_error( $response ) )
+                               wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: <em>%2$s</em>' ), $siteurl, $response->get_error_message() ) );
+                       do_action( 'after_mu_upgrade', $response );
+                       do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
+               }
+               echo "</ul>";
+               ?><p><?php _e( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:' ); ?> <a class="button" href="ms-upgrade-network.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p>
+               <script type='text/javascript'>
+               <!--
+               function nextpage() {
+                       location.href = "ms-upgrade-network.php?action=upgrade&n=<?php echo ($n + 5) ?>";
+               }
+               setTimeout( "nextpage()", 250 );
+               //-->
+               </script><?php
+       break;
+       case 'show':
+       default:
+               ?><p><?php _e( 'You can update all the sites on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update.' ); ?></p>
+               <p><a class="button" href="ms-upgrade-network.php?action=upgrade"><?php _e("Update Network"); ?></a></p><?php
+               do_action( 'wpmu_upgrade_page' );
+       break;
+}
+?>
+</div>
+
+<?php include('./admin-footer.php'); ?>
diff --git a/wp-admin/ms-users.php b/wp-admin/ms-users.php
new file mode 100644 (file)
index 0000000..594406a
--- /dev/null
@@ -0,0 +1,378 @@
+<?php
+/**
+ * Multisite users administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( !is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network_users' ) )
+       wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Users' );
+$parent_file = 'ms-admin.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('This table shows all users across the network and the sites to which they are assigned.') . '</p>' .
+       '<p>' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '</p>' .
+       '<p>' . __('You can also go to the user&#8217;s profile page by clicking on the individual username.') . '</p>' .
+       '<p>' . __('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.') . '</p>' .
+       '<p>' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '</p>' .
+       '<p>' . __('Add User will add that person to this table and send them an email.') . '</p>' .
+       '<p>' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '</p>' .
+       '<p>' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Super_Admin_Users_SubPanel" target="_blank">Network Users Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+wp_enqueue_script( 'admin-forms' );
+
+require_once( './admin-header.php' );
+
+if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
+       ?>
+       <div id="message" class="updated"><p>
+               <?php
+               switch ( $_GET['action'] ) {
+                       case 'delete':
+                               _e( 'User deleted.' );
+                       break;
+                       case 'all_spam':
+                               _e( 'Users marked as spam.' );
+                       break;
+                       case 'all_notspam':
+                               _e( 'Users removed from spam.' );
+                       break;
+                       case 'all_delete':
+                               _e( 'Users deleted.' );
+                       break;
+                       case 'add':
+                               _e( 'User added.' );
+                       break;
+               }
+               ?>
+       </p></div>
+       <?php
+}
+
+       $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
+       if ( empty( $pagenum ) )
+               $pagenum = 1;
+
+       $per_page = (int) get_user_option( 'ms_users_per_page' );
+       if ( empty( $per_page ) || $per_page < 1 )
+               $per_page = 15;
+
+       $per_page = apply_filters( 'ms_users_per_page', $per_page );
+
+       $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
+       $like_s = esc_sql( like_escape( $s ) );
+
+       $query = "SELECT * FROM {$wpdb->users}";
+
+       if ( !empty( $like_s ) ) {
+               $query .= " WHERE user_login LIKE '%$like_s%' OR user_email LIKE '%$like_s%'";
+       }
+
+       $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
+       if ( $order_by == 'email' ) {
+               $query .= ' ORDER BY user_email ';
+       } elseif ( $order_by == 'login' ) {
+               $query .= ' ORDER BY user_login ';
+       } elseif ( $order_by == 'name' ) {
+               $query .= ' ORDER BY display_name ';
+       } elseif ( $order_by == 'registered' ) {
+               $query .= ' ORDER BY user_registered ';
+       } else {
+               $order_by = 'id';
+               $query .= ' ORDER BY ID ';
+       }
+
+       $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? 'DESC' : 'ASC';
+       $query .= $order;
+
+       $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(ID)', $query ) );
+
+       $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page );
+
+       $user_list = $wpdb->get_results( $query, ARRAY_A );
+
+       $num_pages = ceil( $total / $per_page );
+       $page_links = paginate_links( array(
+               'base' => add_query_arg( 'paged', '%#%' ),
+               'format' => '',
+               'prev_text' => __( '&laquo;' ),
+               'next_text' => __( '&raquo;' ),
+               'total' => $num_pages,
+               'current' => $pagenum
+       ));
+
+       if ( empty( $_GET['mode'] ) )
+               $mode = 'list';
+       else
+               $mode = esc_attr( $_GET['mode'] );
+
+       ?>
+       <div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php esc_html_e( 'Users' ); ?>
+       <a href="#form-add-user" class="button add-new-h2"><?php echo esc_html_x( 'Add New' , 'users'); ?></a>
+       <?php
+       if ( isset( $_GET['s'] ) && $_GET['s'] )
+       printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
+       ?>
+       </h2>
+
+       <form action="ms-users.php" method="get" class="search-form">
+               <p class="search-box">
+               <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" class="search-input" id="user-search-input" />
+               <input type="submit" id="post-query-submit" value="<?php esc_attr_e( 'Search Users' ) ?>" class="button" />
+               </p>
+       </form>
+
+       <form id="form-user-list" action='ms-edit.php?action=allusers' method='post'>
+               <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" />
+               <div class="tablenav">
+                       <div class="alignleft actions">
+                               <select name="action">
+                                       <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
+                                       <option value="delete"><?php _e( 'Delete' ); ?></option>
+                                       <option value="spam"><?php _ex( 'Mark as Spam', 'user' ); ?></option>
+                                       <option value="notspam"><?php _ex( 'Not Spam', 'user' ); ?></option>
+                               </select>
+                               <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+                               <?php wp_nonce_field( 'bulk-ms-users', '_wpnonce_bulk-ms-users' ); ?>
+                       </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( ( $pagenum - 1 ) * $per_page + 1 ),
+                       number_format_i18n( min( $pagenum * $per_page, $total ) ),
+                       number_format_i18n( $total ),
+                       $page_links
+                       ); echo $page_links_text; ?>
+                       </div>
+                       <?php } ?>
+
+                       <div class="view-switch">
+                               <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a>
+                               <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a>
+                       </div>
+               </div>
+               <div class="clear"></div>
+
+               <?php
+               // define the columns to display, the syntax is 'internal name' => 'display name'
+               $users_columns = array(
+                       'id'           => __( 'ID' ),
+                       'login'      => __( 'Username' ),
+                       'name'       => __( 'Name' ),
+                       'email'      => __( 'E-mail' ),
+                       'registered' => _x( 'Registered', 'user' ),
+                       'blogs'      => __( 'Sites' )
+               );
+               $users_columns = apply_filters( 'wpmu_users_columns', $users_columns );
+               ?>
+               <table class="widefat">
+                       <thead>
+                       <tr>
+                               <th class="manage-column column-cb check-column" scope="col">
+                                       <input type="checkbox" />
+                               </th>
+                               <?php
+                               $col_url = '';
+                               foreach($users_columns as $column_id => $column_display_name) {
+                                       $column_link = "<a href='";
+                                       $order2 = '';
+                                       if ( $order_by == $column_id )
+                                               $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC';
+
+                                       $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array( 'action', 'updated' ), $_SERVER['REQUEST_URI'] ) ) );
+                                       $column_link .= "'>{$column_display_name}</a>";
+                                       $col_url .= '<th scope="col">' . ( $column_id == 'blogs' ? $column_display_name : $column_link ) . '</th>';
+                               }
+                               echo $col_url; ?>
+                       </tr>
+                       </thead>
+                       <tfoot>
+                       <tr>
+                               <th class="manage-column column-cb check-column" scope="col">
+                                       <input type="checkbox" />
+                               </th>
+                               <?php echo $col_url; ?>
+                       </tr>
+                       </tfoot>
+                       <tbody id="the-user-list" class="list:user">
+                       <?php if ( $user_list ) {
+                               $class = '';
+                               $super_admins = get_super_admins();
+                               foreach ( (array) $user_list as $user ) {
+                                       $class = ( 'alternate' == $class ) ? '' : 'alternate';
+
+                                       $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' );
+
+                                       foreach ( $status_list as $status => $col ) {
+                                               if ( $user[$status] )
+                                                       $class = $col;
+                                       }
+
+                                       ?>
+                                       <tr class="<?php echo $class; ?>">
+                                       <?php
+                                       foreach( (array) $users_columns as $column_name=>$column_display_name ) :
+                                               switch( $column_name ) {
+                                                       case 'id': ?>
+                                                               <th scope="row" class="check-column">
+                                                                       <input type="checkbox" id="blog_<?php echo $user['ID'] ?>" name="allusers[]" value="<?php echo esc_attr( $user['ID'] ) ?>" />
+                                                               </th>
+                                                               <th valign="top" scope="row">
+                                                                       <?php echo $user['ID'] ?>
+                                                               </th>
+                                                       <?php
+                                                       break;
+
+                                                       case 'login':
+                                                               $avatar = get_avatar( $user['user_email'], 32 );
+                                                               $edit_link = ( $current_user->ID == $user['ID'] ) ? 'profile.php' : 'user-edit.php?user_id=' . $user['ID'];
+                                                               ?>
+                                                               <td class="username column-username">
+                                                                       <?php echo $avatar; ?><strong><a href="<?php echo esc_url( admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user['user_login'] ); ?></a><?php
+                                                                       if ( in_array( $user['user_login'], $super_admins ) )
+                                                                               echo ' - ' . __( 'Super admin' );
+                                                                       ?></strong>
+                                                                       <br/>
+                                                                       <div class="row-actions">
+                                                                               <span class="edit"><a href="<?php echo esc_url( admin_url( $edit_link ) ); ?>"><?php _e( 'Edit' ); ?></a></span>
+                                                                               <?php if ( ! in_array( $user['user_login'], $super_admins ) ) { ?>
+                                                                               | <span class="delete"><a href="<?php echo $delete      = esc_url( admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'ms-edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user['ID'] ) ) ); ?>" class="delete"><?php _e( 'Delete' ); ?></a></span>
+                                                                               <?php } ?>
+                                                                       </div>
+                                                               </td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'name': ?>
+                                                               <td class="name column-name"><?php echo $user['display_name'] ?></td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'email': ?>
+                                                               <td class="email column-email"><a href="mailto:<?php echo $user['user_email'] ?>"><?php echo $user['user_email'] ?></a></td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'registered':
+                                                               if ( 'list' == $mode )
+                                                                       $date = 'Y/m/d';
+                                                               else
+                                                                       $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+                                                       ?>
+                                                               <td><?php echo mysql2date( __( $date ), $user['user_registered'] ); ?></td>
+                                                       <?php
+                                                       break;
+
+                                                       case 'blogs':
+                                                               $blogs = get_blogs_of_user( $user['ID'], true );
+                                                               ?>
+                                                               <td>
+                                                                       <?php
+                                                                       if ( is_array( $blogs ) ) {
+                                                                               foreach ( (array) $blogs as $key => $val ) {
+                                                                                       $path   = ( $val->path == '/' ) ? '' : $val->path;
+                                                                                       echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $val->userblog_id  ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
+                                                                                       echo ' <small class="row-actions">';
+
+                                                                                       // Edit
+                                                                                       echo '<a href="'. esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $val->userblog_id  ) ) .'">' . __( 'Edit' ) . '</a> | ';
+
+                                                                                       // View
+                                                                                       echo '<a ';
+                                                                                       if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
+                                                                                               echo 'style="background-color: #faa" ';
+                                                                                       echo 'href="' .  esc_url( get_home_url( $val->userblog_id ) )  . '">' . __( 'View' ) . '</a>';
+
+                                                                                       echo '</small><br />';
+                                                                               }
+                                                                       }
+                                                                       ?>
+                                                               </td>
+                                                       <?php
+                                                       break;
+
+                                                       default: ?>
+                                                               <td><?php do_action( 'manage_users_custom_column', $column_name, $user['ID'] ); ?></td>
+                                                       <?php
+                                                       break;
+                                               }
+                                       endforeach
+                                       ?>
+                                       </tr>
+                                       <?php
+                               }
+                       } else {
+                       ?>
+                               <tr>
+                                       <td colspan="<?php echo (int) count($users_columns); ?>"><?php _e( 'No users found.' ) ?></td>
+                               </tr>
+                               <?php
+                       } // end if ($users)
+                       ?>
+                       </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>
+                                       <option value="delete"><?php _e( 'Delete' ); ?></option>
+                                       <option value="spam"><?php _ex( 'Mark as Spam', 'user' ); ?></option>
+                                       <option value="notspam"><?php _ex( 'Not Spam', 'user' ); ?></option>
+                               </select>
+                               <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+                       </div>
+                       <br class="clear" />
+               </div>
+
+               </form>
+               </div>
+
+<?php
+if ( apply_filters( 'show_adduser_fields', true ) ) :
+?>
+<div class="wrap" id="form-add-user">
+       <h3><?php _e( 'Add User' ) ?></h3>
+       <form action="ms-edit.php?action=adduser" method="post">
+       <table class="form-table">
+               <tr class="form-field form-required">
+                       <th scope="row"><?php _e( 'Username' ) ?></th>
+                       <td><input type="text" class="regular-text" name="user[username]" /></td>
+               </tr>
+               <tr class="form-field form-required">
+                       <th scope="row"><?php _e( 'Email' ) ?></th>
+                       <td><input type="text" class="regular-text" name="user[email]" /></td>
+               </tr>
+               <tr class="form-field">
+                       <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
+               </tr>
+       </table>
+       <p class="submit">
+               <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
+               <input class="button" type="submit" value="<?php esc_attr_e( 'Add user' ) ?>" /></p>
+       </form>
+</div>
+<?php endif; ?>
+
+<?php include( './admin-footer.php' ); ?>
diff --git a/wp-admin/my-sites.php b/wp-admin/my-sites.php
new file mode 100644 (file)
index 0000000..f38ac1c
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+/**
+ * My Sites dashboard.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( './admin.php' );
+
+if ( !is_multisite() )
+       wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can('read') )
+       wp_die( __( 'You do not have sufficient permissions to view this page.' ) );
+
+$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
+
+$blogs = get_blogs_of_user( $current_user->id );
+
+if ( empty( $blogs ) )
+       wp_die( __( 'You must be a member of at least one site to use this page.' ) );
+
+$updated = false;
+if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
+       check_admin_referer( 'update-my-sites' );
+
+       $blog = get_blog_details( (int) $_POST['primary_blog'] );
+       if ( $blog && isset( $blog->domain ) ) {
+               update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
+               $updated = true;
+       } else {
+               wp_die( __( 'The primary site you chose does not exist.' ) );
+       }
+}
+
+$title = __( 'My Sites' );
+$parent_file = 'index.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' .
+       '<p>' . __('Up until WordPress version 3.0, what is now called a Multi-site Network had to be installed separately as WordPress MU (multi-user).') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_SubPanel" target="_blank">My Sites Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( './admin-header.php' );
+
+if ( $updated ) { ?>
+       <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
+<?php } ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo esc_html( $title ); ?></h2>
+<form id="myblogs" action="" method="post">
+       <?php
+       choose_primary_blog();
+       do_action( 'myblogs_allblogs_options' );
+       ?>
+       <br clear="all" />
+       <table class="widefat fixed">
+       <?php
+       $settings_html = apply_filters( 'myblogs_options', '', 'global' );
+       if ( $settings_html != '' ) {
+               echo '<tr><td valign="top"><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
+               echo $settings_html;
+               echo '</td></tr>';
+       }
+       reset( $blogs );
+       $num = count( $blogs );
+       $cols = 1;
+       if ( $num >= 20 )
+               $cols = 4;
+       elseif ( $num >= 10 )
+               $cols = 2;
+       $num_rows = ceil( $num / $cols );
+       $split = 0;
+       for ( $i = 1; $i <= $num_rows; $i++ ) {
+               $rows[] = array_slice( $blogs, $split, $cols );
+               $split = $split + $cols;
+       }
+
+       $c = '';
+       foreach ( $rows as $row ) {
+               $c = $c == 'alternate' ? '' : 'alternate';
+               echo "<tr class='$c'>";
+               $i = 0;
+               foreach ( $row as $user_blog ) {
+                       $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
+                       echo "<td valign='top' style='$s'>";
+                       echo "<h3>{$user_blog->blogname}</h3>";
+                       echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
+                       echo apply_filters( 'myblogs_options', '', $user_blog );
+                       echo "</td>";
+                       $i++;
+               }
+               echo "</tr>";
+       }?>
+       </table>
+       <input type="hidden" name="action" value="updateblogsettings" />
+       <?php wp_nonce_field( 'update-my-sites' ); ?>
+       <p>
+        <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
+       </p>
+       </form>
+       </div>
+<?php
+include( './admin-footer.php' );
+?>
diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php
new file mode 100644 (file)
index 0000000..5b4bd44
--- /dev/null
@@ -0,0 +1,604 @@
+<?php
+/**
+ * WordPress Administration for Navigation Menus
+ * Interface functions
+ *
+ * @version 2.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( 'admin.php' );
+
+// Load all the nav menu interface functions
+require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
+
+if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
+       wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
+
+// Permissions Check
+if ( ! current_user_can('edit_theme_options') )
+       wp_die( __( 'Cheatin&#8217; uh?' ) );
+
+// Nav Menu CSS
+wp_admin_css( 'nav-menu' );
+
+// jQuery
+wp_enqueue_script( 'jquery' );
+wp_enqueue_script( 'jquery-ui-draggable' );
+wp_enqueue_script( 'jquery-ui-droppable' );
+wp_enqueue_script( 'jquery-ui-sortable' );
+
+// Nav Menu functions
+wp_enqueue_script( 'nav-menu' );
+
+// Metaboxes
+wp_enqueue_script( 'common' );
+wp_enqueue_script( 'wp-lists' );
+wp_enqueue_script( 'postbox' );
+
+// Container for any messages displayed to the user
+$messages = array();
+
+// Container that stores the name of the active menu
+$nav_menu_selected_title = '';
+
+// The menu id of the current menu being edited
+$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
+
+// Allowed actions: add, update, delete
+$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
+
+switch ( $action ) {
+       case 'add-menu-item':
+               check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+               if ( isset( $_REQUEST['nav-menu-locations'] ) )
+                       set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
+               elseif ( isset( $_REQUEST['menu-item'] ) )
+                       wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
+               break;
+       case 'move-down-menu-item' :
+               // moving down a menu item is the same as moving up the next in order
+               check_admin_referer( 'move-menu_item' );
+               $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
+               if ( is_nav_menu_item( $menu_item_id ) ) {
+                       $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
+                       if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
+                               $menu_id = (int) $menus[0];
+                               $ordered_menu_items = wp_get_nav_menu_items( $menu_id );
+                               $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
+
+                               // setup the data we need in one pass through the array of menu items
+                               $dbids_to_orders = array();
+                               $orders_to_dbids = array();
+                               foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
+                                       if ( isset( $ordered_menu_item_object->ID ) ) {
+                                               if ( isset( $ordered_menu_item_object->menu_order ) ) {
+                                                       $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
+                                                       $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
+                                               }
+                                       }
+                               }
+
+                               // get next in order
+                               if (
+                                       isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] )
+                               ) {
+                                       $next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1];
+                                       $next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) );
+
+                                       // if not siblings of same parent, bubble menu item up but keep order
+                                       if (
+                                               ! empty( $menu_item_data['menu_item_parent'] ) &&
+                                               (
+                                                       empty( $next_item_data['menu_item_parent'] ) ||
+                                                       $next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent']
+                                               )
+                                       ) {
+
+                                               $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+
+                                               $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
+
+                                               if ( ! is_wp_error( $parent_object ) ) {
+                                                       $parent_data = (array) $parent_object;
+                                                       $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
+                                                       update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+
+                                               }
+
+                                       // make menu item a child of its next sibling
+                                       } else {
+                                               $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1;
+                                               $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;
+
+                                               $menu_item_data['menu_item_parent'] = $next_item_data['ID'];
+                                               update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+
+                                               wp_update_post($menu_item_data);
+                                               wp_update_post($next_item_data);
+                                       }
+
+
+                               // the item is last but still has a parent, so bubble up
+                               } elseif (
+                                       ! empty( $menu_item_data['menu_item_parent'] ) &&
+                                       in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
+                               ) {
+                                       $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
+                                       update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+                               }
+                       }
+               }
+
+               break;
+       case 'move-up-menu-item' :
+               check_admin_referer( 'move-menu_item' );
+               $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
+               if ( is_nav_menu_item( $menu_item_id ) ) {
+                       $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
+                       if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
+                               $menu_id = (int) $menus[0];
+                               $ordered_menu_items = wp_get_nav_menu_items( $menu_id );
+                               $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
+
+                               // setup the data we need in one pass through the array of menu items
+                               $dbids_to_orders = array();
+                               $orders_to_dbids = array();
+                               foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
+                                       if ( isset( $ordered_menu_item_object->ID ) ) {
+                                               if ( isset( $ordered_menu_item_object->menu_order ) ) {
+                                                       $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
+                                                       $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
+                                               }
+                                       }
+                               }
+
+
+                               // if this menu item is not first
+                               if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) {
+
+                                       // if this menu item is a child of the previous
+                                       if (
+                                               ! empty( $menu_item_data['menu_item_parent'] ) &&
+                                               in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
+                                               isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) &&
+                                               ( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] )
+                                       ) {
+                                               $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+                                               $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
+
+                                               if ( ! is_wp_error( $parent_object ) ) {
+                                                       $parent_data = (array) $parent_object;
+
+                                                       // if there is something before the parent and parent a child of it, make menu item a child also of it
+                                                       if (
+                                                               ! empty( $dbids_to_orders[$parent_db_id] ) &&
+                                                               ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) &&
+                                                               ! empty( $parent_data['menu_item_parent'] )
+                                                       ) {
+                                                               $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
+
+                                                       // else if there is something before parent and parent not a child of it, make menu item a child of that something's parent
+                                                       } elseif (
+                                                               ! empty( $dbids_to_orders[$parent_db_id] ) &&
+                                                               ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
+                                                       ) {
+                                                               $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
+                                                               if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) )
+                                                                       $menu_item_data['menu_item_parent'] = $_possible_parent_id;
+                                                               else
+                                                                       $menu_item_data['menu_item_parent'] = 0;
+
+                                                       // else there isn't something before the parent
+                                                       } else {
+                                                               $menu_item_data['menu_item_parent'] = 0;
+                                                       }
+
+                                                       // set former parent's [menu_order] to that of menu-item's
+                                                       $parent_data['menu_order'] = $parent_data['menu_order'] + 1;
+
+                                                       // set menu-item's [menu_order] to that of former parent
+                                                       $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;
+
+                                                       // save changes
+                                                       update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+                                                       wp_update_post($menu_item_data);
+                                                       wp_update_post($parent_data);
+                                               }
+
+                                       // else this menu item is not a child of the previous
+                                       } elseif (
+                                               empty( $menu_item_data['menu_order'] ) ||
+                                               empty( $menu_item_data['menu_item_parent'] ) ||
+                                               ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) ||
+                                               empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ||
+                                               $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent']
+                                       ) {
+                                               // just make it a child of the previous; keep the order
+                                               $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
+                                               update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+                                               wp_update_post($menu_item_data);
+                                       }
+                               }
+                       }
+               }
+               break;
+
+       case 'delete-menu-item':
+               $menu_item_id = (int) $_REQUEST['menu-item'];
+
+               check_admin_referer( 'delete-menu_item_' . $menu_item_id );
+
+
+               if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
+                       $messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
+               break;
+       case 'delete':
+               check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
+
+               if ( is_nav_menu( $nav_menu_selected_id ) ) {
+                       $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_selected_id );
+                       $delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );
+
+                       if ( is_wp_error($delete_nav_menu) ) {
+                               $messages[] = '<div id="message" class="error"><p>' . $delete_nav_menu->get_error_message() . '</p></div>';
+                       } else {
+                               // Remove this menu from any locations.
+                               $locations = get_theme_mod( 'nav_menu_locations' );
+                               foreach ( (array) $locations as $location => $menu_id ) {
+                                       if ( $menu_id == $nav_menu_selected_id )
+                                               $locations[ $location ] = 0;
+                               }
+                               set_theme_mod( 'nav_menu_locations', $locations );
+                               $messages[] = '<div id="message" class="updated"><p>' . __('The menu has been successfully deleted.') . '</p></div>';
+                               // Select the next available menu
+                               $nav_menu_selected_id = 0;
+                               $_nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
+                               foreach( $_nav_menus as $index => $_nav_menu ) {
+                                       if ( strcmp( $_nav_menu->name, $deleted_nav_menu->name ) >= 0
+                                        || $index == count( $_nav_menus ) - 1 ) {
+                                               $nav_menu_selected_id = $_nav_menu->term_id;
+                                               break;
+                                       }
+                               }
+                       }
+                       unset( $delete_nav_menu, $deleted_nav_menu, $_nav_menus );
+               } else {
+                       // Reset the selected menu
+                       $nav_menu_selected_id = 0;
+                       unset( $_REQUEST['menu'] );
+               }
+               break;
+
+       case 'update':
+               check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
+
+               // Update menu theme locations
+               if ( isset( $_POST['menu-locations'] ) )
+                       set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
+
+               // Add Menu
+               if ( 0 == $nav_menu_selected_id ) {
+                       $new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
+
+                       if ( $new_menu_title ) {
+                               $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );
+
+                               if ( is_wp_error( $_nav_menu_selected_id ) ) {
+                                       $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
+                               } else {
+                                       if ( ( $_menu_locations = get_registered_nav_menus() ) && 1 == count( wp_get_nav_menus() ) )
+                                               set_theme_mod( 'nav_menu_locations', array( key( $_menu_locations ) => $_nav_menu_selected_id ) );
+                                       unset( $_menu_locations );
+                                       $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+                                       $nav_menu_selected_id = $_nav_menu_selected_id;
+                                       $nav_menu_selected_title = $_menu_object->name;
+                                       $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been successfully created.'), $nav_menu_selected_title ) . '</p></div>';
+                               }
+                       } else {
+                               $messages[] = '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>';
+                       }
+
+               // update existing menu
+               } else {
+
+                       $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
+
+                       $menu_title = trim( esc_html( $_POST['menu-name'] ) );
+                       if ( ! $menu_title ) {
+                               $messages[] = '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>';
+                               $menu_title = $_menu_object->name;
+                       }
+
+                       if ( ! is_wp_error( $_menu_object ) ) {
+                               $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) );
+                               if ( is_wp_error( $_nav_menu_selected_id ) ) {
+                                       $_menu_object = $_nav_menu_selected_id;
+                                       $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
+                               } else {
+                                       $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+                                       $nav_menu_selected_title = $_menu_object->name;
+                               }
+                       }
+
+                       // Update menu items
+
+                       if ( ! is_wp_error( $_menu_object ) ) {
+                               $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish') );
+                               $menu_items = array();
+                               // Index menu items by db ID
+                               foreach( $unsorted_menu_items as $_item )
+                                       $menu_items[$_item->db_id] = $_item;
+
+                               $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' );
+                               wp_defer_term_counting(true);
+                               // Loop through all the menu items' POST variables
+                               if ( ! empty( $_POST['menu-item-db-id'] ) ) {
+                                       foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
+
+                                               // Menu item title can't be blank
+                                               if ( empty( $_POST['menu-item-title'][$_key] ) )
+                                                       continue;
+
+                                               $args = array();
+                                               foreach ( $post_fields as $field )
+                                                       $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
+
+                                               $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
+
+                                               if ( is_wp_error( $menu_item_db_id ) )
+                                                       $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
+                                               elseif ( isset( $menu_items[$menu_item_db_id] ) )
+                                                       unset( $menu_items[$menu_item_db_id] );
+                                       }
+                               }
+
+                               // Remove menu items from the menu that weren't in $_POST
+                               if ( ! empty( $menu_items ) ) {
+                                       foreach ( array_keys( $menu_items ) as $menu_item_id ) {
+                                               if ( is_nav_menu_item( $menu_item_id ) ) {
+                                                       wp_delete_post( $menu_item_id );
+                                               }
+                                       }
+                               }
+
+                               // Store 'auto-add' pages.
+                               $auto_add = ! empty( $_POST['auto-add-pages'] );
+                               $nav_menu_option = (array) get_option( 'nav_menu_options' );
+                               if ( ! isset( $nav_menu_option['auto_add'] ) )
+                                       $nav_menu_option['auto_add'] = array();
+                               if ( $auto_add ) {
+                                       if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
+                                               $nav_menu_option['auto_add'][] = $nav_menu_selected_id;
+                               } else {
+                                       if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
+                                               unset( $nav_menu_option['auto_add'][$key] );
+                               }
+                               // Remove nonexistent/deleted menus
+                               $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
+                               update_option( 'nav_menu_options', $nav_menu_option );
+
+                               wp_defer_term_counting(false);
+
+                               do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
+
+                               $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>';
+                               unset( $menu_items, $unsorted_menu_items );
+                       }
+               }
+               break;
+}
+
+// Get all nav menus
+$nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
+
+// Get recently edited nav menu
+$recently_edited = (int) get_user_option( 'nav_menu_recently_edited' );
+
+// If there was no recently edited menu, and $nav_menu_selected_id is a nav menu, update recently edited menu.
+if ( !$recently_edited && is_nav_menu( $nav_menu_selected_id ) ) {
+       $recently_edited = $nav_menu_selected_id;
+
+// Else if $nav_menu_selected_id is not a menu and not requesting that we create a new menu, but $recently_edited is a menu, grab that one.
+} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && is_nav_menu( $recently_edited ) ) {
+       $nav_menu_selected_id = $recently_edited;
+
+// Else try to grab the first menu from the menus list
+} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && ! empty($nav_menus) ) {
+       $nav_menu_selected_id = $nav_menus[0]->term_id;
+}
+
+// Update the user's setting
+if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
+       update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
+
+// If there's a menu, get its name.
+if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
+       $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
+       $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
+}
+
+// Generate truncated menu names
+foreach( (array) $nav_menus as $key => $_nav_menu ) {
+       $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40 ) );
+       if ( $_nav_menu->truncated_name != $_nav_menu->name )
+               $_nav_menu->truncated_name .= '&hellip;';
+
+       $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
+}
+
+// Ensure the user will be able to scroll horizontally
+// by adding a class for the max menu depth.
+global $_wp_nav_menu_max_depth;
+$_wp_nav_menu_max_depth = 0;
+
+// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
+if ( is_nav_menu( $nav_menu_selected_id ) )
+       $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id  );
+
+function wp_nav_menu_max_depth() {
+       global $_wp_nav_menu_max_depth;
+       return "menu-max-depth-$_wp_nav_menu_max_depth";
+}
+
+add_action('admin_body_class','wp_nav_menu_max_depth');
+
+wp_nav_menu_setup();
+wp_initial_nav_menu_meta_boxes();
+
+if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
+       echo '<div id="message" class="updated"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
+
+$help =  '<p>' . __('This feature is new in version 3.0; to use a custom menu in place of your theme&#8217;s default menus, support for this feature must be registered in the theme&#8217;s functions.php file. If your theme does not support the custom menus feature yet (the new default theme, Twenty Ten, does), you can learn about adding support yourself by following the below link.') . '</p>';
+$help .= '<p>' . __('You can create custom menus for your site. These menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget.') . '</p>';
+$help .= '<p>' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You&#8217;ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. You&#8217;ll see when the position of the drop target shifts over to create the nested placement. Don&#8217;t forget to click Save when you&#8217;re finished.') . '</p>';
+$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Appearance_Menus_SubPanel" target="_blank">Menus Documentation</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+
+add_contextual_help($current_screen, $help);
+
+// Get the admin header
+require_once( 'admin-header.php' );
+?>
+<div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php esc_html_e('Menus'); ?></h2>
+       <?php
+       foreach( $messages as $message ) :
+               echo $message . "\n";
+       endforeach;
+       ?>
+       <div id="nav-menus-frame">
+       <div id="menu-settings-column" class="metabox-holder<?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?>">
+
+               <form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
+                       <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
+                       <input type="hidden" name="action" value="add-menu-item" />
+                       <?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?>
+                       <?php do_meta_boxes( 'nav-menus', 'side', null ); ?>
+               </form>
+
+       </div><!-- /#menu-settings-column -->
+       <div id="menu-management-liquid">
+               <div id="menu-management">
+                       <div id="select-nav-menu-container" class="hide-if-js">
+                               <form id="select-nav-menu" action="">
+                                       <strong><label for="select-nav-menu"><?php esc_html_e( 'Select Menu:' ); ?></label></strong>
+                                       <select class="select-nav-menu" name="menu">
+                                               <?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
+                                                       <option value="<?php echo esc_attr($_nav_menu->term_id) ?>" <?php selected($nav_menu_selected_id, $_nav_menu->term_id); ?>>
+                                                               <?php echo esc_html( $_nav_menu->truncated_name ); ?>
+                                                       </option>
+                                               <?php endforeach; ?>
+                                               <option value="0"><?php esc_html_e('Add New Menu'); ?></option>
+                                       </select>
+                                       <input type="hidden" name="action" value="edit" />
+                                       <input class="button-secondary" name="select_menu" type="submit" value="<?php esc_attr_e('Select'); ?>" />
+                               </form>
+                       </div>
+                       <div class="nav-tabs-wrapper">
+                       <div class="nav-tabs">
+                               <?php
+                               foreach( (array) $nav_menus as $_nav_menu ) :
+                                       if ( $nav_menu_selected_id == $_nav_menu->term_id ) : ?><span class="nav-tab nav-tab-active">
+                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
+                                               </span><?php else : ?><a href="<?php
+                                                       echo esc_url(add_query_arg(
+                                                               array(
+                                                                       'action' => 'edit',
+                                                                       'menu' => $_nav_menu->term_id,
+                                                               ),
+                                                               admin_url( 'nav-menus.php' )
+                                                       ));
+                                               ?>" class="nav-tab hide-if-no-js">
+                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
+                                               </a><?php endif;
+                               endforeach;
+                               if ( 0 == $nav_menu_selected_id ) : ?><span class="nav-tab menu-add-new nav-tab-active">
+                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
+                               </span><?php else : ?><a href="<?php
+                                       echo esc_url(add_query_arg(
+                                               array(
+                                                       'action' => 'edit',
+                                                       'menu' => 0,
+                                               ),
+                                               admin_url( 'nav-menus.php' )
+                                       ));
+                               ?>" class="nav-tab menu-add-new">
+                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
+                               </a><?php endif; ?>
+                       </div>
+                       </div>
+                       <div class="menu-edit">
+                               <form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
+                                       <div id="nav-menu-header">
+                                               <div id="submitpost" class="submitbox">
+                                                       <div class="major-publishing-actions">
+                                                               <label class="menu-name-label howto open-label" for="menu-name">
+                                                                       <span><?php _e('Menu Name'); ?></span>
+                                                                       <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Enter menu name here'); ?>" value="<?php echo esc_attr( $nav_menu_selected_title  ); ?>" />
+                                                               </label>
+                                                               <?php if ( !empty( $nav_menu_selected_id ) ) :
+                                                                       if ( ! isset( $auto_add ) ) {
+                                                                               $auto_add = get_option( 'nav_menu_options' );
+                                                                               if ( ! isset( $auto_add['auto_add'] ) )
+                                                                                       $auto_add = false;
+                                                                               elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
+                                                                                       $auto_add = true;
+                                                                               else
+                                                                                       $auto_add = false;
+                                                                       }
+                                                               ?>
+                                                               <div class="auto-add-pages">
+                                                                       <label class="howto"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" value="1" /> <?php printf( __('Automatically add new top-level pages' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label>
+                                                               </div>
+                                                               <?php endif; ?>
+                                                               <br class="clear" />
+                                                               <div class="publishing-action">
+                                                                       <input class="button-primary menu-save" name="save_menu" type="submit" value="<?php empty($nav_menu_selected_id) ? esc_attr_e('Create Menu') : esc_attr_e('Save Menu'); ?>" />
+                                                               </div><!-- END .publishing-action -->
+
+                                                               <?php if ( ! empty( $nav_menu_selected_id ) ) : ?>
+                                                               <div class="delete-action">
+                                                                       <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&amp;menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?>"><?php _e('Delete Menu'); ?></a>
+                                                               </div><!-- END .delete-action -->
+                                                               <?php endif; ?>
+                                                       </div><!-- END .major-publishing-actions -->
+                                               </div><!-- END #submitpost .submitbox -->
+                                               <?php
+                                               wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+                                               wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+                                               wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
+                                               ?>
+                                               <input type="hidden" name="action" value="update" />
+                                               <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
+                                       </div><!-- END #nav-menu-header -->
+                                       <div id="post-body">
+                                               <div id="post-body-content">
+                                                       <?php
+                                                       if ( isset( $edit_markup ) ) {
+                                                               if ( ! is_wp_error( $edit_markup ) )
+                                                                       echo $edit_markup;
+                                                       } else if ( empty( $nav_menu_selected_id ) ) {
+                                                               echo '<div class="post-body-plain">';
+                                                               echo '<p>' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '</p>';
+                                                               echo '<p>' . __('After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options.') . '</p>';
+                                                               echo '<p>' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '</p>';
+                                                               echo '</div>';
+                                                       }
+                                                       ?>
+                                               </div><!-- /#post-body-content -->
+                                       </div><!-- /#post-body -->
+                               </form><!-- /#update-nav-menu -->
+                       </div><!-- /.menu-edit -->
+               </div><!-- /#menu-management -->
+       </div><!-- /#menu-management-liquid -->
+       </div><!-- /#nav-menus-frame -->
+</div><!-- /.wrap-->
+
+
+<?php include( 'admin-footer.php' ); ?>
diff --git a/wp-admin/network.php b/wp-admin/network.php
new file mode 100644 (file)
index 0000000..a295164
--- /dev/null
@@ -0,0 +1,523 @@
+<?php
+/**
+ * Network installation administration panel.
+ *
+ * A multi-step process allowing the user to enable a network of WordPress sites.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+define( 'WP_NETWORK_ADMIN_PAGE', true );
+
+/** WordPress Administration Bootstrap */
+require_once( './admin.php' );
+
+if ( ! is_super_admin() )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+if ( is_multisite() && ! defined( 'MULTISITE' ) )
+       wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+
+// We need to create references to ms global tables to enable Network.
+foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
+       $wpdb->$table = $prefixed_table;
+
+/**
+ * Check for an existing network.
+ *
+ * @since 3.0.0
+ * @return Whether a network exists.
+ */
+function network_domain_check() {
+       global $wpdb;
+       if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
+               return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
+       return false;
+}
+
+/**
+ * Allow subdomain install
+ *
+ * @since 3.0.0
+ * @return bool Whether subdomain install is allowed
+ */
+function allow_subdomain_install() {
+       $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'siteurl' ) );
+       if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) )
+               return false;
+
+       return true;
+}
+/**
+ * Allow subdirectory install
+ *
+ * @since 3.0.0
+ * @return bool Whether subdirectory install is allowed
+ */
+function allow_subdirectory_install() {
+       global $wpdb;
+       if ( apply_filters( 'allow_subdirectory_install', false ) )
+               return true;
+
+       if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )
+               return true;
+
+       $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
+       if ( empty( $post ) )
+               return true;
+
+       return false;
+}
+/**
+ * Get base domain of network.
+ *
+ * @since 3.0.0
+ * @return string Base domain.
+ */
+function get_clean_basedomain() {
+       if ( $existing_domain = network_domain_check() )
+               return $existing_domain;
+       $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
+       if ( $slash = strpos( $domain, '/' ) )
+               $domain = substr( $domain, 0, $slash );
+       return $domain;
+}
+
+if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
+       wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) );
+
+$title = __( 'Create a Network of WordPress Sites' );
+$parent_file = 'tools.php';
+
+add_contextual_help($current_screen,
+       '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' .
+       '<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' .
+       '<p>' . __('The next screen for Network will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' .
+       '<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .
+       '<p>' . __('Refreshing your browser will take you to a screen with an archive of those added lines of code. A set of six links under Super Admin will appear at the top of the main left navigation menu. The multisite network is now enabled.') . '</p>' .
+       '<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed soon in a future version.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">General Network Creation Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_SubPanel" target="_blank">Tools > Network Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( './admin-header.php' );
+?>
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<?php
+/**
+ * Prints step 1 for Network installation process.
+ *
+ * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
+ *     should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
+ *
+ * @since 3.0.0
+ */
+function network_step1( $errors = false ) {
+       global $is_apache;
+
+       if ( get_option( 'siteurl' ) != get_option( 'home' ) ) {
+               echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . sprintf( __( 'Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '</p></div>';
+               echo '</div>';
+               include ('./admin-footer.php' );
+               die();
+       }
+
+       $active_plugins = get_option( 'active_plugins' );
+       if ( ! empty( $active_plugins ) ) {
+               echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
+               echo '</div>';
+               include( './admin-footer.php' );
+               die();
+       }
+
+       $hostname = get_clean_basedomain();
+       $has_ports = strstr( $hostname, ':' );
+       if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
+               echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
+               echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
+               echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
+               echo '</div>';
+               include( './admin-footer.php' );
+               die();
+       }
+
+       echo '<form method="post" action="">';
+
+       wp_nonce_field( 'install-network-1' );
+
+       $error_codes = array();
+       if ( is_wp_error( $errors ) ) {
+               echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>';
+               foreach ( $errors->get_error_messages() as $error )
+                       echo "<p>$error</p>";
+               echo '</div>';
+               $error_codes = $errors->get_error_codes();
+       }
+
+       if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+               echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
+
+       $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) );
+       $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' );
+       ?>
+       <p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
+       <p><?php _e( 'Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p>
+       <?php
+
+       if ( isset( $_POST['subdomain_install'] ) ) {
+               $subdomain_install = (bool) $_POST['subdomain_install'];
+       } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing
+               $subdomain_install = true;
+       } elseif ( !allow_subdirectory_install() ) {
+               $subdomain_install = true;
+       } else {
+               $subdomain_install = false;
+               if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions
+                       echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>';
+               elseif ( $is_apache )
+                       echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';
+               if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache)
+                       echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>';
+       }
+
+       if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?>
+               <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
+               <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p>
+               <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
+               <?php // @todo: Link to an MS readme? ?>
+               <table class="form-table">
+                       <tr>
+                               <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
+                               <td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td>
+                       </tr>
+                       <tr>
+                               <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
+                               <td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td>
+                       </tr>
+               </table>
+
+<?php
+       endif;
+
+               $is_www = ( 0 === strpos( $hostname, 'www.' ) );
+               if ( $is_www ) :
+               ?>
+               <h3><?php esc_html_e( 'Server Address' ); ?></h3>
+               <p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></h3>
+               <table class="form-table">
+                       <tr>
+                               <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
+                               <td>
+                                       <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
+                               </td>
+                       </tr>
+               </table>
+               <?php endif; ?>
+
+               <h3><?php esc_html_e( 'Network Details' ); ?></h3>
+               <table class="form-table">
+               <?php if ( 'localhost' == $hostname ) : ?>
+                       <tr>
+                               <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
+                               <td><?php
+                                       _e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' );
+                                       // Uh oh:
+                                       if ( !allow_subdirectory_install() )
+                                               echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+                               ?></td>
+                       </tr>
+               <?php elseif ( !allow_subdomain_install() ) : ?>
+                       <tr>
+                               <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
+                               <td><?php
+                                       _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' );
+                                       // Uh oh:
+                                       if ( !allow_subdirectory_install() )
+                                               echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+                               ?></td>
+                       </tr>
+               <?php elseif ( !allow_subdirectory_install() ) : ?>
+                       <tr>
+                               <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th>
+                               <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' );
+                                       echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+                               ?></td>
+                       </tr>
+               <?php endif; ?>
+               <?php if ( ! $is_www ) : ?>
+                       <tr>
+                               <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
+                               <td>
+                                       <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
+                               </td>
+                       </tr>
+               <?php endif; ?>
+                       <tr>
+                               <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>
+                               <td>
+                                       <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
+                                       <br /><?php _e( 'What would you like to call your network?' ); ?>
+                               </td>
+                       </tr>
+                       <tr>
+                               <th scope='row'><?php esc_html_e( 'Admin E-mail Address' ); ?></th>
+                               <td>
+                                       <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
+                                       <br /><?php _e( 'Your email address.' ); ?>
+                               </td>
+                       </tr>
+               </table>
+               <p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php esc_attr_e( 'Install' ); ?>' /></p>
+       </form>
+               <?php
+}
+
+/**
+ * Prints step 2 for Network installation process.
+ *
+ * @since 3.0.0
+ */
+function network_step2( $errors = false ) {
+       global $base, $wpdb;
+       $hostname = get_clean_basedomain();
+
+       // Wildcard DNS message.
+       if ( is_wp_error( $errors ) )
+               echo '<div class="error">' . $errors->get_error_message() . '</div>';
+
+       if ( $_POST ) {
+               $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
+       } else {
+               if ( is_multisite() ) {
+                       $subdomain_install = is_subdomain_install();
+?>
+       <div class="updated"><p><strong><?php _e( 'Notice: The Network feature is already enabled.' ); ?></strong> <?php _e( 'The original configuration steps are shown here for reference.' ); ?></p></div>
+<?php  } else {
+                       $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
+?>
+       <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
+       <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
+<?php
+               }
+       }
+
+       if ( $_POST || ! is_multisite() ) {
+?>
+               <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
+               <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
+               <div class="updated inline"><p><?php
+                       if ( iis7_supports_permalinks() )
+                               _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
+                       else
+                               _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' );
+               ?></p></div>
+<?php
+       }
+?>
+               <ol>
+                       <li><p><?php
+                               printf( __( 'Create a <code>blogs.dir</code> directory in <code>%s</code>. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );
+                               if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+                                       echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong';
+                       ?></p></li>
+                       <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p>
+                               <textarea class="code" readonly="readonly" cols="100" rows="7">
+define( 'MULTISITE', true );
+define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> );
+$base = '<?php echo $base; ?>';
+define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' );
+define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' );
+define( 'SITE_ID_CURRENT_SITE', 1 );
+define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
+<?php
+       $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
+       foreach ( $keys_salts as $c => $v ) {
+               if ( defined( $c ) )
+                       unset( $keys_salts[ $c ] );
+       }
+       if ( ! empty( $keys_salts ) ) {
+               $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
+               if ( is_wp_error( $from_api ) ) {
+                       foreach ( $keys_salts as $c => $v ) {
+                               $keys_salts[ $c ] = wp_generate_password( 64, true, true );
+                       }
+               } else {
+                       $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
+                       foreach ( $keys_salts as $c => $v ) {
+                               $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
+                       }
+               }
+               $num_keys_salts = count( $keys_salts );
+?>
+       <p><?php
+               echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p>
+       <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php
+       foreach ( $keys_salts as $c => $v ) {
+               echo "\ndefine( '$c', '$v' );";
+       }
+?></textarea>
+<?php
+       }
+?>
+</li>
+<?php
+       if ( iis7_supports_permalinks() ) :
+
+                       if ( $subdomain_install ) {
+                               $web_config_file =
+'<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <system.webServer>
+        <rewrite>
+            <rules>
+                <rule name="WordPress Rule 1" stopProcessing="true">
+                    <match url="^index\.php$" ignoreCase="false" />
+                    <action type="None" />
+                </rule>
+                <rule name="WordPress Rule 2" stopProcessing="true">
+                    <match url="^files/(.+)" ignoreCase="false" />
+                    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
+                </rule>
+                <rule name="WordPress Rule 3" stopProcessing="true">
+                    <match url="^" ignoreCase="false" />
+                    <conditions logicalGrouping="MatchAny">
+                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
+                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
+                    </conditions>
+                    <action type="None" />
+                </rule>
+                <rule name="WordPress Rule 4" stopProcessing="true">
+                    <match url="." ignoreCase="false" />
+                    <action type="Rewrite" url="index.php" />
+                </rule>
+            </rules>
+        </rewrite>
+    </system.webServer>
+</configuration>';
+                       } else {
+                               $web_config_file =
+'<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <system.webServer>
+        <rewrite>
+            <rules>
+                <rule name="WordPress Rule 1" stopProcessing="true">
+                    <match url="^index\.php$" ignoreCase="false" />
+                    <action type="None" />
+                </rule>
+                <rule name="WordPress Rule 2" stopProcessing="true">
+                    <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
+                    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
+                </rule>
+                <rule name="WordPress Rule 3" stopProcessing="true">
+                    <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
+                    <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
+                </rule>
+                <rule name="WordPress Rule 4" stopProcessing="true">
+                    <match url="^" ignoreCase="false" />
+                    <conditions logicalGrouping="MatchAny">
+                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
+                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
+                    </conditions>
+                    <action type="None" />
+                </rule>
+                <rule name="WordPress Rule 5" stopProcessing="true">
+                    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
+                    <action type="Rewrite" url="{R:2}" />
+                </rule>
+                <rule name="WordPress Rule 6" stopProcessing="true">
+                    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
+                    <action type="Rewrite" url="{R:2}" />
+                </rule>
+                <rule name="WordPress Rule 7" stopProcessing="true">
+                    <match url="." ignoreCase="false" />
+                    <action type="Rewrite" url="index.php" />
+                </rule>
+            </rules>
+        </rewrite>
+    </system.webServer>
+</configuration>';
+                       }
+       ?>
+               <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
+               <textarea class="code" readonly="readonly" cols="100" rows="20">
+               <?php echo wp_htmledit_pre( $web_config_file ); ?>
+               </textarea></li>
+               </ol>
+
+       <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
+
+               $htaccess_file = 'RewriteEngine On
+RewriteBase ' . $base . '
+RewriteRule ^index\.php$ - [L]
+
+# uploaded files
+RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n";
+
+               if ( ! $subdomain_install )
+                       $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n";
+
+               $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule ^ - [L]';
+
+               // @todo custom content dir.
+               if ( ! $subdomain_install )
+                       $htaccess_file .= "\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]";
+
+               $htaccess_file .= "\nRewriteRule . index.php [L]";
+
+               ?>
+               <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
+               <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
+<?php echo wp_htmledit_pre( $htaccess_file ); ?></textarea></li>
+               </ol>
+
+       <?php endif; // end IIS/Apache code branches.
+
+       if ( !is_multisite() ) { ?>
+               <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>
+<?php
+       }
+}
+
+$base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
+
+if ( $_POST ) {
+       check_admin_referer( 'install-network-1' );
+
+       require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+       // create network tables
+       install_network();
+       $hostname = get_clean_basedomain();
+       $subdomain_install = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
+       if ( ! network_domain_check() ) {
+               $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );
+               if ( is_wp_error( $result ) ) {
+                       if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
+                               network_step2( $result );
+                       else
+                               network_step1( $result );
+               } else {
+                       network_step2();
+               }
+       } else {
+               network_step2();
+       }
+} elseif ( is_multisite() || network_domain_check() ) {
+       network_step2();
+} else {
+       network_step1();
+}
+?>
+</div>
+
+<?php include( './admin-footer.php' ); ?>
index 8093d15930bc2f5da5d53ed7e062095bd6683858..b2110a2923bf019495ef65381d23fdab27f8b8de 100644 (file)
@@ -7,15 +7,23 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('Discussion Settings');
 $parent_file = 'options-general.php';
 
-include('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won&#8217;t all fit here! :) Use the documentation link below to get information on what each discussion setting does.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Discussion_SubPanel" target="_blank">Discussion Settings Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include('./admin-header.php');
 ?>
 
 <div class="wrap">
@@ -31,7 +39,7 @@ include('admin-header.php');
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings') ?></span></legend>
 <label for="default_pingback_flag">
 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
-<?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
+<?php _e('Attempt to notify any blogs linked to from the article.') ?></label>
 <br />
 <label for="default_ping_status">
 <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
@@ -52,6 +60,7 @@ include('admin-header.php');
 <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') ?>
+<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) _e( ' (Signup has been disabled. Only members of this site can comment.)' ); ?>
 </label>
 <br />
 
@@ -150,16 +159,16 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 
 <h3><?php _e('Avatars') ?></h3>
 
-<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites.  Here you can enable the display of avatars for people who comment on your blog.'); ?></p>
+<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites.  Here you can enable the display of avatars for people who comment on your site.'); ?></p>
 
 <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
 
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Avatar Display') ?></th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar display') ?></span></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display') ?></span></legend>
 <?php
-       $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
+       $yesorno = array( 0 => __( 'Don&#8217;t show Avatars' ), 1 => __( 'Show Avatars' ) );
        foreach ( $yesorno as $key => $value) {
                $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
                echo "\n\t<label><input type='radio' name='show_avatars' value='" . esc_attr($key) . "' $selected/> $value</label><br />";
@@ -172,7 +181,16 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating') ?></span></legend>
 
 <?php
-$ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
+$ratings = array(
+       /* translators: Content suitability rating: http://bit.ly/89QxZA */
+       'G' => __('G &#8212; Suitable for all audiences'),
+       /* translators: Content suitability rating: http://bit.ly/89QxZA */
+       'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'),
+       /* translators: Content suitability rating: http://bit.ly/89QxZA */
+       'R' => __('R &#8212; Intended for adult audiences above 17'),
+       /* translators: Content suitability rating: http://bit.ly/89QxZA */
+       'X' => __('X &#8212; Even more mature than above')
+);
 foreach ($ratings as $key => $rating) :
        $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
        echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
index 4741c851d64e1016f5ef0f97caf555a8dc522e8e..1aaee47230d3b40098357c19e3af35d4cca367df 100644 (file)
@@ -9,8 +9,8 @@
 /** WordPress Administration Bootstrap */
 require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('General Settings');
 $parent_file = 'options-general.php';
@@ -50,6 +50,18 @@ function add_js() {
 }
 add_filter('admin_head', 'add_js');
 
+add_contextual_help($current_screen,
+       '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' .
+       '<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>' .
+       '<p>' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '</p>' .
+       '<p>' . __('If you want site visitors to be able to register themselves, as opposed to being registered by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site administrator.') . '</p>' .
+       '<p>' . __('UTC means Coordinated Universal Time.') . '</p>' .
+       '<p>' . __('Remember to click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">Documentation on General Settings</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 include('./admin-header.php');
 ?>
 
@@ -62,22 +74,23 @@ include('./admin-header.php');
 
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
+<th scope="row"><label for="blogname"><?php _e('Site Title') ?></label></th>
 <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>
 <td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />
-<span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
+<span class="description"><?php _e('In a few words, explain what this site is about.') ?></span></td>
 </tr>
+<?php if ( !is_multisite() ) { ?>
 <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'); ?>" class="regular-text 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'); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td>
 </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'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
-<span class="description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
+<th scope="row"><label for="home"><?php _e('Site address (URL)') ?></label></th>
+<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" />
+<span class="description"><?php _e('Enter the address here if you want your site 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>
@@ -97,6 +110,21 @@ include('./admin-header.php');
 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
 </td>
 </tr>
+<?php } else { ?>
+<tr valign="top">
+<th scope="row"><label for="new_admin_email"><?php _e('E-mail address') ?> </label></th>
+<td><input name="new_admin_email" type="text" id="new_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. If you change this we will send you an e-mail at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></span>
+<?php
+$new_admin_email = get_option( 'new_admin_email' );
+if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
+<div class="updated inline">
+<p><?php printf( __('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_admin_email, esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?></p>
+</div>
+<?php endif; ?>
+</td>
+</tr>
+<?php } ?>
 <tr>
 <?php
 if ( !wp_timezone_supported() ) : // no magic timezone support here
@@ -133,7 +161,7 @@ foreach ( $offset_range as $offset ) {
        <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
 <?php endif; ?>
 <br />
-<span class="description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
+<span class="description"><?php _e('Unfortunately, you have to manually update this for daylight saving time. The PHP Date/Time library is not supported by your web host.'); ?></span>
 </td>
 <?php
 else: // looks like we can do nice timezone selection!
@@ -146,7 +174,7 @@ $check_zone_info = true;
 if ( false !== strpos($tzstring,'Etc/GMT') )
        $tzstring = '';
 
-if (empty($tzstring)) { // set the Etc zone if no timezone string exists
+if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
        $check_zone_info = false;
        if ( 0 == $current_offset )
                $tzstring = 'UTC+0';
@@ -165,40 +193,50 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
 </select>
 
     <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
-<?php if (get_option('timezone_string')) : ?>
+<?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?>
        <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
 <?php endif; ?>
 <br />
 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
+<?php if ($check_zone_info && $tzstring) : ?>
 <br />
 <span>
-<?php if ($check_zone_info && $tzstring) : ?>
        <?php
-       $now = localtime(time(),true);
-       if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
-       else _e('This timezone is currently in standard time.');
+       // Set TZ so localtime works.
+       date_default_timezone_set($tzstring);
+       $now = localtime(time(), true);
+       if ( $now['tm_isdst'] )
+               _e('This timezone is currently in daylight saving time.');
+       else
+               _e('This timezone is currently in standard time.');
        ?>
        <br />
        <?php
-       if (function_exists('timezone_transitions_get')) {
-               $dateTimeZoneSelected = new DateTimeZone($tzstring);
-               foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
-                       if ($tr['ts'] > time()) {
+       if ( function_exists('timezone_transitions_get') ) {
+               $found = false;
+               $date_time_zone_selected = new DateTimeZone($tzstring);
+               $tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
+               $right_now = time();
+               foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) {
+                       if ( $tr['ts'] > $right_now ) {
                            $found = true;
                                break;
                        }
                }
 
-               if ( isset($found) && $found === true ) {
+               if ( $found ) {
                        echo ' ';
                        $message = $tr['isdst'] ?
-                               __('Daylight savings time begins on: <code>%s</code>.') :
+                               __('Daylight saving time begins on: <code>%s</code>.') :
                                __('Standard time begins  on: <code>%s</code>.');
-                       printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
+                       // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
+                       printf( $message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']) ) );
                } else {
-                       _e('This timezone does not observe daylight savings time.');
+                       _e('This timezone does not observe daylight saving time.');
                }
        }
+       // Set back to UTC.
+       date_default_timezone_set('UTC');
        ?>
        </span>
 <?php endif; ?>
@@ -219,13 +257,13 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
                'd/m/Y',
        ) );
 
-       $custom = TRUE;
+       $custom = true;
 
        foreach ( $date_formats as $format ) {
                echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
                if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
-                       $custom = FALSE;
+                       $custom = false;
                }
                echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
        }
@@ -251,13 +289,13 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
                'H:i',
        ) );
 
-       $custom = TRUE;
+       $custom = true;
 
        foreach ( $time_formats as $format ) {
                echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
                if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
-                       $custom = FALSE;
+                       $custom = false;
                }
                echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
        }
@@ -281,6 +319,21 @@ endfor;
 </select></td>
 </tr>
 <?php do_settings_fields('general', 'default'); ?>
+<?php
+       $languages = get_available_languages();
+       if ( is_multisite() && !empty( $languages ) ):
+?>
+       <tr valign="top">
+               <th width="33%" scope="row"><?php _e('Site language:') ?></th>
+               <td>
+                       <select name="WPLANG" id="WPLANG">
+                               <?php mu_dropdown_languages( $languages, get_option('WPLANG') ); ?>
+                       </select>
+               </td>
+       </tr>
+<?php
+       endif;
+?>
 </table>
 
 <?php do_settings_sections('general'); ?>
index 14a177c3c42abdf4e5b68ed3e77472dd661bf8ad..965615fd4662b41c776751c3a5699e9914050c8b 100644 (file)
@@ -10,8 +10,7 @@
  */
 
 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 endif; ?>
\ No newline at end of file
+settings_errors();
+
+?>
\ No newline at end of file
index abe72bc5e1b3d8924f7ad79b47cfd9ab32409db7..2e5d10d045978d75b5e3dd4b0c2d8ff67e56858d 100644 (file)
@@ -7,15 +7,25 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('Media Settings');
 $parent_file = 'options-general.php';
 
-include('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>' .
+       '<p>' . __('The Embed option allows you embed a video, image, or other media content into your content automatically by typing the URL (of the web page where the file lives) on its own line when you create your content.') . '</p>' .
+       '<p>' . __('Uploading Options gives you folder and path choices for storing your files in your installation&#8217;s directory.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Media_SubPanel" target="_blank">Documentation on Media Settings</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include('./admin-header.php');
 
 ?>
 
@@ -90,6 +100,36 @@ include('admin-header.php');
 <?php do_settings_fields('media', 'embeds'); ?>
 </table>
 
+<?php if ( !is_multisite() ) : ?>
+<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>
+<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
+<span class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
+</td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
+<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
+<span class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></span>
+</td>
+</tr>
+
+<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')); ?> />
+<?php _e('Organize my uploads into month- and year-based folders'); ?>
+</label>
+</th>
+</tr>
+
+<?php do_settings_fields('media', 'uploads'); ?>
+</table>
+<?php endif; ?>
+
 <?php do_settings_sections('media'); ?>
 
 <p class="submit">
diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php
deleted file mode 100644 (file)
index 73575a4..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Miscellaneous settings administration panel.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
-
-$title = __('Miscellaneous Settings');
-$parent_file = 'options-general.php';
-
-include('admin-header.php');
-
-?>
-
-<div class="wrap">
-<?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?></h2>
-
-<form method="post" action="options.php">
-<?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>
-<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
-<span class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
-</td>
-</tr>
-
-<tr valign="top">
-<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
-<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
-<span class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></span>
-</td>
-</tr>
-
-<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')); ?> />
-<?php _e('Organize my uploads into month- and year-based folders'); ?>
-</label>
-</th>
-</tr>
-<?php do_settings_fields('misc', 'default'); ?>
-</table>
-
-<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')); ?> />
-<?php _e('Track Links&#8217; Update Times') ?>
-</label>
-</th>
-</tr>
-
-</table>
-
-<?php do_settings_sections('misc'); ?>
-
-<p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
-</p>
-
-</form>
-</div>
-
-<?php include('./admin-footer.php'); ?>
index c4b71d55a5afd838a6976972138e859cf06b1451..35cacf4f6d851e0a696f9c76b285100b3df81781 100644 (file)
@@ -7,14 +7,27 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('Permalink Settings');
 $parent_file = 'options-general.php';
 
+add_contextual_help($current_screen,
+       '<p>' . __('This screen provides some common options for your default permalinks URL structure.') . '</p>' .
+       '<p>' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by <code>%</code>, will also appear in the custom structure field and your path can be further modified there.') . '</p>' .
+       '<p>' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.') . '</p>' .
+       '<p>' . __('Note that permalinks beginning with the category, tag, author or postname structure tags require more advanced server resources. Double-check your hosting details to make sure those are in place or start your permalinks with other structure tags.') . '</p>' .
+       '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Permalinks_SubPanel" target="_blank">Permalinks Settings Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Using_Permalinks" target="_blank">Using Permalinks Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 /**
  * Display JavaScript on the page.
  *
@@ -70,33 +83,48 @@ window.onload = blurry;
 }
 add_filter('admin_head', 'add_js');
 
-include('admin-header.php');
+include('./admin-header.php');
 
 $home_path = get_home_path();
 $iis7_permalinks = iis7_supports_permalinks();
 
+$prefix = $blog_prefix = '';
+if ( ! got_mod_rewrite() && ! $iis7_permalinks )
+       $prefix = '/index.php';
+if ( is_multisite() && !is_subdomain_install() && is_main_site() )
+       $blog_prefix = '/blog';
+
 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
        check_admin_referer('update-permalink');
 
-       if ( isset($_POST['permalink_structure']) ) {
-               $permalink_structure = $_POST['permalink_structure'];
-               if (! empty($permalink_structure) )
-                       $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
-               $wp_rewrite->set_permalink_structure($permalink_structure);
+       if ( isset( $_POST['permalink_structure'] ) ) {
+               if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
+                       $permalink_structure = $_POST['selection'];
+               else
+                       $permalink_structure = $_POST['permalink_structure'];
+
+               if ( ! empty( $permalink_structure ) ) {
+                       $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
+                       if ( $prefix && $blog_prefix )
+                               $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
+                       else
+                               $permalink_structure = $blog_prefix . $permalink_structure;
+               }
+               $wp_rewrite->set_permalink_structure( $permalink_structure );
        }
 
-       if ( isset($_POST['category_base']) ) {
+       if ( isset( $_POST['category_base'] ) ) {
                $category_base = $_POST['category_base'];
-               if (! empty($category_base) )
-                       $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
-               $wp_rewrite->set_category_base($category_base);
+               if ( ! empty( $category_base ) )
+                       $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
+               $wp_rewrite->set_category_base( $category_base );
        }
 
-       if ( isset($_POST['tag_base']) ) {
+       if ( isset( $_POST['tag_base'] ) ) {
                $tag_base = $_POST['tag_base'];
-               if (! empty($tag_base) )
-                       $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
-               $wp_rewrite->set_tag_base($tag_base);
+               if ( ! empty( $tag_base ) )
+                       $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
+               $wp_rewrite->set_tag_base( $tag_base );
        }
 }
 
@@ -122,22 +150,26 @@ else
        $usingpi = false;
 
 $wp_rewrite->flush_rules();
-?>
 
-<?php if (isset($_POST['submit'])) : ?>
-<div id="message" class="updated fade"><p><?php
-if ( $iis7_permalinks ) {
-       if ( $permalink_structure && ! $usingpi && ! $writable )
-               _e('You should update your web.config now');
-       else if ( $permalink_structure && ! $usingpi && $writable)
-               _e('Permalink structure updated. Remove write access on web.config file now!');
-       else
-               _e('Permalink structure updated');
+
+if (isset($_POST['submit'])) : ?>
+<div id="message" class="updated"><p><?php
+if ( ! is_multisite() ) {
+       if ( $iis7_permalinks ) {
+               if ( $permalink_structure && ! $usingpi && ! $writable )
+                       _e('You should update your web.config now');
+               else if ( $permalink_structure && ! $usingpi && $writable )
+                       _e('Permalink structure updated. Remove write access on web.config file now!');
+               else
+                       _e('Permalink structure updated');
+       } else {
+               if ( $permalink_structure && ! $usingpi && ! $writable )
+                       _e('You should update your .htaccess now.');
+               else
+                       _e('Permalink structure updated.');
+       }
 } else {
-       if ( $permalink_structure && ! $usingpi && ! $writable )
-               _e('You should update your .htaccess now.');
-       else
-               _e('Permalink structure updated.');
+       _e('Permalink structure updated.');
 }
 ?>
 </p></div>
@@ -153,10 +185,11 @@ if ( $iis7_permalinks ) {
   <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
-$prefix = '';
-
-if ( ! got_mod_rewrite() && ! $iis7_permalinks )
-       $prefix = '/index.php';
+if ( is_multisite() && !is_subdomain_install() && is_main_site() ) {
+       $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
+       $category_base = preg_replace( '|^/?blog|', '', $category_base );
+       $tag_base = preg_replace( '|^/?blog|', '', $tag_base );
+}
 
 $structures = array(
        '',
@@ -173,27 +206,24 @@ $structures = array(
        </tr>
        <tr>
                <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
-               <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
+               <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
                <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
-               <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
+               <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
                <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
-               <td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td>
+               <td><code><?php echo get_option('home') . $blog_prefix . $prefix; ?>/archives/123</code></td>
        </tr>
        <tr>
                <th>
-                       <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog"
-                       <?php if ( !in_array($permalink_structure, $structures) ) { ?>
-                       checked="checked"
-                       <?php } ?>
-                        />
+                       <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
                        <?php _e('Custom Structure'); ?>
                        </label>
                </th>
                <td>
+                       <?php echo $blog_prefix; ?>
                        <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
                </td>
        </tr>
@@ -208,12 +238,12 @@ $structures = array(
 
 <table class="form-table">
        <tr>
-               <th><label for="category_base"><?php _e('Category base'); ?></label></th>
-               <td><input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
+               <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th>
+               <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
        </tr>
        <tr>
                <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
-               <td><input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
+               <td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
        </tr>
        <?php do_settings_fields('permalink', 'optional'); ?>
 </table>
@@ -224,8 +254,9 @@ $structures = array(
        <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
   </form>
-<?php if ($iis7_permalinks) :
-       if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) : 
+<?php if ( !is_multisite() ) { ?>
+<?php if ( $iis7_permalinks ) :
+       if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) :
                if ( file_exists($home_path . 'web.config') ) : ?>
 <p><?php _e('If your <code>web.config</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p>
 <form action="options-permalink.php" method="post">
@@ -239,7 +270,7 @@ $structures = array(
 <?php wp_nonce_field('update-permalink') ?>
        <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_html($wp_rewrite->iis7_url_rewrite_rules(true)); ?></textarea></p>
 </form>
-<p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.')  ?></p>                   
+<p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.')  ?></p>
                <?php endif; ?>
        <?php endif; ?>
 <?php else :
@@ -251,6 +282,7 @@ $structures = array(
 </form>
        <?php endif; ?>
 <?php endif; ?>
+<?php } // multisite ?>
 
 </div>
 
index 5226abb70bbaaafe966f51207572def90f0b39fd..caac6a1d619feff6bd0b1f3fd42899a4c04eb82e 100644 (file)
@@ -9,12 +9,21 @@
 /** Load WordPress Administration Bootstrap */
 require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('Privacy Settings');
 $parent_file = 'options-general.php';
 
+add_contextual_help($current_screen,
+       '<p>' . __('You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the second option here. Note that your privacy is not complete; your site is still visible on the web.') . '</p>' .
+       '<p>' . __('When this setting is in effect a reminder is shown in the header of these administration screens that says, &#8220;Search Engines Blocked,&#8221; to remind you that your site is not being crawled.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Privacy_SubPanel" target="_blank">Privacy Settings Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 include('./admin-header.php');
 ?>
 
@@ -27,12 +36,12 @@ include('./admin-header.php');
 
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Blog Visibility') ?> </th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('Blog Visibility') ?> </span></legend>
-<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
-<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Bing, Technorati) and archivers');?></label></p>
-<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
-<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
+<th scope="row"><?php _e('Site Visibility') ?> </th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Site Visibility') ?> </span></legend>
+<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
+<label for="blog-public"><?php _e('I would like my site to be visible to everyone, including search engines (like Google, Bing, Technorati) and archivers');?></label><br/>
+<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
+<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label>
 <?php do_action('blog_privacy_selector'); ?>
 </fieldset></td>
 </tr>
index d5bcdbfc3a02a0f68b8613cb239e9477fb1918f9..7cd4c463c759ae93f5e4b10b39e11ed41630acc9 100644 (file)
@@ -7,15 +7,25 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once( './admin.php' );
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
-$title = __('Reading Settings');
+$title = __( 'Reading Settings' );
 $parent_file = 'options-general.php';
 
-include('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
+       '<p>' . sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
+       '<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display, whether to show full text or a summary, and the character set encoding.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Reading_SubPanel" target="_blank">Reading Settings Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( './admin-header.php' );
 ?>
 
 <div class="wrap">
@@ -23,68 +33,70 @@ include('admin-header.php');
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <form name="form1" method="post" action="options.php">
-<?php settings_fields('reading'); ?>
+<?php settings_fields( 'reading' ); ?>
 
+<?php if ( ! get_pages() ) : ?>
+<input name="show_on_front" type="hidden" value="posts" />
+<table class="form-table">
+<?php else :
+       if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
+               update_option( 'show_on_front', 'posts' );
+?>
 <table class="form-table">
-<?php if ( get_pages() ): ?>
 <tr valign="top">
-<th scope="row"><?php _e('Front page displays')?></th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('Front page displays')?></span></legend>
+<th scope="row"><?php _e( 'Front page displays' ); ?></th>
+<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
        <p><label>
-               <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
-               <?php _e('Your latest posts'); ?>
+               <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
+               <?php _e( 'Your latest posts' ); ?>
        </label>
        </p>
        <p><label>
-               <input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
-               <?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
+               <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
+               <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
        </label>
        </p>
 <ul>
-       <li><?php printf("<label for='page_on_front'>".__('Front page: %s')."</label>", wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
-       <li><?php printf("<label for='page_for_posts'>".__('Posts page: %s')."</label>", wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
+       <li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
+       <li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
 </ul>
-<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
-<div id="front-page-warning" class="updated fade-ff0000">
-       <p>
-               <?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?>
-       </p>
-</div>
+<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
+<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
 <?php endif; ?>
 </fieldset></td>
 </tr>
 <?php endif; ?>
 <tr valign="top">
-<th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
+<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'); ?>" class="small-text" /> <?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><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>
+<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' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('For each article in a feed, show') ?> </th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('For each article in a feed, show') ?> </span></legend>
-<p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>    /> <?php _e('Full text') ?></label><br />
-<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
+<th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
+<p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?>        /> <?php _e( 'Full text' ); ?></label><br />
+<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
 </fieldset></td>
 </tr>
 
 <tr valign="top">
-<th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
-<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" class="regular-text" />
-<span class="description"><?php _e('The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your blog (UTF-8 is recommended, if you are adventurous there are some <a href="http://en.wikipedia.org/wiki/Character_set">other encodings</a>)') ?></span></td>
+<th scope="row"><label for="blog_charset"><?php _e( 'Encoding for pages and feeds' ); ?></label></th>
+<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option( 'blog_charset' ); ?>" class="regular-text" />
+<span class="description"><?php _e( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended, if you are adventurous there are some <a href="http://en.wikipedia.org/wiki/Character_set">other encodings</a>)' ); ?></span></td>
 </tr>
-<?php do_settings_fields('reading', 'default'); ?>
+<?php do_settings_fields( 'reading', 'default' ); ?>
 </table>
 
-<?php do_settings_sections('reading'); ?>
+<?php do_settings_sections( 'reading' ); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" />
 </p>
 </form>
 </div>
-<?php include('./admin-footer.php'); ?>
+<?php include( './admin-footer.php' ); ?>
index a8979f4e1727f904ae7f047bca861df07400e112..dc06459d3d4417b48b0c7da1e5b94d9682cf37c6 100644 (file)
@@ -7,15 +7,23 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( ! current_user_can('manage_options') )
-       wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+if ( ! current_user_can( 'manage_options' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 $title = __('Writing Settings');
 $parent_file = 'options-general.php';
 
-include('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within these administration screens, while the rest control external publishing methods. For more information on any of these methods, use the documentation links below.') . '</p>' .
+       '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Settings_Writing_SubPanel" target="_blank">Writing Settings Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include('./admin-header.php');
 ?>
 
 <div class="wrap">
@@ -52,35 +60,21 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'o
 <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
 <td>
 <?php
-wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'type' => 'link'));
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category'));
 ?>
 </td>
 </tr>
 <?php do_settings_fields('writing', 'default'); ?>
 </table>
 
-<h3><?php _e('Remote Publishing') ?></h3>
-<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
-<table class="form-table">
-<tr valign="top">
-<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
-<label for="enable_app">
-<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
-<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
-</fieldset></td>
-</tr>
-<tr valign="top">
-<th scope="row"><?php _e('XML-RPC') ?></th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
-<label for="enable_xmlrpc">
-<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
-<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
-</fieldset></td>
-</tr>
-<?php do_settings_fields('writing', 'remote_publishing'); ?>
-</table>
 
+<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 site.'); ?></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 esc_attr(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
+
+<?php if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { ?>
 <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: <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>
 
@@ -112,7 +106,31 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
 </tr>
 <?php do_settings_fields('writing', 'post_via_email'); ?>
 </table>
+<?php } ?>
+
+<h3><?php _e('Remote Publishing') ?></h3>
+<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
+<table class="form-table">
+<tr valign="top">
+<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
+<label for="enable_app">
+<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
+<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
+</fieldset></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('XML-RPC') ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
+<label for="enable_xmlrpc">
+<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
+<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
+</fieldset></td>
+</tr>
+<?php do_settings_fields('writing', 'remote_publishing'); ?>
+</table>
 
+<?php if ( apply_filters( 'enable_update_services_configuration', true ) ) { ?>
 <h3><?php _e('Update Services') ?></h3>
 
 <?php if ( get_option('blog_public') ) : ?>
@@ -123,9 +141,10 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
 
 <?php else : ?>
 
-       <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog&#8217;s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?></p>
+       <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your site&#8217;s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?></p>
 
 <?php endif; ?>
+<?php } // multisite ?>
 
 <?php do_settings_sections('writing'); ?>
 
index 11d6ee0589d520a22944ea7969322836ea845013..15f489d3e207b8bc141a8a0b9cee2a0222a802ce 100644 (file)
 /**
  * Options Management Administration Panel.
  *
- * Just allows for displaying of options.
+ * If accessed directly in a browser this page shows a list of all saved options
+ * along with editable fields for their values. Serialized data is not supported
+ * and there is no way to remove options via this page. It is not linked to from
+ * anywhere else in the admin.
  *
- * 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.
+ * This file is also the target of the forms in core and custom options pages
+ * that use the Settings API. In this case it saves the new option values
+ * and returns the user to their page of origin.
  *
  * @package WordPress
  * @subpackage Administration
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 $title = __('Settings');
 $this_file = 'options.php';
 $parent_file = 'options-general.php';
 
-wp_reset_vars(array('action'));
+wp_reset_vars(array('action', 'option_page'));
+
+if ( empty($option_page) ) // This is for back compat and will eventually be removed.
+       $option_page = 'options';
+
+if ( !current_user_can('manage_options') )
+       wp_die(__('Cheatin&#8217; uh?'));
+
+// Handle admin email change requests
+if ( is_multisite() ) {
+       if ( ! empty($_GET[ 'adminhash' ] ) ) {
+               $new_admin_details = get_option( 'adminhash' );
+               $redirect = 'options-general.php?updated=false';
+               if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
+                       update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
+                       delete_option( 'adminhash' );
+                       delete_option( 'new_admin_email' );
+                       $redirect = 'options-general.php?updated=true';
+               }
+               wp_redirect( admin_url( $redirect ) );
+               exit;
+       } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
+               delete_option( 'adminhash' );
+               delete_option( 'new_admin_email' );
+               wp_redirect( admin_url( 'options-general.php?updated=true' ) );
+               exit;
+       }
+}
+
+if ( is_multisite() && !is_super_admin() && 'update' != $action )
+       wp_die(__('Cheatin&#8217; uh?'));
 
 $whitelist_options = array(
-       'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ),
+       'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
-       'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
        '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' ),
+       'writing' => array( 'default_post_edit_rows', 'use_smilies', '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 );
+$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
+$uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path');
 
-if ( !current_user_can('manage_options') )
-       wp_die(__('Cheatin&#8217; uh?'));
+if ( !is_multisite() ) {
+       if ( !defined( 'WP_SITEURL' ) )
+               $whitelist_options['general'][] = 'siteurl';
+       if ( !defined( 'WP_HOME' ) )
+               $whitelist_options['general'][] = 'home';
 
-switch($action) {
+       $whitelist_options['general'][] = 'admin_email';
+       $whitelist_options['general'][] = 'users_can_register';
+       $whitelist_options['general'][] = 'default_role';
 
-case 'update':
-       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';
+       $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
+       $whitelist_options['writing'][] = 'ping_sites';
+
+       $whitelist_options['media'] = array_merge($whitelist_options['media'], $uploads_options);
+} else {
+       $whitelist_options['general'][] = 'new_admin_email';
+       $whitelist_options['general'][] = 'WPLANG';
+       $whitelist_options['general'][] = 'language';
+
+       if ( apply_filters( 'enable_post_by_email_configuration', true ) )
+               $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
+
+       $whitelist_options[ 'misc' ] = array();
+}
+
+$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
+
+/*
+ * If $_GET['action'] == 'update' we are saving settings sent from a settings page
+ */
+if ( 'update' == $action ) {
+       if ( 'options' == $option_page && !isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
+               $unregistered = true;
                check_admin_referer( 'update-options' );
+       } else {
+               $unregistered = false;
+               check_admin_referer( $option_page . '-options' );
        }
 
        if ( !isset( $whitelist_options[ $option_page ] ) )
-               wp_die( __( 'Error! Options page not found.' ) );
+               wp_die( __( 'Error: options page not found.' ) );
 
        if ( 'options' == $option_page ) {
-               $options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
+               if ( is_multisite() && ! is_super_admin() )
+                       wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
+               $options = explode( ',', stripslashes( $_POST[ 'page_options' ] ) );
        } else {
                $options = $whitelist_options[ $option_page ];
        }
@@ -75,46 +132,62 @@ case 'update':
 
        if ( $options ) {
                foreach ( $options as $option ) {
+                       if ( $unregistered )
+                               _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
+
                        $option = trim($option);
                        $value = null;
                        if ( isset($_POST[$option]) )
                                $value = $_POST[$option];
-                       if ( !is_array($value) ) $value = trim($value);
+                       if ( !is_array($value) )
+                               $value = trim($value);
                        $value = stripslashes_deep($value);
                        update_option($option, $value);
                }
        }
 
-       $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
+       /**
+        *  Handle settings errors and return to options page
+        */
+       // If no settings errors were registered add a general 'updated' message.
+       if ( !count( get_settings_errors() ) )
+               add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
+       set_transient('settings_errors', get_settings_errors(), 30);
+
+       /**
+        * Redirect back to the settings page that was submitted
+        */
+       $goback = add_query_arg( 'updated', 'true',  wp_get_referer() );
        wp_redirect( $goback );
-       break;
+       exit;
+}
 
-default:
-       include('admin-header.php'); ?>
+include('./admin-header.php'); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-  <h2><?php _e('All Settings'); ?></h2>
+  <h2><?php esc_html_e('All Settings'); ?></h2>
   <form name="form" action="options.php" method="post" id="all-options">
   <?php wp_nonce_field('options-options') ?>
   <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");
-
-foreach ( (array) $options as $option) :
-       $disabled = '';
-       $option->option_name = esc_attr($option->option_name);
-       if ( is_serialized($option->option_value) ) {
-               if ( is_serialized_string($option->option_value) ) {
+$options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );
+
+foreach ( (array) $options as $option ) :
+       $disabled = false;
+       if ( $option->option_name == '' )
+               continue;
+       if ( is_serialized( $option->option_value ) ) {
+               if ( is_serialized_string( $option->option_value ) ) {
                        // this is a serialized string, so we should display it
-                       $value = maybe_unserialize($option->option_value);
+                       $value = maybe_unserialize( $option->option_value );
                        $options_to_update[] = $option->option_name;
                        $class = 'all-options';
                } else {
                        $value = 'SERIALIZED DATA';
-                       $disabled = ' disabled="disabled"';
+                       $disabled = true;
                        $class = 'all-options disabled';
                }
        } else {
@@ -122,28 +195,25 @@ foreach ( (array) $options as $option) :
                $options_to_update[] = $option->option_name;
                $class = 'all-options';
        }
+       $name = esc_attr( $option->option_name );
        echo "
 <tr>
-       <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
+       <th scope='row'><label for='$name'>" . esc_html( $option->option_name ) . "</label></th>
 <td>";
-
-       if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . esc_html($value) . "</textarea>";
-       else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . esc_attr($value) . "'$disabled />";
-
+       if ( strpos( $value, "\n" ) !== false )
+               echo "<textarea class='$class' name='$name' id='$name' cols='30' rows='5'>" . wp_htmledit_pre( $value ) . "</textarea>";
+       else
+               echo "<input class='regular-text $class' type='text' name='$name' id='$name' value='" . esc_attr( $value ) . "'" . disabled( $disabled, true, false ) . " />";
        echo "</td>
 </tr>";
 endforeach;
 ?>
   </table>
-<?php $options_to_update = implode(',', $options_to_update); ?>
-<p class="submit"><input type="hidden" name="page_options" value="<?php echo esc_attr($options_to_update); ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p>
+<p class="submit"><input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" /><input type="submit" name="Update" value="<?php esc_attr_e( 'Save Changes' ); ?>" class="button-primary" /></p>
   </form>
 </div>
 
 
 <?php
-include('admin-footer.php');
-break;
-} // end switch
-
+include('./admin-footer.php');
 ?>
diff --git a/wp-admin/page-new.php b/wp-admin/page-new.php
deleted file mode 100644 (file)
index c73c7fc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * New page administration panel.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-$title = __('Add New Page');
-$parent_file = 'edit-pages.php';
-$editing = true;
-wp_enqueue_script('autosave');
-wp_enqueue_script('post');
-if ( user_can_richedit() )
-       wp_enqueue_script('editor');
-add_thickbox();
-wp_enqueue_script('media-upload');
-wp_enqueue_script('word-count');
-
-if ( current_user_can('edit_pages') ) {
-       $action = 'post';
-       $post = get_default_page_to_edit();
-
-       include('edit-page-form.php');
-}
-
-include('admin-footer.php');
-
-?>
diff --git a/wp-admin/page.php b/wp-admin/page.php
deleted file mode 100644 (file)
index a4a9280..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-/**
- * Edit page administration panel.
- *
- * Manage edit page: post, edit, delete, etc.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-
-$parent_file = 'edit-pages.php';
-$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) {
-       global $action;
-
-       $referredby = '';
-       if ( !empty($_POST['referredby']) ) {
-               $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
-               $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
-       }
-       $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
-
-       if ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
-               $location = 'sidebar.php?a=b';
-       } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
-               $status = get_post_status( $page_ID );
-
-               if ( isset( $_POST['publish'] ) ) {
-                       switch ( $status ) {
-                               case 'pending':
-                                       $message = 6;
-                                       break;
-                               case 'future':
-                                       $message = 7;
-                                       break;
-                               default:
-                                       $message = 4;
-                       }
-               } else {
-                               $message = 'draft' == $status ? 8 : 1;
-               }
-
-               $location = add_query_arg( 'message', $message, 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';
-       } elseif ( isset($_POST['deletemeta']) ) {
-               $location = add_query_arg( 'message', 3, wp_get_referer() );
-               $location = explode('#', $location);
-               $location = $location[0] . '#postcustom';
-       } else {
-               $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
-       }
-
-       wp_redirect( apply_filters( 'redirect_page_location', $location, $page_ID ) );
-}
-
-if (isset($_POST['deletepost']))
-       $action = "delete";
-elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
-       $action = 'preview';
-
-$sendback = wp_get_referer();
-if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'page-new.php') !== false )
-       $sendback = admin_url('edit-pages.php');
-else
-       $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
-
-switch($action) {
-case 'post':
-       check_admin_referer('add-page');
-       $page_ID = write_post();
-
-       redirect_page($page_ID);
-
-       exit();
-       break;
-
-case 'edit':
-       $title = __('Edit Page');
-       $editing = true;
-       $page_ID = $post_ID = $p = (int) $_GET['post'];
-       $post = get_post_to_edit($page_ID);
-
-       if ( empty($post->ID) )
-               wp_die( __('You attempted to edit a page that doesn&#8217;t exist. Perhaps it was deleted?') );
-
-       if ( !current_user_can('edit_page', $page_ID) )
-               wp_die( __('You are not allowed to edit this page.') );
-
-       if ( 'trash' == $post->post_status )
-               wp_die( __('You can&#8217;t edit this page because it is in the Trash. Please move it out of the Trash and try again.') );
-
-       if ( 'page' != $post->post_type ) {
-               wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
-               exit();
-       }
-
-       wp_enqueue_script('post');
-       if ( user_can_richedit() )
-               wp_enqueue_script('editor');
-       add_thickbox();
-       wp_enqueue_script('media-upload');
-       wp_enqueue_script('word-count');
-
-       if ( $last = wp_check_post_lock( $post->ID ) ) {
-               add_action('admin_notices', '_admin_notice_post_locked' );
-       } else {
-               wp_set_post_lock( $post->ID );
-               wp_enqueue_script('autosave');
-       }
-
-       include('edit-page-form.php');
-       break;
-
-case 'editattachment':
-       $page_id = $post_ID = (int) $_POST['post_ID'];
-       check_admin_referer('update-attachment_' . $page_id);
-
-       // Don't let these be changed
-       unset($_POST['guid']);
-       $_POST['post_type'] = 'attachment';
-
-       // Update the thumbnail filename
-       $newmeta = wp_get_attachment_metadata( $page_id, true );
-       $newmeta['thumb'] = $_POST['thumb'];
-
-       wp_update_attachment_metadata( $newmeta );
-
-case 'editpost':
-       $page_ID = (int) $_POST['post_ID'];
-       check_admin_referer('update-page_' . $page_ID);
-
-       $page_ID = edit_post();
-
-       redirect_page($page_ID);
-
-       exit();
-       break;
-
-case 'trash':
-       $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('trash-page_' . $post_id);
-
-       $post = & get_post($post_id);
-
-       if ( !current_user_can('delete_page', $post_id) )
-               wp_die( __('You are not allowed to move this page to the trash.') );
-
-       if ( !wp_trash_post($post_id) )
-               wp_die( __('Error in moving to trash...') );
-
-       wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
-       exit();
-       break;
-
-case 'untrash':
-       $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('untrash-page_' . $post_id);
-
-       $post = & get_post($post_id);
-
-       if ( !current_user_can('delete_page', $post_id) )
-               wp_die( __('You are not allowed to move this page out of the trash.') );
-
-       if ( !wp_untrash_post($post_id) )
-               wp_die( __('Error in restoring from trash...') );
-
-       wp_redirect( add_query_arg('untrashed', 1, $sendback) );
-       exit();
-       break;
-
-case 'delete':
-       $page_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('delete-page_' .  $page_id);
-
-       $page = & get_post($page_id);
-
-       if ( !current_user_can('delete_page', $page_id) )
-               wp_die( __('You are not allowed to delete this page.') );
-
-       if ( $page->post_type == 'attachment' ) {
-               if ( ! wp_delete_attachment($page_id) )
-                       wp_die( __('Error in deleting...') );
-       } else {
-               if ( !wp_delete_post($page_id) )
-                       wp_die( __('Error in deleting...') );
-       }
-
-       wp_redirect( add_query_arg('deleted', 1, $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();
-       break;
-} // end switch
-include('admin-footer.php');
-?>
index 05aa02a8720f6da99549f2576607c65088fcea08..47437079588c2d7349fffac28d2c28c50e43d3cd 100644 (file)
@@ -7,10 +7,10 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( !current_user_can('edit_plugins') )
-       wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
+       wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
 
 $title = __("Edit Plugins");
 $parent_file = 'plugins.php';
@@ -21,6 +21,9 @@ wp_admin_css( 'theme-editor' );
 
 $plugins = get_plugins();
 
+if ( empty($plugins) )
+       wp_die( __('There are no plugins installed on this site.') );
+
 if ( isset($_REQUEST['file']) )
        $plugin = stripslashes($_REQUEST['file']);
 
@@ -52,11 +55,16 @@ case 'update':
                fwrite($f, $newcontent);
                fclose($f);
 
+               $network_wide = is_plugin_active_for_network( $file );
+
                // Deactivate so we can test it.
                if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
                        if ( is_plugin_active($file) )
                                deactivate_plugins($file, true);
-                       wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto"));
+
+                       update_option('recently_activated', array($file => time()) + (array)get_option('recently_activated'));
+
+                       wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
                        exit;
                }
                wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
@@ -77,7 +85,7 @@ default:
                        wp_die( $error );
 
                if ( ! is_plugin_active($file) )
-                       activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
+                       activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
 
                wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
                exit;
@@ -99,7 +107,17 @@ default:
                }
        }
 
-       require_once('admin-header.php');
+       add_contextual_help($current_screen,
+               '<p>' . __('You can use the editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' .
+               '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
+               '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '</p>' .
+               '<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit a plugin or start from scratch, check out the links below.') . '</p>' .
+               '<p><strong>' . __('For more information:') . '</strong></p>' .
+               '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Editor_SubPanel" target="_blank">Documentation on Editing Plugins</a>') . '</p>' .
+               '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       );
+
+       require_once('./admin-header.php');
 
        update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 
@@ -110,22 +128,20 @@ default:
 
                if ( !empty($functions) ) {
                        $docs_select = '<select name="docs-list" id="docs-list">';
-                       $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
+                       $docs_select .= '<option value="">' . __( 'Function Name&hellip;' ) . '</option>';
                        foreach ( $functions as $function) {
-                               $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
+                               $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>';
                        }
                        $docs_select .= '</select>';
                }
        }
 
        $content = htmlspecialchars( $content );
-       $codepress_lang = codepress_get_lang($real_file);
-
        ?>
 <?php if (isset($_GET['a'])) : ?>
- <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
+ <div id="message" class="updated"><p><?php _e('File edited successfully.') ?></p></div>
 <?php elseif (isset($_GET['phperror'])) : ?>
- <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
+ <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
        <?php
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
        <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo esc_attr($file); ?>&amp;_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe>
@@ -198,17 +214,17 @@ foreach ( $plugin_files as $plugin_file ) :
 </div>
 <form name="template" id="template" action="plugin-editor.php" method="post">
        <?php wp_nonce_field('edit-plugin_' . $file) ?>
-               <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
+               <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
                <input type="hidden" name="action" value="update" />
                <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
                <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
                <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
                </div>
                <?php if ( !empty( $docs_select ) ) : ?>
-               <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
+               <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
                <?php endif; ?>
 <?php if ( is_writeable($real_file) ) : ?>
-       <?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
+       <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
                <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
        <?php } ?>
        <p class="submit">
@@ -236,4 +252,4 @@ jQuery(document).ready(function($){
 <?php
        break;
 }
-include("admin-footer.php");
+include("./admin-footer.php");
index 503e78c9d4be132d896f896368bd1f784b57a0cc..e6d4cadb69ac1919e183862fb9fdbf85dfdf1b1d 100644 (file)
@@ -7,10 +7,10 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( ! current_user_can('install_plugins') )
-       wp_die(__('You do not have sufficient permissions to install plugins on this blog.'));
+       wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
 
 include(ABSPATH . 'wp-admin/includes/plugin-install.php');
 
@@ -36,11 +36,11 @@ $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) ) ) {
+if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
        $tab_actions = array_keys($tabs);
        $tab = $tab_actions[0];
 }
-if( empty($paged) )
+if ( empty($paged) )
        $paged = 1;
 
 wp_enqueue_style( 'plugin-install' );
@@ -52,7 +52,17 @@ $body_id = $tab;
 
 do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
 
-include('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from WordPress core by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the WordPress GPL v2 license. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '</p>' .
+       '<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
+       '<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
+       '<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_SubPanel" target="_blank">Documentation on Installing Plugins</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include('./admin-header.php');
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
@@ -73,4 +83,4 @@ foreach ( (array)$tabs as $action => $text ) {
        <?php do_action('install_plugins_' . $tab, $paged); ?>
 </div>
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
index 48530eddcebb082d76703a557c073b52a89449a9..e83ca4c9d90c9736f71a558a25722605e2037d17 100644 (file)
@@ -7,10 +7,18 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
+if ( is_multisite() ) {
+       $menu_perms = get_site_option( 'menu_items', array() );
+
+       if ( empty($menu_perms['plugins']) && ! is_super_admin() )
+               wp_die( __( 'Cheatin&#8217; uh?' ) );
+       else if ( $menu_perms['plugins'] != 1 && is_super_admin() )
+               add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' );
+}
 
-if ( ! current_user_can('activate_plugins') )
-       wp_die(__('You do not have sufficient permissions to manage plugins for this blog.'));
+if ( ! current_user_can( 'activate_plugins' ) )
+       wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
 
 if ( isset($_POST['clear-recent-list']) )
        $action = 'clear-recent-list';
@@ -27,10 +35,10 @@ $default_status = get_user_option('plugins_last_view');
 if ( empty($default_status) )
        $default_status = 'all';
 $status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : $default_status;
-if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'search')) )
+if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'network', 'mustuse', 'dropins', 'search')) )
        $status = 'all';
 if ( $status != $default_status && 'search' != $status )
-       update_usermeta($current_user->ID, 'plugins_last_view', $status);
+       update_user_meta($current_user->ID, 'plugins_last_view', $status);
 
 $page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
 
@@ -38,40 +46,55 @@ $page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
 
 if ( !empty($action) ) {
+       $network_wide = false;
+       if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) )
+               $network_wide = true;
+
        switch ( $action ) {
                case 'activate':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
 
                        check_admin_referer('activate-plugin_' . $plugin);
 
-                       $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
-                       if ( is_wp_error( $result ) )
-                               wp_die($result);
+                       $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin, $network_wide);
+                       if ( is_wp_error( $result ) ) {
+                               if ( 'unexpected_output' == $result->get_error_code() ) {
+                                       $redirect = 'plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin;
+                                       wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
+                                       exit;
+                               } else {
+                                       wp_die($result);
+                               }
+                       }
 
                        $recent = (array)get_option('recently_activated');
                        if ( isset($recent[ $plugin ]) ) {
                                unset($recent[ $plugin ]);
                                update_option('recently_activated', $recent);
                        }
-
-                       wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above
+                       if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
+                               wp_redirect("import.php?import=" . str_replace('-importer', '', dirname($plugin)) ); // overrides the ?error=true one above and redirects to the Imports page, striping the -importer suffix
+                       } else {
+                               wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above
+                       }
                        exit;
                        break;
                case 'activate-selected':
+               case 'network-activate-selected':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
 
                        check_admin_referer('bulk-manage-plugins');
 
                        $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
-                       $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Only activate plugins which are not already active.
+                       $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); // Only activate plugins which are not already active.
                        if ( empty($plugins) ) {
                                wp_redirect("plugins.php?plugin_status=$status&paged=$page");
                                exit;
                        }
 
-                       activate_plugins($plugins, 'plugins.php?error=true');
+                       activate_plugins($plugins, 'plugins.php?error=true', $network_wide);
 
                        $recent = (array)get_option('recently_activated');
                        foreach ( $plugins as $plugin => $time)
@@ -83,9 +106,38 @@ if ( !empty($action) ) {
                        wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page");
                        exit;
                        break;
+               case 'update-selected' :
+
+                       check_admin_referer( 'bulk-manage-plugins' );
+
+                       if ( isset( $_GET['plugins'] ) )
+                               $plugins = explode( ',', $_GET['plugins'] );
+                       elseif ( isset( $_POST['checked'] ) )
+                               $plugins = (array) $_POST['checked'];
+                       else
+                               $plugins = array();
+
+                       $title = __( 'Upgrade Plugins' );
+                       $parent_file = 'plugins.php';
+
+                       require_once( './admin-header.php' );
+
+                       echo '<div class="wrap">';
+                       screen_icon();
+                       echo '<h2>' . esc_html( $title ) . '</h2>';
+
+
+                       $url = 'update.php?action=update-selected&amp;plugins=' . urlencode( join(',', $plugins) );
+                       $url = wp_nonce_url($url, 'bulk-update-plugins');
+
+                       echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
+                       echo '</div>';
+                       require_once( './admin-footer.php' );
+                       exit;
+                       break;
                case 'error_scrape':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
 
                        check_admin_referer('plugin-activation-error_' . $plugin);
 
@@ -93,29 +145,38 @@ if ( !empty($action) ) {
                        if ( is_wp_error($valid) )
                                wp_die($valid);
 
-                       if ( defined('E_RECOVERABLE_ERROR') )
-                               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
-                       else
-                               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
+                       if ( ! WP_DEBUG ) {
+                               if ( defined('E_RECOVERABLE_ERROR') )
+                                       error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
+                               else
+                                       error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
+                       }
 
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
-                       include(WP_PLUGIN_DIR . '/' . $plugin);
+                       // Go back to "sandbox" scope so we get the same errors as before
+                       function plugin_sandbox_scrape( $plugin ) {
+                               include( WP_PLUGIN_DIR . '/' . $plugin );
+                       }
+                       plugin_sandbox_scrape( $plugin );
                        do_action('activate_' . $plugin);
                        exit;
                        break;
                case 'deactivate':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.'));
+                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
 
                        check_admin_referer('deactivate-plugin_' . $plugin);
                        deactivate_plugins($plugin);
                        update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
-                       wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
+                       if (headers_sent())
+                               echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page" ) . "' />";
+                       else
+                               wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
                        exit;
                        break;
                case 'deactivate-selected':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.'));
+                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
 
                        check_admin_referer('bulk-manage-plugins');
 
@@ -138,7 +199,7 @@ if ( !empty($action) ) {
                        break;
                case 'delete-selected':
                        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 site.'));
 
                        check_admin_referer('bulk-manage-plugins');
 
@@ -156,37 +217,59 @@ if ( !empty($action) ) {
 
                        if ( ! isset($_REQUEST['verify-delete']) ) {
                                wp_enqueue_script('jquery');
-                               require_once('admin-header.php');
+                               require_once('./admin-header.php');
                                ?>
                        <div class="wrap">
-                               <h2><?php _e('Delete Plugin(s)'); ?></h2>
                                <?php
                                        $files_to_delete = $plugin_info = array();
                                        foreach ( (array) $plugins as $plugin ) {
                                                if ( '.' == dirname($plugin) ) {
                                                        $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
-                                                       if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
+                                                       if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {
                                                                $plugin_info[ $plugin ] = $data;
+                                                               $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
+                                                       }
                                                } else {
-                                                       //Locate all the files in that folder:
+                                                       // Locate all the files in that folder
                                                        $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
-                                                       if( $files ) {
+                                                       if ( $files ) {
                                                                $files_to_delete = array_merge($files_to_delete, $files);
                                                        }
-                                                       //Get plugins list from that folder
-                                                       if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
-                                                               $plugin_info = array_merge($plugin_info, $folder_plugins);
+                                                       // Get plugins list from that folder
+                                                       if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) {
+                                                               foreach( $folder_plugins as $plugin_file => $data ) {
+                                                                       $plugin_info[ $plugin_file ] = $data;
+                                                                       $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
+                                                               }
+                                                       }
                                                }
                                        }
+                                       screen_icon();
+                                       $plugins_to_delete = count( $plugin_info );
+                                       echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>';
                                ?>
-                               <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
+                               <p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p>
                                        <ul class="ul-disc">
                                                <?php
-                                               foreach ( $plugin_info as $plugin )
-                                                       echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>';
+                                               $data_to_delete = false;
+                                               foreach ( $plugin_info as $plugin ) {
+                                                       if ( $plugin['is_uninstallable'] ) {
+                                                               /* translators: 1: plugin name, 2: plugin author */
+                                                               echo '<li>', sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)' ), $plugin['Name'], $plugin['Author'] ), '</li>';
+                                                               $data_to_delete = true;
+                                                       } else {
+                                                               /* translators: 1: plugin name, 2: plugin author */
+                                                               echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $plugin['Name'], $plugin['Author'] ), '</li>';
+                                                       }
+                                               }
                                                ?>
                                        </ul>
-                               <p><?php _e('Are you sure you wish to delete these files?') ?></p>
+                               <p><?php
+                               if ( $data_to_delete )
+                                       _e('Are you sure you wish to delete these files and data?');
+                               else
+                                       _e('Are you sure you wish to delete these files?');
+                               ?></p>
                                <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
                                        <input type="hidden" name="verify-delete" value="1" />
                                        <input type="hidden" name="action" value="delete-selected" />
@@ -195,7 +278,7 @@ if ( !empty($action) ) {
                                                        echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />';
                                        ?>
                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
-                                       <input type="submit" name="submit" value="<?php esc_attr_e('Yes, Delete these files') ?>" class="button" />
+                                       <input type="submit" name="submit" value="<?php $data_to_delete ? esc_attr_e('Yes, Delete these files and data') : esc_attr_e('Yes, Delete these files') ?>" class="button" />
                                </form>
                                <form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
                                        <input type="submit" name="submit" value="<?php esc_attr_e('No, Return me to the plugin list') ?>" class="button" />
@@ -212,7 +295,7 @@ if ( !empty($action) ) {
                                </div>
                        </div>
                                <?php
-                               require_once('admin-footer.php');
+                               require_once('./admin-footer.php');
                                exit;
                        } //Endif verify-delete
                        $delete_result = delete_plugins($plugins);
@@ -230,14 +313,19 @@ if ( !empty($action) ) {
 wp_enqueue_script('plugin-install');
 add_thickbox();
 
-$help = '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>';
-$help .= '<p>' . sprintf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>';
-$help .= '<p>' . sprintf(__('You can find additional plugins for your site by using the new <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.  To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%2$s</code> directory.  Once a plugin has been installed, you may activate it here.'), 'plugin-install.php', WP_PLUGIN_DIR) . '</p>';
+add_contextual_help($current_screen,
+       '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
+       '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '</p>' .
+       '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' .
+       '<p>' . sprintf( __('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
 
-add_contextual_help('plugins', $help);
+$title = __('Plugins');
 
-$title = __('Manage Plugins');
-require_once('admin-header.php');
+require_once('./admin-header.php');
 
 $invalid = validate_active_plugins();
 if ( !empty($invalid) )
@@ -245,10 +333,16 @@ if ( !empty($invalid) )
                echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>';
 ?>
 
-<?php if ( isset($_GET['error']) ) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
+<?php if ( isset($_GET['error']) ) :
+
+       if ( isset($_GET['charsout']) )
+               $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation.  If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
+       else
+               $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
+       ?>
+       <div id="message" class="updated"><p><?php echo $errmsg; ?></p>
        <?php
-               if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
+               if ( !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
        <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . esc_attr($plugin) . '&amp;_wpnonce=' . esc_attr($_GET['_error_nonce'])); ?>"></iframe>
        <?php
                }
@@ -259,33 +353,43 @@ if ( !empty($invalid) )
                delete_transient('plugins_delete_result'); //Delete it once we're done.
 
                if ( is_wp_error($delete_result) ) : ?>
-               <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
+               <div id="message" class="updated"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
                <?php else : ?>
-               <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
+               <div id="message" class="updated"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
                <?php endif; ?>
 <?php elseif ( isset($_GET['activate']) ) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
+       <div id="message" class="updated"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
 <?php elseif (isset($_GET['activate-multi'])) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
+       <div id="message" class="updated"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
 <?php elseif ( isset($_GET['deactivate']) ) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
+       <div id="message" class="updated"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
 <?php elseif (isset($_GET['deactivate-multi'])) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
+       <div id="message" class="updated"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
+<?php elseif ( 'update-selected' == $action ) : ?>
+       <div id="message" class="updated"><p><?php _e('No out of date plugins were selected.'); ?></p></div>
 <?php endif; ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a></h2>
+<h2><?php echo esc_html( $title ); if ( current_user_can('install_plugins') ) { ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a><?php } ?></h2>
 
 <?php
 
-$all_plugins = get_plugins();
+$all_plugins = apply_filters( 'all_plugins', get_plugins() );
 $search_plugins = array();
 $active_plugins = array();
 $inactive_plugins = array();
 $recent_plugins = array();
 $recently_activated = get_option('recently_activated', array());
 $upgrade_plugins = array();
+$network_plugins = array();
+$mustuse_plugins = $dropins_plugins = array();
+if ( ! is_multisite() || current_user_can('manage_network_plugins') ) {
+       if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
+               $mustuse_plugins = get_mu_plugins();
+       if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
+               $dropins_plugins = get_dropins();
+}
 
 set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 );
 
@@ -295,16 +399,25 @@ foreach ( $recently_activated as $key => $time )
                unset($recently_activated[ $key ]);
 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
        update_option('recently_activated', $recently_activated);
-$current = get_transient( 'update_plugins' );
-
-foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
-
-       //Translate, Apply Markup, Sanitize HTML
-       $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
-       $all_plugins[ $plugin_file ] = $plugin_data;
+$current = get_site_transient( 'update_plugins' );
 
-       //Filter into individual sections
-       if ( is_plugin_active($plugin_file) ) {
+foreach ( array( 'all_plugins', 'mustuse_plugins', 'dropins_plugins' ) as $plugin_array_name) {
+       foreach ( (array) $$plugin_array_name as $plugin_file => $plugin_data ) {
+               // Translate, Apply Markup, Sanitize HTML
+               $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
+               ${$plugin_array_name}[ $plugin_file ] = $plugin_data;
+       }
+}
+unset( $plugin_array_name );
+
+foreach ( (array) $all_plugins as $plugin_file => $plugin_data) {
+       // Filter into individual sections
+       if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
+               unset( $all_plugins[ $plugin_file ] );
+               continue;
+       } elseif ( is_plugin_active_for_network($plugin_file) ) {
+               $network_plugins[ $plugin_file ] = $plugin_data;
+       } elseif ( is_plugin_active($plugin_file) ) {
                $active_plugins[ $plugin_file ] = $plugin_data;
        } else {
                if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
@@ -312,18 +425,24 @@ foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
                $inactive_plugins[ $plugin_file ] = $plugin_data;
        }
 
-    if ( isset( $current->response[ $plugin_file ] ) )
-        $upgrade_plugins[ $plugin_file ] = $plugin_data;
+       if ( isset( $current->response[ $plugin_file ] ) )
+               $upgrade_plugins[ $plugin_file ] = $plugin_data;
 }
 
+if ( !current_user_can('update_plugins') )
+       $upgrade_plugins = array();
+
 $total_all_plugins = count($all_plugins);
 $total_inactive_plugins = count($inactive_plugins);
 $total_active_plugins = count($active_plugins);
 $total_recent_plugins = count($recent_plugins);
 $total_upgrade_plugins = count($upgrade_plugins);
+$total_network_plugins = count($network_plugins);
+$total_mustuse_plugins = count($mustuse_plugins);
+$total_dropins_plugins = count($dropins_plugins);
 
-//Searching.
-if ( isset($_GET['s']) ) {
+// Searching.
+if ( !empty($_GET['s']) ) {
        function _search_plugins_filter_callback($plugin) {
                static $term;
                if ( is_null($term) )
@@ -344,17 +463,17 @@ if ( isset($_GET['s']) ) {
 }
 
 $plugin_array_name = "${status}_plugins";
-if ( empty($$plugin_array_name) && $status != 'all' ) {
+if ( empty($$plugin_array_name) && !in_array($status, array('all', 'search')) ) {
        $status = 'all';
        $plugin_array_name = "${status}_plugins";
 }
 
 $plugins = &$$plugin_array_name;
 
-//Paging.
+// Paging.
 $total_this_page = "total_{$status}_plugins";
 $total_this_page = $$total_this_page;
-$plugins_per_page = (int) get_user_option( 'plugins_per_page', 0, false );
+$plugins_per_page = (int) get_user_option( 'plugins_per_page' );
 if ( empty( $plugins_per_page ) || $plugins_per_page < 1 )
        $plugins_per_page = 999;
 $plugins_per_page = apply_filters( 'plugins_per_page', $plugins_per_page );
@@ -384,11 +503,12 @@ $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s
  */
 function print_plugins_table($plugins, $context = '') {
        global $page;
+       $checkbox = ! in_array( $context, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '';
 ?>
 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
        <thead>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
+               <th scope="col" class="manage-column check-column"><?php echo $checkbox; ?></th>
                <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
                <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
        </tr>
@@ -396,7 +516,7 @@ function print_plugins_table($plugins, $context = '') {
 
        <tfoot>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
+               <th scope="col" class="manage-column check-column"><?php echo $checkbox; ?></th>
                <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
                <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
        </tr>
@@ -411,29 +531,77 @@ function print_plugins_table($plugins, $context = '') {
                </tr>';
        }
        foreach ( (array)$plugins as $plugin_file => $plugin_data) {
-               $actions = array();
-               $is_active = is_plugin_active($plugin_file);
-
-               if ( $is_active )
-                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
-               else
-                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
-
-               if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
-                       $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
-
-               if ( ! $is_active && current_user_can('delete_plugins') )
-                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
-
-               $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
+               // preorder
+               $actions = array(
+                       'network_deactivate' => '', 'deactivate' => '',
+                       'network_only' => '', 'activate' => '',
+                       'network_activate' => '',
+                       'edit' => '',
+                       'delete' => '',
+               );
+
+               if ( 'mustuse' == $context ) {
+                       $is_active = true;
+               } elseif ( 'dropins' == $context ) {
+                       $dropins = _get_dropins();
+                       $plugin_name = $plugin_file;
+                       if ( $plugin_file != $plugin_data['Name'] )
+                               $plugin_name .= '<br/>' . $plugin_data['Name'];
+                       if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
+                               $is_active = true;
+                               $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
+                       } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
+                               $is_active = true;
+                               $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
+                       } else {
+                               $is_active = false;
+                               $description = '<strong>' . $dropins[ $plugin_file ][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>';
+                       }
+                       $description .= '<p>' . $plugin_data['Description'] . '</p>';
+               } else {
+                       $is_active_for_network = is_plugin_active_for_network($plugin_file);
+                       $is_active = $is_active_for_network || is_plugin_active( $plugin_file );
+                       if ( $is_active_for_network && !is_super_admin() )
+                               continue;
+
+                       if ( $is_active ) {
+                               if ( $is_active_for_network ) {
+                                       if ( is_super_admin() )
+                                               $actions['network_deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
+                               } else {
+                                       $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
+                               }
+                       } else {
+                               if ( is_multisite() && is_network_only_plugin( $plugin_file ) )
+                                       $actions['network_only'] = '<span title="' . __('This plugin can only be activated for all sites in a network') . '">' . __('Network Only') . '</span>';
+                               else
+                                       $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
+
+                               if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
+                                       $actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
+
+                               if ( current_user_can('delete_plugins') )
+                                       $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
+                       } // end if $is_active
+
+                       if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+                               $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
+               } // end if $context
+
+               $actions = apply_filters( 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
                $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
-               $action_count = count($actions);
+
                $class = $is_active ? 'active' : 'inactive';
+               $checkbox = in_array( $context, array( 'mustuse', 'dropins' ) ) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' />";
+               if ( 'dropins' != $context ) {
+                       $description = '<p>' . $plugin_data['Description'] . '</p>';
+                       $plugin_name = $plugin_data['Name'];
+               }
                echo "
        <tr class='$class'>
-               <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
-               <td class='plugin-title'><strong>{$plugin_data['Name']}</strong></td>
-               <td class='desc'><p>{$plugin_data['Description']}</p></td>
+               <th scope='row' class='check-column'>$checkbox</th>
+               <td class='plugin-title'><strong>$plugin_name</strong></td>
+               <td class='desc'>$description</td>
        </tr>
        <tr class='$class second'>
                <td></td>
@@ -477,6 +645,8 @@ function print_plugins_table($plugins, $context = '') {
  * @param string $context
  */
 function print_plugin_actions($context, $field_name = 'action' ) {
+       if ( in_array( $context, array( 'mustuse', 'dropins' ) ) )
+               return;
 ?>
        <div class="alignleft actions">
                <select name="<?php echo $field_name; ?>">
@@ -484,15 +654,21 @@ function print_plugin_actions($context, $field_name = 'action' ) {
        <?php if ( 'active' != $context ) : ?>
                        <option value="activate-selected"><?php _e('Activate'); ?></option>
        <?php endif; ?>
+       <?php if ( is_multisite() && 'network' != $context ) : ?>
+                       <option value="network-activate-selected"><?php _e('Network Activate'); ?></option>
+       <?php endif; ?>
        <?php if ( 'inactive' != $context && 'recent' != $context ) : ?>
                        <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
        <?php endif; ?>
+       <?php if ( current_user_can( 'update_plugins' ) ) : ?>
+                       <option value="update-selected"><?php _e( 'Upgrade' ); ?></option>
+       <?php endif; ?>
        <?php if ( current_user_can('delete_plugins') && ( 'active' != $context ) ) : ?>
                        <option value="delete-selected"><?php _e('Delete'); ?></option>
        <?php endif; ?>
                </select>
                <input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" />
-       <?php if( 'recent' == $context ) : ?>
+       <?php if ( 'recent' == $context ) : ?>
                <input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" />
        <?php endif; ?>
        </div>
@@ -504,10 +680,12 @@ function print_plugin_actions($context, $field_name = 'action' ) {
 <p class="search-box">
        <label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label>
        <input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php esc_attr_e( 'Search Plugins' ); ?>" class="button" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Installed Plugins' ); ?>" class="button" />
 </p>
 </form>
 
+<?php do_action( 'pre_current_active_plugins', $all_plugins ) ?>
+
 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
@@ -530,6 +708,18 @@ if ( ! empty($inactive_plugins) ) {
        $class = ( 'inactive' == $status ) ? ' class="current"' : '';
        $status_links[] = "<li><a href='plugins.php?plugin_status=inactive' $class>" . sprintf( _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $total_inactive_plugins ), number_format_i18n( $total_inactive_plugins ) ) . '</a>';
 }
+if ( ! empty($network_plugins) ) {
+       $class = ( 'network' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=network' $class>" . sprintf( _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $total_network_plugins ), number_format_i18n( $total_network_plugins ) ) . '</a>';
+}
+if ( ! empty($mustuse_plugins) ) {
+       $class = ( 'mustuse' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=mustuse' $class>" . sprintf( _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $total_mustuse_plugins ), number_format_i18n( $total_mustuse_plugins ) ) . '</a>';
+}
+if ( ! empty($dropins_plugins) ) {
+       $class = ( 'dropins' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=dropins' $class>" . sprintf( _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $total_dropins_plugins ), number_format_i18n( $total_dropins_plugins ) ) . '</a>';
+}
 if ( ! empty($upgrade_plugins) ) {
        $class = ( 'upgrade' == $status ) ? ' class="current"' : '';
        $status_links[] = "<li><a href='plugins.php?plugin_status=upgrade' $class>" . sprintf( _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $total_upgrade_plugins ), number_format_i18n( $total_upgrade_plugins ) ) . '</a>';
@@ -544,6 +734,14 @@ unset( $status_links );
 ?>
 </ul>
 
+<?php
+if ( 'mustuse' == $status )
+       echo '<div class="clear"><p>' . __( 'Files in the <code>/wp-content/mu-plugins</code> directory are executed automatically.' ) . '</p>';
+elseif ( 'dropins' == $status )
+       echo '<div class="clear"><p>' . __( 'Drop-ins are advanced plugins in the <code>/wp-content</code> directory that replace WordPress functionality when present.' ) . '</p>';
+
+if ( !empty( $plugins ) && ( ! in_array( $status, array( 'mustuse', 'dropins' ) ) || $page_links ) ) :
+?>
 <div class="tablenav">
 <?php
 if ( $page_links )
@@ -554,10 +752,14 @@ print_plugin_actions($status);
 </div>
 <div class="clear"></div>
 <?php
-       if ( $total_this_page > $plugins_per_page )
-               $plugins = array_slice($plugins, $start, $plugins_per_page);
+endif;
+
+if ( $total_this_page > $plugins_per_page )
+       $plugins = array_slice($plugins, $start, $plugins_per_page);
+
+print_plugins_table($plugins, $status);
 
-       print_plugins_table($plugins, $status);
+if ( !empty( $plugins ) && ! in_array( $status, array( 'mustuse', 'dropins' ) ) || $page_links ) {
 ?>
 <div class="tablenav">
 <?php
@@ -567,14 +769,18 @@ if ( $page_links )
 print_plugin_actions($status, "action2");
 ?>
 </div>
+<?php } elseif ( ! empty( $all_plugins ) ) { ?>
+<p><?php __( 'No plugins found.' ); ?></p>
+<?php } ?>
 </form>
 
 <?php if ( empty($all_plugins) ) : ?>
+<br class="clear" />
 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
 <?php endif; ?>
 
 </div>
 
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
 ?>
index 229f3d06c3c3e5e4b872cfb84950b2ccf14e85f0..93c4ffbcbdd609f4cea2f8eedfd41edf9934d6bf 100644 (file)
@@ -7,20 +7,31 @@
  */
 
 /** Load WordPress Administration Bootstrap */
-require_once('admin.php');
-$title = __('Add New Post');
-$parent_file = 'edit.php';
+require_once('./admin.php');
+
+if ( !isset($_GET['post_type']) )
+       $post_type = 'post';
+elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
+       $post_type = $_GET['post_type'];
+else
+       wp_die( __('Invalid post type') );
+
+if ( 'post' != $post_type ) {
+       $parent_file = "edit.php?post_type=$post_type";
+       $submenu_file = "post-new.php?post_type=$post_type";
+} else {
+       $parent_file = 'edit.php';
+       $submenu_file = 'post-new.php';
+}
+
+$post_type_object = get_post_type_object($post_type);
+
+$title = $post_type_object->labels->add_new_item;
+
 $editing = true;
-wp_enqueue_script('autosave');
-wp_enqueue_script('post');
-if ( user_can_richedit() )
-       wp_enqueue_script('editor');
-add_thickbox();
-wp_enqueue_script('media-upload');
-wp_enqueue_script('word-count');
-
-if ( ! current_user_can('edit_posts') ) {
-       require_once ('./admin-header.php'); ?>
+
+if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
+       include('./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 />
@@ -28,13 +39,18 @@ When you&#8217;re promoted, just reload this page and you&#8217;ll be able to bl
 </p>
 </div>
 <?php
-       include('admin-footer.php');
+       include('./admin-footer.php');
        exit();
 }
 
+wp_enqueue_script('autosave');
+
 // Show post form.
-$post = get_default_post_to_edit();
-include('edit-form-advanced.php');
+if ( current_user_can($post_type_object->cap->edit_posts) ) {
+       $post = get_default_post_to_edit( $post_type, true );
+       $post_ID = $post->ID;
+       include('edit-form-advanced.php');
+}
 
-include('admin-footer.php');
-?>
+include('./admin-footer.php');
+?>
\ No newline at end of file
index a8ccddaed7aef5b01198443701ed5de56ad3d317..548007f7f039c7e7c4132a9a9a42134eb1f98e82 100644 (file)
@@ -9,35 +9,55 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 $parent_file = 'edit.php';
 $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'));
 
+if ( isset($_GET['post']) )
+       $post_id = (int) $_GET['post'];
+elseif ( isset($_POST['post_ID']) )
+       $post_id = (int) $_POST['post_ID'];
+else
+       $post_id = 0;
+$post_ID = $post_id;
+$post = null;
+$post_type_object = null;
+$post_type = null;
+if ( $post_id ) {
+       $post = get_post($post_id);
+       if ( $post ) {
+               $post_type_object = get_post_type_object($post->post_type);
+               if ( $post_type_object ) {
+                       $post_type = $post->post_type;
+                       $current_screen->post_type = $post->post_type;
+                       $current_screen->id = $current_screen->post_type;
+               }
+       }
+} elseif ( isset($_POST['post_type']) ) {
+       $post_type_object = get_post_type_object($_POST['post_type']);
+       if ( $post_type_object ) {
+               $post_type = $post_type_object->name;
+               $current_screen->post_type = $post_type;
+               $current_screen->id = $current_screen->post_type;
+       }
+}
+
 /**
  * Redirect to previous page.
  *
- * @param int $post_ID Optional. Post ID.
+ * @param int $post_id Optional. Post ID.
  */
-function redirect_post($post_ID = '') {
-       global $action;
-
-       $referredby = '';
-       if ( !empty($_POST['referredby']) ) {
-               $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
-               $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
-       }
-       $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
-
+function redirect_post($post_id = '') {
        if ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
                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']) ) {
-               $status = get_post_status( $post_ID );
+               $status = get_post_status( $post_id );
 
                if ( isset( $_POST['publish'] ) ) {
                        switch ( $status ) {
@@ -54,7 +74,7 @@ function redirect_post($post_ID = '') {
                                $message = 'draft' == $status ? 10 : 1;
                }
 
-               $location = add_query_arg( 'message', $message, get_edit_post_link( $post_ID, 'url' ) );
+               $location = add_query_arg( 'message', $message, 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);
@@ -64,12 +84,12 @@ function redirect_post($post_ID = '') {
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
        } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
-               $location = "post.php?action=edit&post=$post_ID&message=7";
+               $location = "post.php?action=edit&post=$post_id&message=7";
        } else {
-               $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
+               $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
        }
 
-       wp_redirect( apply_filters( 'redirect_post_location', $location, $post_ID ) );
+       wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
 }
 
 if ( isset( $_POST['deletepost'] ) )
@@ -78,17 +98,19 @@ elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
        $action = 'preview';
 
 $sendback = wp_get_referer();
-if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false )
+if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false ) {
        $sendback = admin_url('edit.php');
-else
+       $sendback .= ( !empty( $post_type ) ) ? '?post_type=' . $post_type : '';
+} else {
        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
+}
 
 switch($action) {
 case 'postajaxpost':
 case 'post':
 case 'post-quickpress-publish':
 case 'post-quickpress-save':
-       check_admin_referer('add-post');
+       check_admin_referer('add-' . $post_type);
 
        if ( 'post-quickpress-publish' == $action )
                $_POST['publish'] = 'publish'; // tell write_post() to publish
@@ -100,55 +122,53 @@ case 'post-quickpress-save':
 
        if ( !empty( $_POST['quickpress_post_ID'] ) ) {
                $_POST['post_ID'] = (int) $_POST['quickpress_post_ID'];
-               $post_ID = edit_post();
+               $post_id = edit_post();
        } else {
-               $post_ID = 'postajaxpost' == $action ? edit_post() : write_post();
+               $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
        }
 
        if ( 0 === strpos( $action, 'post-quickpress' ) ) {
-               $_POST['post_ID'] = $post_ID;
+               $_POST['post_ID'] = $post_id;
                // output the quickpress dashboard widget
                require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
-               wp_dashboard_quick_press();
+               wp_dashboard_quick_press_output();
                exit;
        }
 
-       redirect_post($post_ID);
+       redirect_post($post_id);
        exit();
        break;
 
 case 'edit':
        $editing = true;
 
-       if ( empty( $_GET['post'] ) ) {
+       if ( empty( $post_id ) ) {
                wp_redirect("post.php");
                exit();
        }
-       $post_ID = $p = (int) $_GET['post'];
-       $post = get_post($post_ID);
+
+       $p = $post_id;
 
        if ( empty($post->ID) )
-               wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') );
+               wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
 
-       if ( !current_user_can('edit_post', $post_ID) )
-               wp_die( __('You are not allowed to edit this post.') );
+       if ( !current_user_can($post_type_object->cap->edit_post, $post_id) )
+               wp_die( __('You are not allowed to edit this item.') );
 
        if ( 'trash' == $post->post_status )
-               wp_die( __('You can&#8217;t edit this post because it is in the Trash. Please restore it and try again.') );
+               wp_die( __('You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.') );
 
-       if ( 'post' != $post->post_type ) {
-               wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
-               exit();
-       }
+       if ( null == $post_type_object )
+               wp_die( __('Unknown post type.') );
 
-       wp_enqueue_script('post');
-       if ( user_can_richedit() )
-               wp_enqueue_script('editor');
-       add_thickbox();
-       wp_enqueue_script('media-upload');
-       wp_enqueue_script('word-count');
-       wp_enqueue_script( 'admin-comments' );
-       enqueue_comment_hotkeys_js();
+       $post_type = $post->post_type;
+       if ( 'post' == $post_type ) {
+               $parent_file = "edit.php";
+               $submenu_file = "edit.php";
+       } else {
+               $parent_file = "edit.php?post_type=$post_type";
+               $submenu_file = "edit.php?post_type=$post_type";
+       }
 
        if ( $last = wp_check_post_lock( $post->ID ) ) {
                add_action('admin_notices', '_admin_notice_post_locked' );
@@ -157,16 +177,19 @@ case 'edit':
                wp_enqueue_script('autosave');
        }
 
-       $title = __('Edit Post');
-       $post = get_post_to_edit($post_ID);
+       $title = $post_type_object->labels->edit_item;
+       $post = get_post_to_edit($post_id);
+
+       if ( post_type_supports($post_type, 'comments') ) {
+               wp_enqueue_script('admin-comments');
+               enqueue_comment_hotkeys_js();
+       }
 
-       include('edit-form-advanced.php');
+       include('./edit-form-advanced.php');
 
        break;
 
 case 'editattachment':
-       $post_id = (int) $_POST['post_ID'];
-
        check_admin_referer('update-attachment_' . $post_id);
 
        // Don't let these be changed
@@ -180,65 +203,57 @@ case 'editattachment':
        wp_update_attachment_metadata( $post_id, $newmeta );
 
 case 'editpost':
-       $post_ID = (int) $_POST['post_ID'];
-       check_admin_referer('update-post_' . $post_ID);
+       check_admin_referer('update-' . $post_type . '_' . $post_id);
 
-       $post_ID = edit_post();
+       $post_id = edit_post();
 
-       redirect_post($post_ID); // Send user on their way while we keep working
+       redirect_post($post_id); // Send user on their way while we keep working
 
        exit();
        break;
 
 case 'trash':
-       $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('trash-post_' . $post_id);
+       check_admin_referer('trash-' . $post_type . '_' . $post_id);
 
        $post = & get_post($post_id);
 
-       if ( !current_user_can('delete_post', $post_id) )
-               wp_die( __('You are not allowed to move this post to the trash.') );
+       if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+               wp_die( __('You are not allowed to move this item to the Trash.') );
 
        if ( ! wp_trash_post($post_id) )
-               wp_die( __('Error in moving to trash...') );
+               wp_die( __('Error in moving to Trash.') );
 
        wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
        exit();
        break;
 
 case 'untrash':
-       $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('untrash-post_' . $post_id);
-
-       $post = & get_post($post_id);
+       check_admin_referer('untrash-' . $post_type . '_' . $post_id);
 
-       if ( !current_user_can('delete_post', $post_id) )
-               wp_die( __('You are not allowed to move this post out of the trash.') );
+       if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+               wp_die( __('You are not allowed to move this item out of the Trash.') );
 
        if ( ! wp_untrash_post($post_id) )
-               wp_die( __('Error in restoring from trash...') );
+               wp_die( __('Error in restoring from Trash.') );
 
        wp_redirect( add_query_arg('untrashed', 1, $sendback) );
        exit();
        break;
 
 case 'delete':
-       $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
-       check_admin_referer('delete-post_' . $post_id);
-
-       $post = & get_post($post_id);
+       check_admin_referer('delete-' . $post_type . '_' . $post_id);
 
-       if ( !current_user_can('delete_post', $post_id) )
-               wp_die( __('You are not allowed to delete this post.') );
+       if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+               wp_die( __('You are not allowed to delete this item.') );
 
        $force = !EMPTY_TRASH_DAYS;
        if ( $post->post_type == 'attachment' ) {
                $force = ( $force || !MEDIA_TRASH );
                if ( ! wp_delete_attachment($post_id, $force) )
-                       wp_die( __('Error in deleting...') );
+                       wp_die( __('Error in deleting.') );
        } else {
                if ( !wp_delete_post($post_id, $force) )
-                       wp_die( __('Error in deleting...') );
+                       wp_die( __('Error in deleting.') );
        }
 
        wp_redirect( add_query_arg('deleted', 1, $sendback) );
@@ -255,9 +270,9 @@ case 'preview':
        break;
 
 default:
-       wp_redirect('edit.php');
+               wp_redirect('edit.php');
        exit();
        break;
 } // end switch
-include('admin-footer.php');
+include('./admin-footer.php');
 ?>
index 4eda788c5c710571b68735f0d4fd979688171e01..a1a6f780d0f242ac68f1e9395f72d00cad57a10b 100644 (file)
@@ -7,29 +7,12 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
 if ( ! current_user_can('edit_posts') )
        wp_die( __( 'Cheatin&#8217; uh?' ) );
 
-/**
- * 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));
-}
-
 /**
  * Press It form handler.
  *
@@ -45,7 +28,7 @@ function press_it() {
        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
        $quick['post_title'] = ( trim($_POST['title']) != '' ) ? $_POST['title'] : '  ';
-       $quick['post_content'] = isset($_POST['post_content']) ? $_POST['post_content'] : ''; 
+       $quick['post_content'] = isset($_POST['post_content']) ? $_POST['post_content'] : '';
 
        // insert the post with nothing in it, to get an ID
        $post_ID = wp_insert_post($quick, true);
@@ -55,7 +38,7 @@ function press_it() {
        $content = isset($_POST['content']) ? $_POST['content'] : '';
 
        $upload = false;
-       if( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
+       if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
                foreach( (array) $_POST['photo_src'] as $key => $image) {
                        // see if files exist in content - we don't want to upload non-used selected files.
                        if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) {
@@ -63,7 +46,7 @@ function press_it() {
                                $upload = media_sideload_image($image, $post_ID, $desc);
 
                                // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
-                               if( !is_wp_error($upload) )
+                               if ( !is_wp_error($upload) )
                                        $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
                        }
                }
@@ -92,11 +75,17 @@ if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
 }
 
 // Set Variables
-$title = isset( $_GET['t'] ) ? trim( strip_tags( aposfix( stripslashes( $_GET['t'] ) ) ) ) : '';
-$selection = isset( $_GET['s'] ) ? trim( htmlspecialchars( html_entity_decode( aposfix( stripslashes( $_GET['s'] ) ) ) ) ) : '';
+$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
+
+$selection = '';
+if ( !empty($_GET['s']) ) {
+       $selection = str_replace('&apos;', "'", stripslashes($_GET['s']));
+       $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) );
+}
+
 if ( ! empty($selection) ) {
        $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
-       $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
+       $selection = '<p>' . str_replace('<p></p>', '', $selection) . '</p>';
 }
 
 $url = isset($_GET['u']) ? esc_url($_GET['u']) : '';
@@ -195,7 +184,7 @@ if ( !empty($_REQUEST['ajax']) ) {
                 */
                function get_images_from_uri($uri) {
                        $uri = preg_replace('/\/#.+?$/','', $uri);
-                       if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
+                       if ( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
                                return "'" . esc_attr( html_entity_decode($uri) ) . "'";
                        $content = wp_remote_fopen($uri);
                        if ( false === $content )
@@ -209,9 +198,9 @@ if ( !empty($_REQUEST['ajax']) ) {
                        $sources = array();
                        foreach ($matches[3] as $src) {
                                // if no http in url
-                               if(strpos($src, 'http') === false)
+                               if (strpos($src, 'http') === false)
                                        // if it doesn't have a relative uri
-                                       if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0)
+                                       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);
@@ -410,8 +399,8 @@ var photostorage = false;
                                        jQuery('#waiting').hide();
                                        jQuery('#extra-fields').show();
                                }
-                               jQuery('#extra-fields').before('<div id="waiting"><img src="images/wpspin_light.gif" alt="" /> <?php echo esc_js( __( 'Loading...' ) ); ?></div>');
-                               
+                               jQuery('#extra-fields').before('<div id="waiting"><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> <?php echo esc_js( __( 'Loading...' ) ); ?></div>');
+
                                if(photostorage == false) {
                                        jQuery.ajax({
                                                type: "GET",
@@ -486,35 +475,59 @@ var photostorage = false;
                                                <?php } else { ?>
                                                        <br /><br /><input class="button-primary" type="submit" name="review" value="<?php esc_attr_e('Submit for Review') ?>" id="review" />
                                                <?php } ?>
-                                               <img src="images/wpspin_light.gif" alt="" id="saving" style="display:none;" />
+                                               <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" id="saving" style="display:none;" />
                                        </p>
                                </div>
                        </div>
 
-                       <div id="categorydiv" class="stuffbox">
-                               <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>">
-                                       <br/>
-                               </div>
-                               <h3><?php _e('Categories') ?></h3>
+                       <?php $tax = get_taxonomy( 'category' ); ?>
+                       <div id="categorydiv" class="postbox">
+                               <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"><br /></div>
+                               <h3 class="hndle"><?php _e('Categories') ?></h3>
                                <div class="inside">
+                               <div id="taxonomy-category" class="categorydiv">
 
-                                       <div id="categories-all" class="tabs-panel">
+                                       <ul id="category-tabs" class="category-tabs">
+                                               <li class="tabs"><a href="#category-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
+                                               <li class="hide-if-no-js"><a href="#category-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
+                                       </ul>
 
-                                               <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-                                                       <?php wp_category_checklist($post_ID, false) ?>
+                                       <div id="category-pop" class="tabs-panel" style="display: none;">
+                                               <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
+                                                       <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?>
                                                </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="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
-                                                       <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
-                                                       <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
-                                                       <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
-                                                       <span id="category-ajax-response"></span>
-                                               </p>
+                                       <div id="category-all" class="tabs-panel">
+                                               <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+                                                       <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
+                                               </ul>
                                        </div>
+
+                                       <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?>
+                                       <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
+                                       <?php endif; ?>
+                                       <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
+                                               <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 printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
+                                                               </a>
+                                                       </h4>
+                                                       <p id="category-add" class="category-add wp-hidden-child">
+                                                               <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
+                                                               <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/>
+                                                               <label class="screen-reader-text" for="newcategory_parent">
+                                                                       <?php echo $tax->labels->parent_item_colon; ?>
+                                                               </label>
+                                                               <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;', 'tab_index' => 3 ) ); ?>
+                                                               <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" />
+                                                               <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
+                                                               <span id="category-ajax-response"></span>
+                                                       </p>
+                                               </div>
+                                       <?php endif; ?>
+                               </div>
                                </div>
                        </div>
 
@@ -542,7 +555,7 @@ var photostorage = false;
        </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>
+               <div id="message" class="updated"><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">
@@ -558,13 +571,13 @@ var photostorage = false;
 
                                <li id="photo_button">
                                        Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#">
-<img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a>
+<img alt="<?php _e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a>
                                        <?php } ?>
                                </li>
                                <li id="video_button">
-                                       <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a>
+                                       <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-video.gif?ver=20100531' ) ); ?>"/></a>
                                </li>
-                               <?php if( user_can_richedit() ) { ?>
+                               <?php if ( user_can_richedit() ) { ?>
                                <li id="switcher">
                                        <?php wp_print_scripts( 'quicktags' ); ?>
                                        <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>
index 7c30cdfd25e521bc7271a06222076afdf5dd22ce..97c19db43eaf07429abb614242a90c7742abfb85 100644 (file)
@@ -15,5 +15,5 @@
 define('IS_PROFILE_PAGE', true);
 
 /** Load User Editing Page */
-require_once('user-edit.php');
+require_once('./user-edit.php');
 ?>
index 9c3ce3630b4accc1725a639c15391fc635a998a2..668ec484abb49480e0f5c311f9557c5cfc63c41a 100644 (file)
@@ -7,24 +7,19 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
+
+wp_enqueue_script('list-revisions');
+
+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);
 $right       = absint($right);
 
-$parent_file = $redirect = 'edit.php';
+$redirect = 'edit.php';
 
 switch ( $action ) :
-case 'delete' : // stubs
-case 'edit' :
-       if ( constant('WP_POST_REVISIONS') ) // stub
-               $redirect = remove_query_arg( 'action' );
-       else // Revisions disabled
-               $redirect = 'edit.php';
-       break;
 case 'restore' :
        if ( !$revision = wp_get_post_revision( $revision_id ) )
                break;
@@ -33,8 +28,11 @@ case 'restore' :
        if ( !$post = get_post( $revision->post_parent ) )
                break;
 
-       if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
+       // Revisions disabled and we're not looking at an autosave
+       if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) {
+               $redirect = 'edit.php?post_type=' . $post->post_type;
                break;
+       }
 
        check_admin_referer( "restore-post_$post->ID|$revision->ID" );
 
@@ -53,7 +51,7 @@ case 'diff' :
        // If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post
        if ( $left_revision->ID == $right_revision->ID ) {
                $redirect = get_edit_post_link( $left_revision->ID );
-               include( 'js/revisions-js.php' );
+               include( './js/revisions-js.php' );
                break;
        }
 
@@ -72,15 +70,17 @@ case 'diff' :
        else
                break; // Don't diff two unrelated revisions
 
-       if ( !constant('WP_POST_REVISIONS') ) { // Revisions disabled
+       if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) { // Revisions disabled
                if (
                        // we're not looking at an autosave
                        ( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) )
                ||
                        // we're not comparing an autosave to the current post
                        ( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID )
-               )
+               ) {
+                       $redirect = 'edit.php?post_type=' . $post->post_type;
                        break;
+               }
        }
 
        if (
@@ -94,6 +94,7 @@ case 'diff' :
 
        $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
        $h2 = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
+       $title = __( 'Revisions' );
 
        $left  = $left_revision->ID;
        $right = $right_revision->ID;
@@ -110,12 +111,16 @@ default :
        if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) )
                break;
 
-       if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
+       // Revisions disabled and we're not looking at an autosave
+       if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) {
+               $redirect = 'edit.php?post_type=' . $post->post_type;
                break;
+       }
 
        $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
        $revision_title = wp_post_revision_title( $revision, false );
-       $h2 = sprintf( __( 'Post Revision for &#8220;%1$s&#8221; created on %2$s' ), $post_title, $revision_title );
+       $h2 = sprintf( __( 'Revision for &#8220;%1$s&#8221; created on %2$s' ), $post_title, $revision_title );
+       $title = __( 'Revisions' );
 
        // Sets up the diff radio buttons
        $left  = $revision->ID;
@@ -125,23 +130,22 @@ default :
        break;
 endswitch;
 
-if ( !$redirect && !in_array( $post->post_type, array( 'post', 'page' ) ) )
+// Empty post_type means either malformed object found, or no valid parent was found.
+if ( !$redirect && empty($post->post_type) )
        $redirect = 'edit.php';
 
-if ( $redirect ) {
+if ( !empty($redirect) ) {
        wp_redirect( $redirect );
        exit;
 }
 
-if ( 'page' == $post->post_type ) {
-       $submenu_file = 'edit-pages.php';
-       $title = __( 'Page Revisions' );
-} else {
-       $submenu_file = 'edit.php';
-       $title = __( 'Post Revisions' );
-}
+// This is so that the correct "Edit" menu item is selected.
+if ( !empty($post->post_type) && 'post' != $post->post_type )
+       $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
+else
+       $parent_file = $submenu_file = 'edit.php';
 
-require_once( 'admin-header.php' );
+require_once( './admin-header.php' );
 
 ?>
 
@@ -206,7 +210,7 @@ endif;
 <?php
 
 $args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left );
-if ( !constant( 'WP_POST_REVISIONS' ) )
+if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') )
        $args['type'] = 'autosave';
 
 wp_list_post_revisions( $post, $args );
@@ -216,5 +220,4 @@ wp_list_post_revisions( $post, $args );
 </div>
 
 <?php
-
-require_once( 'admin-footer.php' );
+require_once( './admin-footer.php' );
diff --git a/wp-admin/rtl.css b/wp-admin/rtl.css
deleted file mode 100644 (file)
index d477433..0000000
+++ /dev/null
@@ -1 +0,0 @@
-td.available-theme{text-align:right;}#current-theme img{float:right;margin-right:0;margin-left:1em;}.quicktags,.search{font-family:Tahoma,Arial,sans-serif;}#save-post{float:right;}.preview{float:left;}#sticky-span{margin-left:0;margin-right:18px;}#post-body .misc-pub-section{border-right-width:0;border-left-width:1;border-right-style:none;border-left-style:solid;float:right;}#post-body .misc-pub-section-last{border-left:0;}#delete-action{text-align:right;float:right;}#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,Arial,sans-serif;}#wpcontent select{font-family:Tahoma,Arial,sans-serif;}#quicktags{background-position:right top;}#template div{margin-right:0;margin-left:190px;}* html #template div{margin-left:0;}#your-profile legend{font-family:Tahoma,Arial,sans-serif;}#ajax-response.alignleft{margin-left:0;margin-right:2em;}.page-numbers{margin-right:0;margin-left:1px;}.column-author img,.column-username img{float:right;margin-right:0;margin-left:10px;}.tablenav a.button-secondary{margin:8px 0 0 8px;}.tablenav .tablenav-pages{float:left;}.tablenav .displaying-num{margin-right:0;margin-left:10px;font-family:Tahoma,Arial,sans-serif;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{margin:8px 8px 8px 0;}#pass-strength-result{float:right;margin:12px 1px 5px 5px;}#user_info{float:left;}#header-logo{float:right;margin:7px 15px 0 0;}#wphead h1{font-family:Tahoma,Arial,sans-serif;float:right;}#wphead h1.long-title{font-family:Tahoma,Arial,sans-serif;}#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,Arial,sans-serif;}#adminmenu a.menu-top,#adminmenu .wp-submenu-head{font-family:Tahoma,Arial,sans-serif;}#adminmenu img.wp-menu-image{float:right;}.folded #adminmenu img.wp-menu-image{padding:7px 6px 0 0;}#adminmenu a.separator{cursor:e-resize;}.folded #adminmenu a.separator{cursor:w-resize;}#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;}.folded #adminmenu a.wp-has-submenu{margin-left:0;margin-right:40px;}#adminmenu .wp-menu-toggle{float:left;padding:1px 0 0 2px;clear:left;}#adminmenu div.wp-menu-image{float:right;}#wphead-info{margin:0 15px 0 0;padding-right:0;padding-left:15px;}#adminmenu #awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{font-family:Tahoma,Arial,sans-serif;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,Arial,sans-serif;}.column-response .post-com-count{float:right;margin-right:0;margin-left:5px;}.form-table th,#wpbody-content .describe th{text-align:right;}.form-table input.tog{margin-right:0;margin-left:2px;float:right;}.form-table table.color-palette{float:right;}#profile-page .form-table #rich_editing{margin-right:0;margin-left:5px;}#normal-sortables .postbox .submit{float:left;}#post-body .tagsdiv #newtag{margin-right:0;margin-left:5px;}#post-status-info{padding:0 7px 0 15px;}#comment-status-radio input{margin:2px 0 5px 3px;}.tagchecklist{margin-left:0;margin-right:10px;}.tagchecklist strong{margin-left:0;margin-right:-8px;}.tagchecklist span{float:right;}.tagchecklist span a{margin:6px -9px 0 0;float:right;}.ac_results li{text-align:right;}#poststuff h2{clear:right;}.description,.form-wrap p{font-family:Tahoma,Arial,sans-serif;}.meta-box-sortables .postbox .handlediv{float:left;}.howto{font-family:Tahoma,Arial,sans-serif;}.postarea h3 label{float:right;}.postarea #add-media-button{float:left;right:auto;left:10px;}.wp_themeSkin tr.mceFirst td.mceToolbar{background-position:right top;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{margin:5px 0 0 5px;float:left;}#poststuff #edButtonHTML{margin-right:0;margin-left:15px;}#media-buttons a{padding:0 10px 5px 0;}.submitbox .submit{text-align:right;}.inside-submitbox #post_status{margin:2px -2px 2px 0;}.submitbox .submit input{margin-right:0;margin-left:4px;}#category-adder{margin-left:0;margin-right:120px;}#post-body ul#category-tabs li.tabs{-moz-border-radius:0 3px 3px 0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;-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;}#post-body ul#category-tabs{float:right;text-align:left;margin:0 0 0 -120px;}#post-body #categorydiv div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 120px 0 5px;}#side-sortables #category-tabs li{padding-right:0;padding-left:8px;}#categorydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:0;margin-right:18px;}p.search-box{float:left;}#posts-filter fieldset{float:right;margin:0 0 1em 1.5ex;}#posts-filter fieldset legend{padding:0 1px .2em 0;}.view-switch{float:left;}.filter{float:right;margin:-5px 10px 0 0;}#the-comment-list td.comment p.comment-author{margin-right:0;}#the-comment-list p.comment-author img{float:right;margin-right:0;margin-left:8px;}.tablenav .delete{margin-right:0;margin-left:20px;}td.action-links,th.action-links{text-align:left;}.filter .subsubsub{margin-left:0;margin-right:-10px;}#wp-word-count{margin-right:10px;}.tool-box .title{font-family:Tahoma,Arial,sans-serif;}.settings-toggle{text-align:left;margin:5px 0 15px 7px;}.curtime #timestamp{background-position:right top;padding-left:0;padding-right:18px;}#sidemenu{margin:-30px 315px 0 15px;float:left;padding-left:0;padding-right:10px;}#sidemenu a{float:right;}#replysubmit .button{margin-right:0;margin-left:5px;}#edithead .inside{float:right;margin:3px 5px 2px 0;}#replyrow #ed_reply_toolbar input{margin:1px 1px 1px 2px;}#screen-meta-links{margin:0 0 0 9px;}#screen-options-link-wrap,#contextual-help-link-wrap{float:left;font-family:Tahoma,Arial,sans-serif;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;}#bulk-titles div a{float:right;margin:3px -2px 0 3px;}#wpbody-content .filename{margin-left:0;margin-right:10px;}#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;}.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:.5em;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:0;margin-left:.5em;}.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title{font-family:Tahoma,Arial,sans-serif;}.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,Arial,sans-serif;}.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{float:left;}#favorite-first{padding:3px 12px 4px 30px;}#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;}ol{list-style-type:decimal;margin-left:0;margin-right:2em;}.postbox-container{float:right;padding-left:.5%;padding-right:0;}.clearlooks2 .mceTop .mceLeft{width:100%!important;}#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;}
\ No newline at end of file
index abab9904de2639f6773fb320ab6eba01ea2a3f4d..6089a23bf90298240960f4879b43e37c71afac48 100644 (file)
  */
 define('WP_INSTALLING', true);
 
+/**
+ * We are blissfully unaware of anything.
+ */
+define('WP_SETUP_CONFIG', true);
+
 /**
  * Disable error reporting
  *
- * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) f
-or debugging
+ * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
  */
 error_reporting(0);
 
@@ -32,11 +36,14 @@ error_reporting(0);
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
+define('WP_DEBUG', false);
 /**#@-*/
 
+require_once(ABSPATH . WPINC . '/load.php');
 require_once(ABSPATH . WPINC . '/compat.php');
 require_once(ABSPATH . WPINC . '/functions.php');
 require_once(ABSPATH . WPINC . '/classes.php');
+require_once(ABSPATH . WPINC . '/version.php');
 
 if (!file_exists(ABSPATH . 'wp-config-sample.php'))
        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
@@ -51,8 +58,8 @@ if (file_exists(ABSPATH . 'wp-config.php'))
 if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php'))
        wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
-if ( version_compare( '4.3', phpversion(), '>' ) )
-       wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
+if ( version_compare( $required_php_version, phpversion(), '>' ) )
+       wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress requires at least %2$s.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) );
 
 if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') )
        wp_die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
@@ -102,7 +109,7 @@ switch($step) {
 <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 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>
+<p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button">Let&#8217;s go!</a></p>
 <?php
        break;
 
@@ -130,7 +137,7 @@ switch($step) {
                <tr>
                        <th scope="row"><label for="dbhost">Database Host</label></th>
                        <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
-                       <td>99% chance you won't need to change this value.</td>
+                       <td>You should be able to get this info from your web host, if <code>localhost</code> does not work.</td>
                </tr>
                <tr>
                        <th scope="row"><label for="prefix">Table Prefix</label></th>
@@ -138,6 +145,7 @@ switch($step) {
                        <td>If you want to run multiple WordPress installations in a single database, change this.</td>
                </tr>
        </table>
+       <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="true" /><?php } ?>
        <p class="step"><input name="submit" type="submit" value="Submit" class="button" /></p>
 </form>
 <?php
@@ -149,7 +157,12 @@ switch($step) {
        $passwrd = trim($_POST['pwd']);
        $dbhost  = trim($_POST['dbhost']);
        $prefix  = trim($_POST['prefix']);
-       if (empty($prefix)) $prefix = 'wp_';
+       if ( empty($prefix) )
+               $prefix = 'wp_';
+
+       // Validate $prefix: it can only contain letters, numbers and underscores
+       if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
+               wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );
 
        // Test the db connection.
        /**#@+
@@ -166,16 +179,49 @@ switch($step) {
        if ( !empty($wpdb->error) )
                wp_die($wpdb->error->get_error_message());
 
+       // Fetch or generate keys and salts.
+       $no_api = isset( $_POST['noapi'] );
+       require_once( ABSPATH . WPINC . '/plugin.php' );
+       require_once( ABSPATH . WPINC . '/l10n.php' );
+       require_once( ABSPATH . WPINC . '/pomo/translations.php' );
+       if ( ! $no_api ) {
+               require_once( ABSPATH . WPINC . '/class-http.php' );
+               require_once( ABSPATH . WPINC . '/http.php' );
+               wp_fix_server_vars();
+               /**#@+
+                * @ignore
+                */
+               function get_bloginfo() {
+                       return ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' ) );
+               }
+               /**#@-*/
+               $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
+       }
+
+       if ( $no_api || is_wp_error( $secret_keys ) ) {
+               $secret_keys = array();
+               require_once( ABSPATH . WPINC . '/pluggable.php' );
+               for ( $i = 0; $i < 8; $i++ ) {
+                       $secret_keys[] = wp_generate_password( 64, true, true );
+               }
+       } else {
+               $secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
+               foreach ( $secret_keys as $k => $v ) {
+                       $secret_keys[$k] = substr( $v, 28, 64 );
+               }
+       }
+       $key = 0;
+
        foreach ($configFile as $line_num => $line) {
                switch (substr($line,0,16)) {
                        case "define('DB_NAME'":
-                               $configFile[$line_num] = str_replace("putyourdbnamehere", $dbname, $line);
+                               $configFile[$line_num] = str_replace("database_name_here", $dbname, $line);
                                break;
                        case "define('DB_USER'":
-                               $configFile[$line_num] = str_replace("'usernamehere'", "'$uname'", $line);
+                               $configFile[$line_num] = str_replace("'username_here'", "'$uname'", $line);
                                break;
                        case "define('DB_PASSW":
-                               $configFile[$line_num] = str_replace("'yourpasswordhere'", "'$passwrd'", $line);
+                               $configFile[$line_num] = str_replace("'password_here'", "'$passwrd'", $line);
                                break;
                        case "define('DB_HOST'":
                                $configFile[$line_num] = str_replace("localhost", $dbhost, $line);
@@ -183,6 +229,16 @@ switch($step) {
                        case '$table_prefix  =':
                                $configFile[$line_num] = str_replace('wp_', $prefix, $line);
                                break;
+                       case "define('AUTH_KEY":
+                       case "define('SECURE_A":
+                       case "define('LOGGED_I":
+                       case "define('NONCE_KE":
+                       case "define('AUTH_SAL":
+                       case "define('SECURE_A":
+                       case "define('LOGGED_I":
+                       case "define('NONCE_SA":
+                               $configFile[$line_num] = str_replace('put your unique phrase here', $secret_keys[$key++], $line );
+                               break;
                }
        }
        if ( ! is_writable(ABSPATH) ) :
@@ -190,9 +246,9 @@ switch($step) {
 ?>
 <p>Sorry, but I can't write the <code>wp-config.php</code> file.</p>
 <p>You can create the <code>wp-config.php</code> manually and paste the following text into it.</p>
-<textarea cols="90" rows="15"><?php
+<textarea cols="98" rows="15" class="code"><?php
                foreach( $configFile as $line ) {
-                       echo htmlentities($line);
+                       echo htmlentities($line, ENT_COMPAT, 'UTF-8');
                }
 ?></textarea>
 <p>After you've done that, click "Run the install."</p>
index 62a375d40b73ed6472d6ac643f5f2a8b9c57128e..0f905bf63b478aedb57817a8a08e0b70def3872c 100644 (file)
@@ -13,7 +13,7 @@
 $mode = 'sidebar';
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( ! current_user_can('edit_posts') )
        wp_die(__('Cheatin&#8217; uh?'));
index 1d1b95ab70a16d3eddf1b18df0458fc2208eb617..72cb117de98a0d7100dbd62024e46488dd6cf037 100644 (file)
@@ -7,14 +7,28 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( !current_user_can('edit_themes') )
-       wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
+       wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');
 
 $title = __("Edit Themes");
 $parent_file = 'themes.php';
 
+$help = '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p>';
+$help .= '<p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p>';
+$help .= '<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '</p>';
+$help .= '<p>' . __('After typing in your edits, click Update File.') . '</p>';
+$help .= '<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>';
+$help .= '<p>' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="http://codex.wordpress.org/Child_Themes" target="_blank">child theme</a> instead.') . '</p>';
+$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Theme_Development" target="_blank">Documentation on Theme Development</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Editing_Files" target="_blank">Documentation on Editing Files</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Template_Tags" target="_blank">Documentation on Template Tags</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+add_contextual_help($current_screen, $help);
+
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir'));
 
 wp_admin_css( 'theme-editor' );
@@ -37,9 +51,9 @@ if (empty($file)) {
 } else {
        $file = stripslashes($file);
        if ( 'theme' == $dir ) {
-               $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ; 
+               $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ;
        } else if ( 'style' == $dir) {
-               $file = dirname(dirname($themes[$theme]['Stylesheet Dir'])) . $file ; 
+               $file = dirname(dirname($themes[$theme]['Stylesheet Dir'])) . $file ;
        }
 }
 
@@ -79,7 +93,7 @@ break;
 
 default:
 
-       require_once('admin-header.php');
+       require_once('./admin-header.php');
 
        update_recently_edited($file);
 
@@ -102,12 +116,11 @@ default:
                }
 
                $content = htmlspecialchars( $content );
-               $codepress_lang = codepress_get_lang($file);
        }
 
        ?>
 <?php if (isset($_GET['a'])) : ?>
- <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
+ <div id="message" class="updated"><p><?php _e('File edited successfully.') ?></p></div>
 <?php endif;
 
 $description = get_file_description($file);
@@ -141,12 +154,11 @@ $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (
 <br class="clear" />
 </div>
        <div id="templateside">
-       <h3><?php _e("Theme Files"); ?></h3>
 
 <?php
 if ($allowed_files) :
 ?>
-       <h4><?php _e('Templates'); ?></h4>
+       <h3><?php _e('Templates'); ?></h3>
        <ul>
 <?php
        $template_mapping = array();
@@ -154,12 +166,12 @@ if ($allowed_files) :
        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;
+               $filedesc = ( $description != $template_file ) ? "$description<br /><span class='nonessential'>($template_show)</span>" : "$description";
+               $filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description<br /><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 ( array_key_exists($description, $template_mapping ) ) {
                        if ( false !== strpos( $template_file, $template_dir ) )  {
                                $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc );
                        }
@@ -173,7 +185,7 @@ if ($allowed_files) :
                <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>&amp;dir=theme"><?php echo $filedesc ?></a></li>
 <?php endwhile; ?>
        </ul>
-       <h4><?php /* translators: Theme stylesheets in theme editor */ echo _x('Styles', 'Theme stylesheets in theme editor'); ?></h4>
+       <h3><?php /* translators: Theme stylesheets in theme editor */ _ex('Styles', 'Theme stylesheets in theme editor'); ?></h3>
        <ul>
 <?php
        $template_mapping = array();
@@ -181,8 +193,8 @@ if ($allowed_files) :
        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;
+               $filedesc = ( $description != $style_file ) ? "$description<br /><span class='nonessential'>($style_show)</span>" : "$description";
+               $filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description<br /><span class='nonessential'>($style_show)</span></span>" : $filedesc;
                $template_mapping[ $description ] = array( _get_template_edit_filename($style_file, $stylesheet_dir), $filedesc );
        }
        ksort( $template_mapping );
@@ -196,17 +208,17 @@ if ($allowed_files) :
 <?php if (!$error) { ?>
        <form name="template" id="template" action="theme-editor.php" method="post">
        <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
-                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
+                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
                 <input type="hidden" name="action" value="update" />
                 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
                 <input type="hidden" name="theme" value="<?php echo esc_attr($theme) ?>" />
                 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
                 </div>
        <?php if ( isset($functions ) && count($functions) ) { ?>
-               <div id="documentation">
+               <div id="documentation" class="hide-if-no-js">
                <label for="docs-list"><?php _e('Documentation:') ?></label>
                <?php echo $docs_select; ?>
-               <input type="button" class="button" value=" <?php esc_attr_e( 'Lookup' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" />
+               <input type="button" class="button" value=" <?php esc_attr_e( 'Lookup' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" />
                </div>
        <?php } ?>
 
@@ -241,4 +253,4 @@ jQuery(document).ready(function($){
 break;
 }
 
-include("admin-footer.php");
+include("./admin-footer.php");
index 3341db4674ec0a1634450ff51f456fb091041725..8b954269fa958de83276737d36ffab433c05f572 100644 (file)
@@ -7,15 +7,16 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( ! current_user_can('install_themes') )
-       wp_die(__('You do not have sufficient permissions to install themes on this blog.'));
+       wp_die(__('You do not have sufficient permissions to install themes on this site.'));
 
 include(ABSPATH . 'wp-admin/includes/theme-install.php');
 
 $title = __('Install Themes');
 $parent_file = 'themes.php';
+$submenu_file = 'themes.php';
 
 wp_reset_vars( array('tab', 'paged') );
 wp_enqueue_style( 'theme-install' );
@@ -41,22 +42,30 @@ $tabs = apply_filters('install_themes_tabs', $tabs );
 $nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs);
 
 //If a non-valid menu tab has been selected, And its not a non-menu action.
-if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
+if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
        $tab_actions = array_keys($tabs);
        $tab = $tab_actions[0];
 }
-if( empty($paged) )
+if ( empty($paged) )
        $paged = 1;
 
 $body_id = $tab;
 
 do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information.
 
-include('admin-header.php');
+$help = '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are licensed under the GNU General Public License, version 2, just like WordPress.'), 'http://wordpress.org/extend/themes/') . '</p>';
+$help .= '<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it.') . '</p>';
+$help .= '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
+$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+add_contextual_help($current_screen, $help);
+
+include('./admin-header.php');
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?></h2>
+<h2><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
 
        <ul class="subsubsub">
 <?php
@@ -73,4 +82,4 @@ foreach ( (array)$tabs as $action => $text ) {
        <?php do_action('install_themes_' . $tab, $paged); ?>
 </div>
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
index c5fd70c6602b5f5311e23815ee48d9d11b9f8649..72589324e74b6bc5a9da761a63e7bf9bf227f7bc 100644 (file)
@@ -7,12 +7,12 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( !current_user_can('switch_themes') )
+if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
        wp_die( __( 'Cheatin&#8217; uh?' ) );
 
-if ( isset($_GET['action']) ) {
+if ( current_user_can('switch_themes') && isset($_GET['action']) ) {
        if ( 'activate' == $_GET['action'] ) {
                check_admin_referer('switch-theme_' . $_GET['template']);
                switch_theme($_GET['template'], $_GET['stylesheet']);
@@ -20,7 +20,7 @@ if ( isset($_GET['action']) ) {
                exit;
        } else if ( 'delete' == $_GET['action'] ) {
                check_admin_referer('delete-theme_' . $_GET['template']);
-               if ( !current_user_can('update_themes') )
+               if ( !current_user_can('delete_themes') )
                        wp_die( __( 'Cheatin&#8217; uh?' ) );
                delete_theme($_GET['template']);
                wp_redirect('themes.php?deleted=true');
@@ -31,34 +31,42 @@ if ( isset($_GET['action']) ) {
 $title = __('Manage Themes');
 $parent_file = 'themes.php';
 
-$help = '<p>' . __('Themes give your WordPress style. Once a theme is installed, you may preview it, activate it or deactivate it here.') . '</p>';
-if ( current_user_can('install_themes') ) {
-       $help .= '<p>' . sprintf(__('You can find additional themes for your site by using the new <a href="%1$s">Theme Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/themes/">WordPress Theme Directory</a> directly and installing manually.  To install a theme <em>manually</em>, <a href="%2$s">upload its ZIP archive with the new uploader</a> or copy its folder via FTP into your <code>wp-content/themes</code> directory.'), 'theme-install.php', 'theme-install.php?tab=upload' ) . '</p>';
-       $help .= '<p>' . __('Once a theme is uploaded, you should see it on this page.') . '</p>' ;
-}
+if ( current_user_can( 'switch_themes' ) ) :
+
+$help = '<p>' . __('Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties.') . '</p>';
+$help .= '<p>' . __('You can see your active theme at the top of the screen. Below are the other themes you have installed that are not currently in use. You can see what your site would look like with one of these themes by clicking the Preview link. To change themes, click the Activate link.') . '</p>';
+if ( current_user_can('install_themes') )
+       $help .= '<p>' . sprintf(__('If you would like to see more themes to choose from, click on the &#8220;Install Themes&#8221; tab and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are licensed under the GNU General Public License, version 2, just like WordPress. Oh, and they&#8217;re free!'), 'http://wordpress.org/extend/themes/') . '</p>';
 
-add_contextual_help('themes', $help);
+$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+add_contextual_help($current_screen, $help);
 
 add_thickbox();
 wp_enqueue_script( 'theme-preview' );
 
-require_once('admin-header.php');
+endif;
+
+require_once('./admin-header.php');
+if ( is_multisite() && current_user_can('edit_themes') ) {
+       ?><div id="message0" class="updated"><p><?php printf( __('Administrator: new themes must be activated in the <a href="%s">Network Themes</a> screen before they appear here.'), admin_url( 'ms-themes.php') ); ?></p></div><?php
+}
 ?>
 
 <?php if ( ! validate_current_theme() ) : ?>
-<div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
+<div id="message1" class="updated"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
 <?php elseif ( isset($_GET['activated']) ) :
-               if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) ) { ?>
-<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings page</a> to configure them.'), admin_url('widgets.php') ); ?></p></div><?php
+               if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
+<div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
                } else { ?>
-<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div><?php
+<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
                }
        elseif ( isset($_GET['deleted']) ) : ?>
-<div id="message3" class="updated fade"><p><?php _e('Theme deleted.') ?></p></div>
+<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
 <?php endif; ?>
-
 <?php
-$themes = get_themes();
+$themes = get_allowed_themes();
 $ct = current_theme_info();
 unset($themes[$ct->name]);
 
@@ -84,50 +92,11 @@ $page_links = paginate_links( array(
 ));
 
 $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_transient('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 ];
-               $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');
-               $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
-               $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
-               $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Upgrading this theme will lose any customizations you have made.  'Cancel' to stop, 'OK' to upgrade.") ) . '\') ) {return true;}return false;"';
-
-               if ( ! current_user_can('update_themes') )
-                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
-               else if ( empty($update->package) )
-                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
-               else
-                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s" %5$s >upgrade automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
-       }
-}
-
 ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a></h2>
+<h2><a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a><?php if ( current_user_can('install_themes') ) { ?><a href="theme-install.php" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a><?php } ?></h2>
 
 <h3><?php _e('Current Theme'); ?></h3>
 <div id="current-theme">
@@ -138,8 +107,8 @@ function theme_update_available( $theme ) {
        /* translators: 1: theme title, 2: theme version, 3: theme author */
        printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h4>
 <p class="theme-description"><?php echo $ct->description; ?></p>
-<?php if ($ct->parent_theme) { ?>
-       <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?></p>
+<?php if ( current_user_can('edit_themes') && $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, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?></p>
 <?php } else { ?>
        <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ) ); ?></p>
 <?php } ?>
@@ -151,6 +120,13 @@ function theme_update_available( $theme ) {
 </div>
 
 <div class="clear"></div>
+<?php
+if ( ! current_user_can( 'switch_themes' ) ) {
+       echo '</div>';
+       require( './admin-footer.php' );
+       exit;
+}
+?>
 <h3><?php _e('Available Themes'); ?></h3>
 <div class="clear"></div>
 
@@ -217,8 +193,8 @@ foreach ( $cols as $col => $theme_name ) {
        $actions = array();
        $actions[] = '<a href="' . $activate_link .  '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>';
        $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $theme_name)) . '">' . __('Preview') . '</a>';
-       if ( current_user_can('update_themes') )
-               $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "if ( confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>';
+       if ( current_user_can('delete_themes') )
+               $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "return confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $theme_name )) . "');" . '">' . __('Delete') . '</a>';
        $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]);
 
        $actions = implode ( ' | ', $actions );
@@ -233,9 +209,9 @@ foreach ( $cols as $col => $theme_name ) {
        printf(__('%1$s %2$s by %3$s'), $title, $version, $author) ; ?></h3>
 <p class="description"><?php echo $description; ?></p>
 <span class='action-links'><?php echo $actions ?></span>
-       <?php if ($parent_theme) {
+       <?php if ( current_user_can('edit_themes') && $parent_theme ) {
        /* translators: 1: theme title, 2:  template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?>
-       <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?></p>
+       <p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?></p>
 <?php } else { ?>
        <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?></p>
 <?php } ?>
@@ -250,7 +226,12 @@ foreach ( $cols as $col => $theme_name ) {
 <?php } // end foreach $table ?>
 </table>
 <?php } else { ?>
-<p><?php _e('You only have one theme installed at the moment so there is nothing to show you here.  Maybe you should download some more to try out.'); ?></p>
+<p><?php
+       if ( current_user_can('install_themes') )
+               printf(__('You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the <em><a href="%s">Install Themes</a></em> tab above.'), 'theme-install.php');
+       else
+               printf(__('Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.'), get_site_option('site_name'));
+       ?></p>
 <?php } // end if $theme_total?>
 <br class="clear" />
 
@@ -266,11 +247,11 @@ foreach ( $cols as $col => $theme_name ) {
 <?php
 // List broken themes, if any.
 $broken_themes = get_broken_themes();
-if ( count($broken_themes) ) {
+if ( current_user_can('edit_themes') && count( $broken_themes ) ) {
 ?>
 
-<h2><?php _e('Broken Themes'); ?></h2>
-<p><?php _e('The following themes are installed but incomplete.  Themes must have a stylesheet and a template.'); ?></p>
+<h2><?php _e('Broken Themes'); ?> <?php if ( is_multisite() ) _e( '(Site admin only)' ); ?></h2>
+<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
 
 <table id="broken-themes">
        <tr>
@@ -301,4 +282,4 @@ if ( count($broken_themes) ) {
 ?>
 </div>
 
-<?php require('admin-footer.php'); ?>
+<?php require('./admin-footer.php'); ?>
index e7145f339491ed4bc7bdea0b405990c7c4d2b14a..20cecf6badce068b8d6e7fea7b3cb2b3232c9c01 100644 (file)
@@ -1,97 +1,58 @@
 <?php
 /**
- * Turbo Administration Panel.
+ * Tools Administration Panel.
  *
  * @package WordPress
  * @subpackage Administration
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 $title = __('Tools');
-wp_enqueue_script( 'wp-gears' );
 
-require_once('admin-header.php');
+add_contextual_help($current_screen,
+       '<p>' . __('Press This is a bookmarklet that makes it easy to blog about something you come across on the web. You can use it to just grab a link, or to post an excerpt. Press This will even allow you to choose from images included on the page and use them in your post. Just drag the Press This link on this screen to your bookmarks bar in your browser, and you&#8217;ll be on your way to easier content creation.') . '</p>' .
+       '<p>' . __('Note: Turbo/Gears is no longer promoted on this screen as it was in previous versions due to the fact that Google has discontinued support for it.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Tools_SubPanel" target="_blank">Tools Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once('./admin-header.php');
 
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $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 the Under the Hood tab in Chrome&#8217;s Options menu.');
-       elseif ( $is_safari )
-               _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
-       else
-               _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('edit_posts') ) : ?>
 <div class="tool-box">
        <h3 class="title"><?php _e('Press This') ?></h3>
        <p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
 
-       <p><?php _e('Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your blog.'); ?></p>
+       <p><?php _e('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 site.'); ?></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 esc_attr(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
 </div>
 <?php
 endif;
 
+if ( current_user_can( 'import' ) ) :
+$cats = get_taxonomy('category');
+$tags = get_taxonomy('post_tag');
+if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
+<div class="tool-box">
+    <h3 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h3>
+    <p><?php printf( __('<a href="%s">Use this</a> to convert categories to tags or tags to categories.'), 'import.php' ); ?></p>
+</div>
+<?php
+endif;
+endif;
+
 do_action( 'tool_box' );
 ?>
 </div>
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
 ?>
index 69a9e5c0696238070435478008af87b4f064ced0..457ca338a757ad698496ab417e92b365108dc2b2 100644 (file)
@@ -7,30 +7,44 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( ! current_user_can('update_plugins') )
-       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
+       wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
 
 function list_core_update( $update ) {
-       global $wp_local_package;
+       global $wp_local_package, $wpdb;
        $version_string = ('en_US' == $update->locale && 'en_US' == get_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');
+       $submit = __('Update Automatically');
        $form_action = 'update-core.php?action=do-core-upgrade';
+       $php_version    = phpversion();
+       $mysql_version  = $wpdb->db_version();
+       $show_buttons = true;
        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:');
+               $message = __('You are using a development version of WordPress.  You can update 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);
+                       $message = sprintf(__('You have the latest version of WordPress. You do not need to update. 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);
+                       $php_compat     = version_compare( $php_version, $update->php_version, '>=' );
+                       $mysql_compat   = version_compare( $mysql_version, $update->mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
+                       if ( !$mysql_compat && !$php_compat )
+                               $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
+                       elseif ( !$php_compat )
+                               $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
+                       elseif ( !$mysql_compat )
+                               $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
+                       else
+                               $message =      sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> automatically or download the package and install it manually:'), $version_string);
+                       if ( !$mysql_compat || !$php_compat )
+                               $show_buttons = false;
                }
                $download = sprintf(__('Download %s'), $version_string);
        }
@@ -41,10 +55,12 @@ function list_core_update( $update ) {
        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="' . esc_attr($submit) . '" name="upgrade" />&nbsp;';
        echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
        echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
-       echo '<a href="' . esc_url($update->package) . '" class="button">' . $download . '</a>&nbsp;';
+       if ( $show_buttons ) {
+               echo '<input id="upgrade" class="button" type="submit" value="' . esc_attr($submit) . '" name="upgrade" />&nbsp;';
+               echo '<a href="' . esc_url($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="' . esc_attr__('Hide this update') . '" name="dismiss" />';
@@ -100,8 +116,8 @@ function core_upgrade_preamble() {
        $updates = get_core_updates();
 ?>
        <div class="wrap">
-       <?php screen_icon(); ?>
-       <h2><?php _e('Upgrade WordPress'); ?></h2>
+       <?php screen_icon('tools'); ?>
+       <h2><?php _e('WordPress Updates'); ?></h2>
 <?php
        if ( $upgrade_error ) {
                echo '<div class="error"><p>';
@@ -111,15 +127,15 @@ function core_upgrade_preamble() {
 
        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');
+               _e('You have the latest version of WordPress.');
                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 '<div class="updated"><p>';
+               _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">backup your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
                echo '</p></div>';
 
                echo '<h3 class="response">';
-               _e( 'There is a new version of WordPress available for upgrade' );
+               _e( 'An updated version of WordPress is available.' );
                echo '</h3>';
        }
 
@@ -133,10 +149,11 @@ function core_upgrade_preamble() {
                echo '</li>';
        }
        echo '</ul>';
+       echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
        dismissed_updates();
 
        list_plugin_updates();
-       //list_theme_updates();
+       list_theme_updates();
        do_action('core_upgrade_preamble');
        echo '</div>';
 }
@@ -148,8 +165,11 @@ function list_plugin_updates() {
 
        require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
        $plugins = get_plugin_updates();
-       if ( empty($plugins) )
+       if ( empty( $plugins ) ) {
+               echo '<h3>' . __( 'Plugins' ) . '</h3>';
+               echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
                return;
+       }
        $form_action = 'update-core.php?action=do-plugin-upgrade';
 
        $core_updates = get_core_updates();
@@ -158,23 +178,23 @@ function list_plugin_updates() {
        else
                $core_update_version = $core_updates[0]->current;
        ?>
-<h3><?php _e('Plugins'); ?></h3>
-<p><?php _e('The following plugins have new versions available.  Check the ones you want to upgrade and then click "Upgrade Plugins".'); ?></p>
+<h3><?php _e( 'Plugins' ); ?></h3>
+<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
 <form method="post" action="<?php echo $form_action; ?>" name="upgrade-plugins" class="upgrade">
 <?php wp_nonce_field('upgrade-core'); ?>
-<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Upgrade Plugins'); ?>" name="upgrade" /></p>
+<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
 <table class="widefat" cellspacing="0" id="update-plugins-table">
        <thead>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
-               <th scope="col" class="manage-column"><?php _e('Select All'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
+               <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
-               <th scope="col" class="manage-column"><?php _e('Select All'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
+               <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th>
        </tr>
        </tfoot>
        <tbody class="plugins">
@@ -208,49 +228,64 @@ function list_plugin_updates() {
                echo "
        <tr class='active'>
                <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
-               <td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You are running version %1$s. Upgrade to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>
+               <td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>
        </tr>";
        }
 ?>
        </tbody>
 </table>
-<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Upgrade Plugins'); ?>" name="upgrade" /></p>
+<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
 </form>
 <?php
 }
 
 function list_theme_updates() {
        $themes = get_theme_updates();
-       if ( empty($themes) )
+       if ( empty( $themes ) ) {
+               echo '<h3>' . __( 'Themes' ) . '</h3>';
+               echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
                return;
+       }
+
+       $form_action = 'update-core.php?action=do-theme-upgrade';
+
 ?>
-<h3><?php _e('Themes'); ?></h3>
+<h3><?php _e( 'Themes' ); ?></h3>
+<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
+<p><?php printf( __('<strong>Please Note:</strong> Any customizations you have made to the Themes files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?></p>
+<form method="post" action="<?php echo $form_action; ?>" name="upgrade-themes" class="upgrade">
+<?php wp_nonce_field('upgrade-core'); ?>
+<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
 <table class="widefat" cellspacing="0" id="update-themes-table">
        <thead>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
-               <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th>
+               <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
-               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
-               <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>
+               <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>
        </tr>
        </tfoot>
        <tbody class="plugins">
 <?php
        foreach ( (array) $themes as $stylesheet => $theme_data) {
+               $screenshot = $theme_data->{'Theme Root URI'} . '/' . $stylesheet . '/' . $theme_data->Screenshot;
+
                echo "
        <tr class='active'>
                <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' /></th>
-               <td class='plugin-title'><strong>{$theme_data->Name}</strong></td>
+               <td class='plugin-title'><img src='$screenshot' width='64' height='64' style='float:left; padding: 5px' /><strong>{$theme_data->Name}</strong>" .  sprintf(__('You have version %1$s installed. Update to %2$s.'), $theme_data->Version, $theme_data->update['new_version']) . "</td>
        </tr>";
        }
 ?>
        </tbody>
 </table>
+<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
+</form>
 <?php
 }
 
@@ -286,7 +321,7 @@ function do_core_upgrade( $reinstall = false ) {
 ?>
        <div class="wrap">
        <?php screen_icon(); ?>
-       <h2><?php _e('Upgrade WordPress'); ?></h2>
+       <h2><?php _e('Update WordPress'); ?></h2>
 <?php
        if ( $wp_filesystem->errors->get_error_code() ) {
                foreach ( $wp_filesystem->errors->get_error_messages() as $message )
@@ -305,7 +340,8 @@ function do_core_upgrade( $reinstall = false ) {
                if ('up_to_date' != $result->get_error_code() )
                        show_message( __('Installation Failed') );
        } else {
-               show_message( __('WordPress upgraded successfully') );
+               show_message( __('WordPress updated successfully') );
+               show_message( '<strong>' . __('Actions:') . '</strong> <a href="' . esc_url( admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
        }
        echo '</div>';
 }
@@ -334,24 +370,6 @@ function no_update_actions($actions) {
        return '';
 }
 
-function do_plugin_upgrade() {
-       include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
-
-       if ( isset($_GET['plugins']) ) {
-               $plugins = explode(',', $_GET['plugins']);
-       } elseif ( isset($_POST['checked']) ) {
-               $plugins = (array) $_POST['checked'];
-       } else {
-               // Nothing to do.
-               return;
-       }
-       $url = 'update-core.php?action=do-plugin-upgrade&amp;plugins=' . urlencode(join(',', $plugins));
-       $title = __('Upgrade Plugins');
-       $nonce = 'upgrade-core';
-       $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
-       $upgrader->bulk_upgrade($plugins);
-}
-
 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
 
 $upgrade_error = false;
@@ -360,32 +378,87 @@ if ( 'do-plugin-upgrade' == $action && !isset($_GET['plugins']) && !isset($_POST
        $action = 'upgrade-core';
 }
 
-$title = __('Upgrade WordPress');
+$title = __('WordPress Updates');
 $parent_file = 'tools.php';
 
+add_contextual_help($current_screen,
+       '<p>' . __('This screen lets you update to the latest version of WordPress as well as update your themes and plugins from the WordPress.org repository. When updates are available, the number of available updates will appear in a bubble on the left hand menu as a notification. It is very important to keep your WordPress installation up to date for security reasons, so when you see a number appear, make sure you take the time to update, which is an easy process.') . '</p>' .
+       '<p>' . __('Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available.') . '</p>' .
+       '<p>' . __('To upgrade themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_Updates_SubPanel" target="_blank">Documentation on Updating WordPress</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 if ( 'upgrade-core' == $action ) {
        wp_version_check();
-       require_once('admin-header.php');
+       require_once('./admin-header.php');
        core_upgrade_preamble();
 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
        check_admin_referer('upgrade-core');
+
        // 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');
+               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);
+
 } elseif ( 'do-plugin-upgrade' == $action ) {
        check_admin_referer('upgrade-core');
-       require_once('admin-header.php');
-       do_plugin_upgrade();
+
+       if ( isset( $_GET['plugins'] ) ) {
+               $plugins = explode( ',', $_GET['plugins'] );
+       } elseif ( isset( $_POST['checked'] ) ) {
+               $plugins = (array) $_POST['checked'];
+       } else {
+               wp_redirect('update-core.php');
+               exit;
+       }
+
+       $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
+       $url = wp_nonce_url($url, 'bulk-update-plugins');
+
+       $title = __('Update Plugins');
+
+       require_once('./admin-header.php');
+       echo '<div class="wrap">';
+       screen_icon('plugins');
+       echo '<h2>' . esc_html__('Update Plugins') . '</h2>';
+       echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>";
+       echo '</div>';
+} elseif ( 'do-theme-upgrade' == $action ) {
+       check_admin_referer('upgrade-core');
+
+       if ( isset( $_GET['themes'] ) ) {
+               $themes = explode( ',', $_GET['themes'] );
+       } elseif ( isset( $_POST['checked'] ) ) {
+               $themes = (array) $_POST['checked'];
+       } else {
+               wp_redirect('update-core.php');
+               exit;
+       }
+
+       $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
+       $url = wp_nonce_url($url, 'bulk-update-themes');
+
+       $title = __('Update Themes');
+
+       require_once('./admin-header.php');
+       echo '<div class="wrap">';
+       screen_icon('themes');
+       echo '<h2>' . esc_html__('Update Themes') . '</h2>';
+       echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>";
+       echo '</div>';
 }
 
-include('admin-footer.php');
+include('./admin-footer.php');
diff --git a/wp-admin/update-links.php b/wp-admin/update-links.php
deleted file mode 100644 (file)
index f7f5c52..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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');
-
-if ( !get_option('use_linksupdate') )
-       wp_die(__('Feature disabled.'));
-
-$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
-
-if ( !$link_uris )
-       wp_die(__('No links'));
-
-$link_uris = urlencode( join( $link_uris, "\n" ) );
-
-$query_string = "uris=$link_uris";
-
-$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->update( $wpdb->links, array('link_updated' => $time), array('link_url' => $uri) );
-}
-
-?>
index 304c81f8b9c26824fe16f737154f65cdc493ed79..0664ac8f368ba07d787c98f6afdc6e1e87f34984 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
 
@@ -16,16 +16,43 @@ if ( isset($_GET['action']) ) {
        $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
        $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 
-       if ( 'upgrade-plugin' == $action ) {
+       if ( 'update-selected' == $action ) {
+               if ( ! current_user_can( 'update_plugins' ) )
+                       wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
+
+               check_admin_referer( 'bulk-update-plugins' );
+
+               if ( isset( $_GET['plugins'] ) )
+                       $plugins = explode( ',', stripslashes($_GET['plugins']) );
+               elseif ( isset( $_POST['checked'] ) )
+                       $plugins = (array) $_POST['checked'];
+               else
+                       $plugins = array();
+
+               $plugins = array_map('urldecode', $plugins);
+
+               $url = 'update.php?action=update-selected&amp;plugins=' . urlencode(implode(',', $plugins));
+               $nonce = 'bulk-update-plugins';
+
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+               wp_enqueue_script('jquery');
+               iframe_header();
+
+               $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
+               $upgrader->bulk_upgrade( $plugins );
+
+               iframe_footer();
+
+       } elseif ( 'upgrade-plugin' == $action ) {
                if ( ! current_user_can('update_plugins') )
-                       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
 
                check_admin_referer('upgrade-plugin_' . $plugin);
 
                $title = __('Upgrade Plugin');
                $parent_file = 'plugins.php';
                $submenu_file = 'plugins.php';
-               require_once('admin-header.php');
+               require_once('./admin-header.php');
 
                $nonce = 'upgrade-plugin_' . $plugin;
                $url = 'update.php?action=upgrade-plugin&plugin=' . $plugin;
@@ -33,30 +60,30 @@ if ( isset($_GET['action']) ) {
                $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
                $upgrader->upgrade($plugin);
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
 
        } elseif ('activate-plugin' == $action ) {
                if ( ! current_user_can('update_plugins') )
-                       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
 
                check_admin_referer('activate-plugin_' . $plugin);
-               if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
+               if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
                        wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
-                       activate_plugin($plugin);
+                       activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ) );
                        wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
                        die();
                }
                iframe_header( __('Plugin Reactivation'), true );
-               if( isset($_GET['success']) )
+               if ( isset($_GET['success']) )
                        echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
 
-               if( isset($_GET['failure']) ){
+               if ( isset($_GET['failure']) ){
                        echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
 
                        if ( defined('E_RECOVERABLE_ERROR') )
-                               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
+                               error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
                        else
-                               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
+                               error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
 
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
                        include(WP_PLUGIN_DIR . '/' . $plugin);
@@ -65,7 +92,7 @@ if ( isset($_GET['action']) ) {
        } elseif ( 'install-plugin' == $action ) {
 
                if ( ! current_user_can('install_plugins') )
-                       wp_die(__('You do not have sufficient permissions to install plugins for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to install plugins for this site.'));
 
                include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api..
 
@@ -78,22 +105,25 @@ if ( isset($_GET['action']) ) {
                $title = __('Plugin Install');
                $parent_file = 'plugins.php';
                $submenu_file = 'plugin-install.php';
-               require_once('admin-header.php');
+               require_once('./admin-header.php');
 
                $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
                $nonce = 'install-plugin_' . $plugin;
                $url = 'update.php?action=install-plugin&plugin=' . $plugin;
+               if ( isset($_GET['from']) )
+                       $url .= '&from=' . urlencode(stripslashes($_GET['from']));
+
                $type = 'web'; //Install plugin type, From Web or an Upload.
 
                $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
                $upgrader->install($api->download_link);
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
 
        } elseif ( 'upload-plugin' == $action ) {
 
                if ( ! current_user_can('install_plugins') )
-                       wp_die(__('You do not have sufficient permissions to install plugins for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to install plugins for this site.'));
 
                check_admin_referer('plugin-upload');
 
@@ -102,7 +132,7 @@ if ( isset($_GET['action']) ) {
                $title = __('Upload Plugin');
                $parent_file = 'plugins.php';
                $submenu_file = 'plugin-install.php';
-               require_once('admin-header.php');
+               require_once('./admin-header.php');
 
                $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
                $nonce = 'plugin-upload';
@@ -112,12 +142,12 @@ if ( isset($_GET['action']) ) {
                $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
                $upgrader->install( $file_upload->package );
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
 
        } elseif ( 'upgrade-theme' == $action ) {
 
                if ( ! current_user_can('update_themes') )
-                       wp_die(__('You do not have sufficient permissions to update themes for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to update themes for this site.'));
 
                check_admin_referer('upgrade-theme_' . $theme);
 
@@ -126,7 +156,7 @@ if ( isset($_GET['action']) ) {
                $title = __('Upgrade Theme');
                $parent_file = 'themes.php';
                $submenu_file = 'themes.php';
-               require_once('admin-header.php');
+               require_once('./admin-header.php');
 
                $nonce = 'upgrade-theme_' . $theme;
                $url = 'update.php?action=upgrade-theme&theme=' . $theme;
@@ -134,12 +164,37 @@ if ( isset($_GET['action']) ) {
                $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
                $upgrader->upgrade($theme);
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
+       } elseif ( 'update-selected-themes' == $action ) {
+               if ( ! current_user_can( 'update_themes' ) )
+                       wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
 
+               check_admin_referer( 'bulk-update-themes' );
+
+               if ( isset( $_GET['themes'] ) )
+                       $themes = explode( ',', stripslashes($_GET['themes']) );
+               elseif ( isset( $_POST['checked'] ) )
+                       $themes = (array) $_POST['checked'];
+               else
+                       $themes = array();
+
+               $themes = array_map('urldecode', $themes);
+
+               $url = 'update.php?action=update-selected-themes&amp;themes=' . urlencode(implode(',', $themes));
+               $nonce = 'bulk-update-themes';
+
+               require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+               wp_enqueue_script('jquery');
+               iframe_header();
+
+               $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
+               $upgrader->bulk_upgrade( $themes );
+
+               iframe_footer();
        } elseif ( 'install-theme' == $action ) {
 
                if ( ! current_user_can('install_themes') )
-                       wp_die(__('You do not have sufficient permissions to install themes for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to install themes for this site.'));
 
                include_once ABSPATH . 'wp-admin/includes/theme-install.php'; //for themes_api..
 
@@ -153,10 +208,10 @@ if ( isset($_GET['action']) ) {
                wp_enqueue_script('theme-preview');
                $title = __('Install Themes');
                $parent_file = 'themes.php';
-               $submenu_file = 'theme-install.php';
-               require_once('admin-header.php');
+               $submenu_file = 'themes.php';
+               require_once('./admin-header.php');
 
-               $title = sprintf( __('Installing theme: %s'), $api->name . ' ' . $api->version );
+               $title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
                $nonce = 'install-theme_' . $theme;
                $url = 'update.php?action=install-theme&theme=' . $theme;
                $type = 'web'; //Install theme type, From Web or an Upload.
@@ -164,12 +219,12 @@ if ( isset($_GET['action']) ) {
                $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
                $upgrader->install($api->download_link);
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
 
        } elseif ( 'upload-theme' == $action ) {
 
                if ( ! current_user_can('install_themes') )
-                       wp_die(__('You do not have sufficient permissions to install themes for this blog.'));
+                       wp_die(__('You do not have sufficient permissions to install themes for this site.'));
 
                check_admin_referer('theme-upload');
 
@@ -180,7 +235,7 @@ if ( isset($_GET['action']) ) {
                $submenu_file = 'theme-install.php';
                add_thickbox();
                wp_enqueue_script('theme-preview');
-               require_once('admin-header.php');
+               require_once('./admin-header.php');
 
                $title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
                $nonce = 'theme-upload';
@@ -190,9 +245,9 @@ if ( isset($_GET['action']) ) {
                $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
                $upgrader->install( $file_upload->package );
 
-               include('admin-footer.php');
+               include('./admin-footer.php');
 
        } else {
                do_action('update-custom_' . $action);
        }
-}
\ No newline at end of file
+}
index 2cb91a23f1472e16691aa2686b48ebf12f4c7f99..d026479971c8197f14d99b34b13f751081bebcc0 100644 (file)
@@ -20,7 +20,7 @@ require( '../wp-load.php' );
 timer_start();
 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 
-delete_transient('update_core');
+delete_site_transient('update_core');
 
 if ( isset( $_GET['step'] ) )
        $step = $_GET['step'];
@@ -47,7 +47,10 @@ $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>='
 <head>
        <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
        <title><?php _e( 'WordPress &rsaquo; Upgrade' ); ?></title>
-       <?php wp_admin_css( 'install', true ); ?>
+       <?php
+       wp_admin_css( 'install', true );
+       wp_admin_css( 'ie', true );
+       ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
@@ -60,11 +63,11 @@ $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>='
 
 <?php elseif ( !$php_compat || !$mysql_compat ) :
        if ( !$mysql_compat && !$php_compat )
-               printf( __('You cannot upgrade because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
+               printf( __('You cannot upgrade because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
        elseif ( !$php_compat )
-               printf( __('You cannot upgrade because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
+               printf( __('You cannot upgrade because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
        elseif ( !$mysql_compat )
-               printf( __('You cannot upgrade because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
+               printf( __('You cannot upgrade because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
 ?>
 <?php else :
 switch ( $step ) :
@@ -82,9 +85,8 @@ switch ( $step ) :
        case 1:
                wp_upgrade();
 
-                       $backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
-                       $backto = stripslashes( urldecode( $backto ) );
-                       $backto = esc_url_raw( $backto  );
+                       $backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) :  __get_option( 'home' ) . '/';
+                       $backto = esc_url_raw( $backto );
                        $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
 ?>
 <h2><?php _e( 'Upgrade Complete' ); ?></h2>
index 8ddb013fa589daaa3e3b5faf15d513f561ad4408..355d4632101a43574e1f222e7793a014508400b0 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 wp_enqueue_script( 'wp-ajax-response' );
 wp_enqueue_script( 'jquery-ui-draggable' );
 
@@ -20,14 +20,8 @@ if ( isset($_GET['find_detached']) ) {
        if ( !current_user_can('edit_posts') )
                wp_die( __('You are not allowed to scan for lost attachments.') );
 
-       $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 = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent > '0' and post_parent NOT IN ( SELECT ID FROM $wpdb->posts WHERE post_type NOT IN ('attachment', '" . join("', '", get_post_types( array( 'public' => false ) ) ) . "') )");
 
-       $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']) ) {
@@ -48,6 +42,7 @@ if ( isset($_GET['find_detached']) ) {
                        continue;
 
                $attach[] = $att_id;
+               clean_attachment_cache($att_id);
        }
 
        if ( ! empty($attach) ) {
@@ -95,7 +90,7 @@ if ( isset($_GET['find_detached']) ) {
                                if ( !wp_trash_post($post_id) )
                                        wp_die( __('Error in moving to trash...') );
                        }
-                       $location = add_query_arg( array( 'message' => 4, 'ids' => join(',', $post_ids) ), $location );
+                       $location = add_query_arg( array( 'trashed' => count($post_ids), 'ids' => join(',', $post_ids) ), $location );
                        break;
                case 'untrash':
                        foreach( (array) $post_ids as $post_id ) {
@@ -105,7 +100,7 @@ if ( isset($_GET['find_detached']) ) {
                                if ( !wp_untrash_post($post_id) )
                                        wp_die( __('Error in restoring from trash...') );
                        }
-                       $location = add_query_arg('message', 5, $location);
+                       $location = add_query_arg('untrashed', count($post_ids), $location);
                        break;
                case 'delete':
                        foreach( (array) $post_ids as $post_id_del ) {
@@ -115,13 +110,13 @@ if ( isset($_GET['find_detached']) ) {
                                if ( !wp_delete_attachment($post_id_del) )
                                        wp_die( __('Error in deleting...') );
                        }
-                       $location = add_query_arg('message', 2, $location);
+                       $location = add_query_arg('deleted', count($post_ids), $location);
                        break;
        }
 
        wp_redirect($location);
        exit;
-} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+} elseif ( ! empty($_GET['_wp_http_referer']) ) {
         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
@@ -134,7 +129,7 @@ if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
 
 if ( isset($_GET['detached']) ) {
 
-       $media_per_page = (int) get_user_option( 'upload_per_page', 0, false );
+       $media_per_page = (int) get_user_option( 'upload_per_page' );
        if ( empty($media_per_page) || $media_per_page < 1 )
                $media_per_page = 20;
        $media_per_page = apply_filters( 'upload_per_page', $media_per_page );
@@ -148,7 +143,10 @@ if ( isset($_GET['detached']) ) {
        } else {
                $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;
                $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 LIMIT %d, %d", $start, $media_per_page ) );
-               $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / $media_per_page);
+               $total_orphans = $wpdb->get_var( "SELECT FOUND_ROWS()" );
+               $page_links_total = ceil( $total_orphans / $media_per_page );
+               $wp_query->found_posts = $total_orphans;
+               $wp_query->query_vars['posts_per_page'] = $media_per_page;
        }
 
        $post_mime_types = get_post_mime_types();
@@ -164,43 +162,53 @@ if ( isset($_GET['detached']) ) {
 $is_trash = ( isset($_GET['status']) && $_GET['status'] == 'trash' );
 
 wp_enqueue_script('media');
-require_once('admin-header.php');
 
-do_action('restrict_manage_posts');
+add_contextual_help( $current_screen,
+       '<p>' . __('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the <em>Screen Options</em> tab to customize the display of this screen.') . '</p>' .
+       '<p>' . __('You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.') . '</p>' .
+       '<p>' . __('Hovering over a row reveals action links: <em>Edit</em>, <em>Delete Permanently</em>, and <em>View</em>. Clicking <em>Edit</em> or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking <em>Delete Permanently</em> will delete the file from the media library (as well as from any posts to which it is currently attached). <em>View</em> will take you to the display page for that file.') . '</p>' .
+       '<p>' . __('If a media file has not been attached to any post, you will see that in the <em>Attached To</em> column, and can click on <em>Attach File</em> to launch a small popup that will allow you to search for a post and attach the file.') . '</p>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Media_Library_SubPanel" target="_blank">Media Library Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once('./admin-header.php');
 ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
 </h2>
 
 <?php
 $message = '';
 if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
-       $_GET['message'] = '1';
+       $message = __('Media attachment updated.');
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
 }
 
 if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
        $attached = (int) $_GET['attached'];
-       $message = sprintf( _n('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached );
+       $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       $_GET['message'] = '2';
+       $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
 }
 
 if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
-       $_GET['message'] = '4';
+       $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
+       $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
 }
 
 if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
-       $_GET['message'] = '5';
+       $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
 }
 
@@ -216,7 +224,7 @@ if ( isset($_GET['message']) && (int) $_GET['message'] ) {
 }
 
 if ( !empty($message) ) { ?>
-<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
+<div id="message" class="updated"><p><?php echo $message; ?></p></div>
 <?php } ?>
 
 <ul class="subsubsub">
@@ -224,6 +232,8 @@ if ( !empty($message) ) { ?>
 $type_links = array();
 $_num_posts = (array) wp_count_attachments();
 $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
+if ( !isset( $total_orphans ) )
+               $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
 foreach ( $matches as $type => $reals )
        foreach ( $reals as $real )
@@ -239,11 +249,12 @@ foreach ( $post_mime_types as $mime_type => $label ) {
 
        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
                $class = ' class="current"';
-
-       $type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
+       if ( !empty( $num_posts[$mime_type] ) )
+               $type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
 }
-$type_links[] = '<li><a href="upload.php?detached=1"' . ( isset($_GET['detached']) ? ' class="current"' : '' ) . '>' . __('Unattached') . '</a>';
-if ( EMPTY_TRASH_DAYS && ( MEDIA_TRASH || !empty($_num_posts['trash']) ) )
+$type_links[] = '<li><a href="upload.php?detached=1"' . ( isset($_GET['detached']) ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>';
+
+if ( !empty($_num_posts['trash']) )
        $type_links[] = '<li><a href="upload.php?status=trash"' . ( (isset($_GET['status']) && $_GET['status'] == 'trash' ) ? ' class="current"' : '') . '>' . sprintf( _nx( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</a>';
 
 echo implode( " |</li>\n", $type_links) . '</li>';
@@ -260,6 +271,8 @@ unset($type_links);
 </form>
 
 <form id="posts-filter" action="" method="get">
+<?php wp_nonce_field('bulk-media'); ?>
+<?php if ( have_posts() || isset( $orphans ) ) { ?>
 <div class="tablenav">
 <?php
 if ( ! isset($page_links_total) )
@@ -284,6 +297,7 @@ if ( $page_links ) : ?>
 <?php endif; ?>
 
 <div class="alignleft actions">
+<?php if ( ! isset( $orphans ) || ! empty( $orphans ) ) { ?>
 <select name="action" class="select-action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <?php if ( $is_trash ) { ?>
@@ -297,7 +311,6 @@ if ( $page_links ) : ?>
 <?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-<?php wp_nonce_field('bulk-media'); ?>
 
 <?php
 if ( !is_singular() && !isset($_GET['detached']) && !$is_trash ) {
@@ -329,11 +342,17 @@ foreach ($arc_result as $arc_row) {
 </select>
 <?php endif; // month_count ?>
 
+<?php do_action('restrict_manage_posts'); ?>
+
 <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 
 <?php } // ! is_singular ?>
 
-<?php if ( isset($_GET['detached']) ) { ?>
+<?php
+
+} // ! empty( $orphans )
+
+if ( isset($_GET['detached']) ) { ?>
        <input type="submit" id="find_detached" name="find_detached" value="<?php esc_attr_e('Scan for lost attachments'); ?>" class="button-secondary" />
 <?php } elseif ( isset($_GET['status']) && $_GET['status'] == 'trash' && current_user_can('edit_others_posts') ) { ?>
        <input type="submit" id="delete_all" name="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
@@ -344,17 +363,19 @@ foreach ($arc_result as $arc_row) {
 <br class="clear" />
 </div>
 
+<?php } // have_posts() || !empty( $orphans ) ?>
+
 <div class="clear"></div>
 
-<?php if ( isset($orphans) ) { ?>
+<?php if ( ! empty( $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 /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
-       <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
-       <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
 </tr>
 </thead>
 
@@ -362,15 +383,14 @@ foreach ($arc_result as $arc_row) {
 <tr>
        <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th scope="col"></th>
-       <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
-       <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
-       <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
 </tr>
 </tfoot>
 
 <tbody id="the-list" class="list:post">
 <?php
-       if ( $orphans ) {
                foreach ( $orphans as $post ) {
                        $class = 'alternate' == $class ? '' : 'alternate';
                        $att_title = esc_html( _draft_or_post_title($post->ID) );
@@ -384,7 +404,12 @@ foreach ($arc_result as $arc_row) {
 <?php  } ?></td>
 
                <td class="media column-media"><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
-               <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
+               <?php
+               if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) )
+                       echo esc_html( strtoupper( $matches[1] ) );
+               else
+                       echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
+               ?>
 
                <div class="row-actions">
                <?php
@@ -393,10 +418,10 @@ foreach ($arc_result as $arc_row) {
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) )
                        if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
-                               $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
+                               $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-attachment_' . $post->ID) . "'>" . __('Trash') . "</a>";
                        } else {
                                $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
-                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
+                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-attachment_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                        }
                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                if ( current_user_can('edit_post', $post->ID) )
@@ -428,18 +453,14 @@ foreach ($arc_result as $arc_row) {
                } ?>
                <td class="date column-date"><?php echo $h_time ?></td>
        </tr>
-<?php  }
-
-       } else { ?>
-       <tr><td colspan="5"><?php _e('No media attachments found.') ?></td></tr>
-<?php } ?>
+<?php  } ?>
 </tbody>
 </table>
 
 <?php
 
 } else {
-       include( 'edit-attachment-rows.php' );
+       include( './edit-attachment-rows.php' );
 } ?>
 
 <div id="ajax-response"></div>
@@ -447,6 +468,8 @@ foreach ($arc_result as $arc_row) {
 <div class="tablenav">
 
 <?php
+if ( have_posts() || ! empty( $orphans ) ) {
+
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links_text</div>";
 ?>
@@ -471,6 +494,7 @@ if ( $page_links )
 <?php } ?>
 </div>
 
+<?php } ?>
 <br class="clear" />
 </div>
 <?php find_posts_div(); ?>
@@ -480,4 +504,4 @@ if ( $page_links )
 </div>
 
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
index b3ecb63adacf13bca70db928e5e361bf410eaf95..414dfb3f83adb31a90e39671dcfa2d66417d3d08 100644 (file)
@@ -7,10 +7,21 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
-if ( !defined('IS_PROFILE_PAGE') )
-       define('IS_PROFILE_PAGE', false);
+wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
+
+$user_id = (int) $user_id;
+$current_user = wp_get_current_user();
+if ( ! defined( 'IS_PROFILE_PAGE' ) )
+       define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
+
+if ( ! $user_id && IS_PROFILE_PAGE )
+       $user_id = $current_user->ID;
+elseif ( ! $user_id && ! IS_PROFILE_PAGE )
+       wp_die(__( 'Invalid user ID.' ) );
+elseif ( ! get_userdata( $user_id ) )
+       wp_die( __('Invalid user ID.') );
 
 wp_enqueue_script('user-profile');
 wp_enqueue_script('password-strength-meter');
@@ -22,22 +33,20 @@ else
        $submenu_file = 'profile.php';
 $parent_file = 'users.php';
 
-wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
+// contextual help - choose Help on the top right of admin panel to preview this.
+add_contextual_help($current_screen,
+    '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
+    '<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things.') . '</p>' .
+    '<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '</p>' .
+    '<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' .
+    '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>' .
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_SubPanel" target="_blank">Documentation on User Profiles</a>') . '</p>' .
+    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
 
-$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
 
-$user_id = (int) $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.'));
-       }
-} elseif ( !get_userdata($user_id) ) {
-       wp_die( __('Invalid user ID.') );
-}
+$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
 
 $all_post_caps = array('posts', 'pages');
 $user_can_edit = false;
@@ -60,6 +69,30 @@ function use_ssl_preference($user) {
 <?php
 }
 
+
+// Only allow super admins on multisite to edit every user.
+if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
+       wp_die( __( 'You do not have permission to edit this user.' ) );
+
+// Execute confirmed email change. See send_confirmation_on_profile_email().
+if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
+       $new_email = get_option( $current_user->ID . '_new_email' );
+       if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
+               $user->ID = $current_user->ID;
+               $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
+               if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
+                       $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
+               wp_update_user( get_object_vars( $user ) );
+               delete_option( $current_user->ID . '_new_email' );
+               wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );
+               die();
+       }
+} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
+       delete_option( $current_user->ID . '_new_email' );
+       wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );
+       die();
+}
+
 switch ($action) {
 case 'switchposts':
 
@@ -81,7 +114,33 @@ if ( IS_PROFILE_PAGE )
 else
        do_action('edit_user_profile_update', $user_id);
 
-$errors = edit_user($user_id);
+if ( !is_multisite() ) {
+       $errors = edit_user($user_id);
+} else {
+       $user = get_userdata( $user_id );
+
+       // Update the email address in signups, if present.
+       if ( $user->user_login && isset( $_POST[ 'email' ] ) && is_email( $_POST[ 'email' ] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) )
+               $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
+
+       // WPMU must delete the user from the current blog if WP added him after editing.
+       $delete_role = false;
+       $blog_prefix = $wpdb->get_blog_prefix();
+       if ( $user_id != $current_user->ID ) {
+               $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
+               if ( null == $cap && $_POST[ 'role' ] == '' ) {
+                       $_POST[ 'role' ] = 'contributor';
+                       $delete_role = true;
+               }
+       }
+       if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) )
+               $errors = edit_user($user_id);
+       if ( $delete_role ) // stops users being added to current blog when they are edited
+               delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
+
+       if ( is_multisite() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) )
+               empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
+}
 
 if ( !is_wp_error( $errors ) ) {
        $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
@@ -99,8 +158,11 @@ if ( !current_user_can('edit_user', $user_id) )
 include ('admin-header.php');
 ?>
 
+<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
+       <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
+<?php } ?>
 <?php if ( isset($_GET['updated']) ) : ?>
-<div id="message" class="updated fade">
+<div id="message" class="updated">
        <p><strong><?php _e('User updated.') ?></strong></p>
        <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
        <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
@@ -108,21 +170,14 @@ include ('admin-header.php');
 </div>
 <?php endif; ?>
 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
-<div class="error">
-       <ul>
-       <?php
-       foreach( $errors->get_error_messages() as $message )
-               echo "<li>$message</li>";
-       ?>
-       </ul>
-</div>
+<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
 <?php endif; ?>
 
 <div class="wrap" id="profile-page">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
 
-<form id="your-profile" action="<?php if ( IS_PROFILE_PAGE ) { echo admin_url('profile.php'); } else { echo admin_url('user-edit.php'); } ?>" method="post">
+<form id="your-profile" action="<?php echo esc_url( admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>>
 <?php wp_nonce_field('update-user_' . $user_id) ?>
 <?php if ( $wp_http_referer ) : ?>
        <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
@@ -141,37 +196,20 @@ include ('admin-header.php');
                <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; ?>
-<?php if (count($_wp_admin_css_colors) > 1 ) : ?>
+<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
 <tr>
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
-<td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
-<?php
-$current_color = get_user_option('admin_color', $user_id);
-if ( empty($current_color) )
-       $current_color = 'fresh';
-foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
-<div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo esc_attr($color) ?>" class="tog" <?php checked($color, $current_color); ?> />
-       <table class="color-palette">
-       <tr>
-       <?php foreach ( $color_info->colors as $html_color ): ?>
-       <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>
-       <?php endforeach; ?>
-</fieldset></td>
+<td><?php do_action( 'admin_color_scheme_picker' ); ?></td>
 </tr>
-<?php if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
+<?php
+endif; // $_wp_admin_css_colors
+if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
 <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.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
 </tr>
 <?php
 endif;
-endif;
 do_action('personal_options', $profileuser);
 ?>
 </table>
@@ -185,7 +223,7 @@ do_action('personal_options', $profileuser);
 <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 esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Your username cannot be changed.'); ?></span></td>
+               <td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Usernames cannot be changed.'); ?></span></td>
        </tr>
 
 <?php if ( !IS_PROFILE_PAGE ): ?>
@@ -202,20 +240,24 @@ wp_dropdown_roles($user_role);
 
 // print the 'no role' option. Make it selected if the user has no role yet.
 if ( $user_role )
-       echo '<option value="">' . __('&mdash; No role for this blog &mdash;') . '</option>';
+       echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
 else
-       echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
+       echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
 ?>
-</select></td></tr>
+</select>
+<?php if ( is_multisite() && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
+<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.'); ?></label></p>
+<?php } ?>
+</td></tr>
 <?php endif; //!IS_PROFILE_PAGE ?>
 
 <tr>
-       <th><label for="first_name"><?php _e('First name') ?></label></th>
+       <th><label for="first_name"><?php _e('First Name') ?></label></th>
        <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
-       <th><label for="last_name"><?php _e('Last name') ?></label></th>
+       <th><label for="last_name"><?php _e('Last Name') ?></label></th>
        <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
 </tr>
 
@@ -230,8 +272,8 @@ else
                <select name="display_name" id="display_name">
                <?php
                        $public_display = array();
-                       $public_display['display_nickname']  = $profileuser->nickname;
                        $public_display['display_username']  = $profileuser->user_login;
+                       $public_display['display_nickname']  = $profileuser->nickname;
                        if ( !empty($profileuser->first_name) )
                                $public_display['display_firstname'] = $profileuser->first_name;
                        if ( !empty($profileuser->last_name) )
@@ -240,9 +282,10 @@ else
                                $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
                                $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
                        }
-                       if ( !in_array( $profileuser->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere
+                       if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
                                $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
                        $public_display = array_map( 'trim', $public_display );
+                       $public_display = array_unique( $public_display );
                        foreach ( $public_display as $id => $item ) {
                ?>
                        <option id="<?php echo $id; ?>" value="<?php echo esc_attr($item); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
@@ -259,7 +302,15 @@ else
 <table class="form-table">
 <tr>
        <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
-       <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" /></td>
+       <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" />
+       <?php
+       $new_email = get_option( $current_user->ID . '_new_email' );
+       if ( $new_email && $new_email != $current_user->user_email ) : ?>
+       <div class="updated inline">
+       <p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
+       </div>
+       <?php endif; ?>
+       </td>
 </tr>
 
 <tr>
@@ -304,11 +355,10 @@ if ( $show_password_fields ) :
 </table>
 
 <?php
-       if ( IS_PROFILE_PAGE ) {
-               do_action('show_user_profile', $profileuser);
-       } else {
-               do_action('edit_user_profile', $profileuser);
-       }
+       if ( IS_PROFILE_PAGE )
+               do_action( 'show_user_profile', $profileuser );
+       else
+               do_action( 'edit_user_profile', $profileuser );
 ?>
 
 <?php if ( count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?>
@@ -341,6 +391,12 @@ if ( $show_password_fields ) :
 <?php
 break;
 }
-
-include('admin-footer.php');
+?>
+<script type="text/javascript" charset="utf-8">
+       if (window.location.hash == '#password') {
+               document.getElementById('pass1').focus();
+       }
+</script>
+<?php
+include('./admin-footer.php');
 ?>
index 9d143253b6b18b3477ce5bf93ea7af16b8a557aa..50d6f1e7efef6b903c87bd3b692898d0421a0498 100644 (file)
  */
 
 /** WordPress Administration Bootstrap */
-require_once('admin.php');
+require_once('./admin.php');
 
 if ( !current_user_can('create_users') )
        wp_die(__('Cheatin&#8217; uh?'));
 
+if ( is_multisite() && !get_site_option( 'add_new_users' ) )
+       wp_die( __('Page disabled by the administrator') );
+
 /** WordPress Registration API */
 require_once( ABSPATH . WPINC . '/registration.php');
 
+if ( is_multisite() ) {
+       function admin_created_user_email( $text ) {
+               return sprintf( __( "Hi,
+You've been invited to join '%s' at
+%s as a %s.
+If you do not want to join this site please ignore
+this email. This invitation will expire in a few days.
+
+Please click the following link to activate your user account:
+%%s" ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );
+       }
+       add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
+
+       function admin_created_user_subject( $text ) {
+               return "[" . get_bloginfo('name') . "] Your site invite";
+       }
+}
+
 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.'));
+       if ( !is_multisite() ) {
+               $user_id = add_user();
 
-       $user_id = add_user();
-
-       if ( is_wp_error( $user_id ) ) {
-               $add_user_errors = $user_id;
+               if ( is_wp_error( $user_id ) ) {
+                       $add_user_errors = $user_id;
+               } else {
+                       if ( current_user_can('edit_users') ) {
+                               $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' . '#user-' . $user_id;
+                       } else {
+                               $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
+                       }
+                       wp_redirect( $redirect );
+                       die();
+               }
        } 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();
+               $user_login = preg_replace( "/\s+/", '', sanitize_user( $_REQUEST[ 'user_login' ], true ) );
+               $user_details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_login = %s AND user_email = %s", $user_login, $_REQUEST[ 'email' ] ) );
+               if ( $user_details ) {
+                       // Adding an existing user to this blog
+                       $new_user_email = esc_html(trim($_REQUEST['email']));
+                       $redirect = 'user-new.php';
+                       $username = $user_details->user_login;
+                       $user_id = $user_details->ID;
+                       if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
+                               $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' );
+                       } else {
+                               if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+                                       add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
+                                       $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+                               } else {
+                                       $newuser_key = substr( md5( $user_id ), 0, 5 );
+                                       add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
+                                       $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n");
+                                       wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ),  sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/")));
+                                       $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' );
+                               }
+                       }
+                       wp_redirect( $redirect );
+                       die();
+               } else {
+                       // Adding a new user to this blog
+                       $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] );
+                       unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] );
+                       if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
+                               $add_user_errors = $user_details[ 'errors' ];
+                       } else {
+                               $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
+                               if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+                                       add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
+                               }
+                               wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
+                               if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+                                       $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) );
+                                       wpmu_activate_signup( $key );
+                                       $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+                               } else {
+                                       $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' );
+                               }
+                               wp_redirect( $redirect );
+                               die();
+                       }
+               }
        }
 }
 
 $title = __('Add New User');
 $parent_file = 'users.php';
 
+add_contextual_help($current_screen,
+    '<p>' . __('To add a new user to your site, fill in the form on this screen. If you&#8217;re not sure which role to assign, you can use the link below to review the different roles and their capabilities. Here is a basic overview of roles:') . '</p>' .
+    '<ul>' .
+        '<li>' . __('Administrators have access to all the administration features.') . '</li>' .
+        '<li>' . __('Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.')  . '</li>' .
+        '<li>' . __('Authors can publish and manage their own posts.') . '</li>' .
+        '<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' .
+        '<li>' . __('Subscribers can read comments/comment/receive newsletters, etc.') . '</li>' .
+    '</ul>' .
+    '<p>' . __('You must assign a password to the new user, but don&#8217;t worry; when they log in for the first time they will be prompted to change it. The username, however, cannot be changed.') . '</p>' .
+    '<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you do not the password to be included in the welcome email.') . '</p>' .
+    '<p>' . __('Remember to click the Add User button at the bottom of this screen when you are finished.') . '</p>' .
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Add_New_SubPanel" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
+    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 wp_enqueue_script('wp-ajax-response');
 wp_enqueue_script('user-profile');
 wp_enqueue_script('password-strength-meter');
 
 require_once ('admin-header.php');
 
+if ( isset($_GET['update']) ) {
+       $messages = array();
+       if ( is_multisite() ) {
+               switch ( $_GET['update'] ) {
+                       case "newuserconfimation":
+                               $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.');
+                               break;
+                       case "add":
+                               $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.');
+                               break;
+                       case "addnoconfirmation":
+                               $messages[] = __('User has been added to your site.');
+                               break;
+                       case "addexisting":
+                               $messages[] = __('That user is already a member of this site.');
+                               break;
+               }
+       } else {
+               if ( 'add' == $_GET['update'] )
+                       $messages[] = __('User added.');
+       }
+}
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
@@ -58,9 +169,9 @@ require_once ('admin-header.php');
        </div>
 <?php endif;
 
-if ( ! empty($messages) ) {
+if ( ! empty( $messages ) ) {
        foreach ( $messages as $msg )
-               echo $msg;
+               echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
 } ?>
 
 <?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
@@ -74,12 +185,17 @@ if ( ! empty($messages) ) {
 <div id="ajax-response"></div>
 
 <?php
+if ( !is_multisite() ) {
        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>';
+} else {
+       echo '<p>' . __( 'You can add new users to your site in two ways:' ) . '<ol><li> ' . __( 'Enter the username and email address of an existing user on this site.' ) . '</li><li> ' . __( 'Enter the username and the email address of a person who is not already a member of this site. Choose the username carefully, it cannot be changed.' ) . '</li></ol></p>';
+       echo '<p>' . __( 'That person will be sent an email asking them to click a link confirming the invite. New users will then be sent an email with a randomly generated password and a login link.' ) . '</p>';
+}
 ?>
-<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
+<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
 <?php wp_nonce_field('add-user') ?>
 <?php
 //Load up the passed data, else set to a default.
@@ -97,6 +213,11 @@ $new_user_send_password = !$_POST || isset($_POST['send_password']);
                <input name="action" type="hidden" id="action" value="adduser" /></th>
                <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
        </tr>
+       <tr class="form-field form-required">
+               <th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+               <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
+       </tr>
+<?php if ( !is_multisite() ) { ?>
        <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 esc_attr($new_user_firstname); ?>" /></td>
@@ -105,18 +226,13 @@ $new_user_send_password = !$_POST || isset($_POST['send_password']);
                <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 esc_attr($new_user_lastname); ?>" /></td>
        </tr>
-       <tr class="form-field form-required">
-               <th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
-               <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
-       </tr>
        <tr class="form-field">
                <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
                <td><input name="url" type="text" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td>
        </tr>
-
 <?php if ( apply_filters('show_password_fields', true) ) : ?>
        <tr class="form-field form-required">
-               <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php _e('(twice, required)'); ?></span></label></th>
+               <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(twice, required)'); ?></span></label></th>
                <td><input name="pass1" type="password" id="pass1" autocomplete="off" />
                <br />
                <input name="pass2" type="password" id="pass2" autocomplete="off" />
@@ -130,7 +246,7 @@ $new_user_send_password = !$_POST || isset($_POST['send_password']);
                <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked($new_user_send_password, true); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
        </tr>
 <?php endif; ?>
-
+<?php } // !is_multisite ?>
        <tr class="form-field">
                <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
                <td><select name="role" id="role">
@@ -142,6 +258,12 @@ $new_user_send_password = !$_POST || isset($_POST['send_password']);
                        </select>
                </td>
        </tr>
+       <?php if ( is_multisite() && is_super_admin() ) { ?>
+       <tr>
+               <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
+               <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" /> <?php _e( 'Site administrators can add a user without sending the confirmation email.' ); ?></label></td>
+       </tr>
+       <?php } ?>
 </table>
 <p class="submit">
        <input name="adduser" type="submit" id="addusersub" class="button-primary" value="<?php esc_attr_e('Add User') ?>" />
@@ -150,5 +272,5 @@ $new_user_send_password = !$_POST || isset($_POST['send_password']);
 
 </div>
 <?php
-include('admin-footer.php');
+include('./admin-footer.php');
 ?>
index d11ee53d949ef69a0aa1761aec0972b01c0d5cee..aeaabc3b42eb1e62d09cc2a5deb8f13b6f406747 100644 (file)
@@ -7,17 +7,28 @@
  */
 
 /** 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') )
+if ( !current_user_can('list_users') )
        wp_die(__('Cheatin&#8217; uh?'));
 
 $title = __('Users');
 $parent_file = 'users.php';
 
+// contextual help - choose Help on the top right of admin panel to preview this.
+add_contextual_help($current_screen,
+    '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options when they are logged in, based on their role.') . '</p>' .
+    '<p>' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '</p>' .
+    '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>' .
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Authors_and_Users_SubPanel" target="_blank">Documentation on Authors and Users</a>') . '</p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Roles and Capabilities Descriptions</a>') . '</p>' .
+    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
 $update = $doaction = '';
 if ( isset($_REQUEST['action']) )
        $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];
@@ -43,26 +54,32 @@ switch ($doaction) {
 case 'promote':
        check_admin_referer('bulk-users');
 
-       if (empty($_REQUEST['users'])) {
+       if ( empty($_REQUEST['users']) ) {
                wp_redirect($redirect);
                exit();
        }
 
        $editable_roles = get_editable_roles();
-       if (!$editable_roles[$_REQUEST['new_role']])
+       if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
                wp_die(__('You can&#8217;t give users that role.'));
 
        $userids = $_REQUEST['users'];
        $update = 'promote';
-       foreach($userids as $id) {
-               if ( ! current_user_can('edit_user', $id) )
+       foreach ( $userids as $id ) {
+               $id = (int) $id;
+
+               if ( ! current_user_can('promote_user', $id) )
                        wp_die(__('You can&#8217;t edit that user.'));
-               // The new role of the current user must also have edit_users caps
-               if($id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('edit_users')) {
+               // The new role of the current user must also have promote_users caps
+               if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
                        $update = 'err_admin_role';
                        continue;
                }
 
+               // If the user doesn't already belong to the blog, bail.
+               if ( is_multisite() && !is_user_member_of_blog( $id ) )
+                       wp_die(__('Cheatin&#8217; uh?'));
+
                $user = new WP_User($id);
                $user->set_role($_REQUEST['new_role']);
        }
@@ -73,6 +90,8 @@ case 'promote':
 break;
 
 case 'dodelete':
+       if ( is_multisite() )
+               wp_die( __('User deletion is not allowed from this screen.') );
 
        check_admin_referer('delete-users');
 
@@ -81,7 +100,7 @@ case 'dodelete':
                exit();
        }
 
-       if ( !current_user_can('delete_users') )
+       if ( ! current_user_can( 'delete_users' ) )
                wp_die(__('You can&#8217;t delete users.'));
 
        $userids = $_REQUEST['users'];
@@ -89,19 +108,23 @@ case 'dodelete':
        $delete_count = 0;
 
        foreach ( (array) $userids as $id) {
-               if ( ! current_user_can('delete_user', $id) )
-                       wp_die(__('You can&#8217;t delete that user.'));
+               $id = (int) $id;
+
+               if ( ! current_user_can( 'delete_user', $id ) )
+                       wp_die(__( 'You can&#8217;t delete that user.' ) );
 
-               if($id == $current_user->ID) {
+               if ( $id == $current_user->ID ) {
                        $update = 'err_admin_del';
                        continue;
                }
-               switch($_REQUEST['delete_option']) {
+               switch ( $_REQUEST['delete_option'] ) {
                case 'delete':
-                       wp_delete_user($id);
+                       if ( current_user_can('delete_user', $id) )
+                               wp_delete_user($id);
                        break;
                case 'reassign':
-                       wp_delete_user($id, $_REQUEST['reassign_user']);
+                       if ( current_user_can('delete_user', $id) )
+                               wp_delete_user($id, $_REQUEST['reassign_user']);
                        break;
                }
                ++$delete_count;
@@ -114,6 +137,8 @@ case 'dodelete':
 break;
 
 case 'delete':
+       if ( is_multisite() )
+               wp_die( __('User deletion is not allowed from this screen.') );
 
        check_admin_referer('bulk-users');
 
@@ -122,8 +147,8 @@ case 'delete':
                exit();
        }
 
-       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.' ) );
 
        if ( empty($_REQUEST['users']) )
                $userids = array(intval($_REQUEST['user']));
@@ -153,7 +178,13 @@ case 'delete':
                        $go_delete = true;
                }
        }
-       $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
+       // @todo Delete is always for !is_multisite(). Use API.
+       if ( !is_multisite() ) {
+               $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
+       } else {
+               // WPMU only searches users of current blog
+               $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities' ORDER BY user_login");
+       }
        $user_dropdown = '<select name="reassign_user">';
        foreach ( (array) $all_logins as $login )
                if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
@@ -180,6 +211,94 @@ case 'delete':
 
 break;
 
+case 'doremove':
+       check_admin_referer('remove-users');
+
+       if ( empty($_REQUEST['users']) ) {
+               wp_redirect($redirect);
+               exit;
+       }
+
+       if ( !current_user_can('remove_users')  )
+               die(__('You can&#8217;t remove users.'));
+
+       $userids = $_REQUEST['users'];
+
+       $update = 'remove';
+       foreach ( $userids as $id ) {
+               $id = (int) $id;
+               if ( $id == $current_user->id && !is_super_admin() ) {
+                       $update = 'err_admin_remove';
+                       continue;
+               }
+               if ( !current_user_can('remove_user', $id) ) {
+                       $update = 'err_admin_remove';
+                       continue;
+               }
+               remove_user_from_blog($id, $blog_id);
+       }
+
+       $redirect = add_query_arg( array('update' => $update), $redirect);
+       wp_redirect($redirect);
+       exit;
+
+break;
+
+case 'remove':
+
+       check_admin_referer('bulk-users');
+
+       if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
+               wp_redirect($redirect);
+               exit();
+       }
+
+       if ( !current_user_can('remove_users') )
+               $error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
+
+       if ( empty($_REQUEST['users']) )
+               $userids = array(intval($_REQUEST['user']));
+       else
+               $userids = $_REQUEST['users'];
+
+       include ('admin-header.php');
+?>
+<form action="" method="post" name="updateusers" id="updateusers">
+<?php wp_nonce_field('remove-users') ?>
+<?php echo $referer; ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php _e('Remove Users from Site'); ?></h2>
+<p><?php _e('You have specified these users for removal:'); ?></p>
+<ul>
+<?php
+       $go_remove = false;
+       foreach ( $userids as $id ) {
+               $id = (int) $id;
+               $user = new WP_User($id);
+               if ( $id == $current_user->id && !is_super_admin() ) {
+                       echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
+               } elseif ( !current_user_can('remove_user', $id) ) {
+                       echo "<li>" . sprintf(__('ID #%1s: %2s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
+               } else {
+                       echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n";
+                       $go_remove = true;
+               }
+       }
+       ?>
+<?php if ( $go_remove ) : ?>
+               <input type="hidden" name="action" value="doremove" />
+               <p class="submit"><input type="submit" name="submit" value="<?php esc_attr_e('Confirm Removal'); ?>" class="button-secondary" /></p>
+<?php else : ?>
+       <p><?php _e('There are no valid users selected for removal.'); ?></p>
+<?php endif; ?>
+</div>
+</form>
+<?php
+
+break;
+
 default:
 
        if ( !empty($_GET['_wp_http_referer']) ) {
@@ -187,36 +306,49 @@ default:
                exit;
        }
 
-       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 user IDs for this page
        $wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
 
+       // Query the post counts for this page
+       $post_counts = count_many_users_posts($wp_user_search->get_results());
+
+       // Query the users for this page
+       cache_users($wp_user_search->get_results());
+
        $messages = array();
        if ( isset($_GET['update']) ) :
                switch($_GET['update']) {
                case 'del':
                case 'del_many':
                        $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
-                       $messages[] = '<div id="message" class="updated fade"><p>' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
+                       $messages[] = '<div id="message" class="updated"><p>' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
                        break;
                case 'add':
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('New user created.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated"><p>' . __('New user created.') . '</p></div>';
                        break;
                case 'promote':
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Changed roles.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated"><p>' . __('Changed roles.') . '</p></div>';
                        break;
                case 'err_admin_role':
                        $messages[] = '<div id="message" class="error"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Other user roles have been changed.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated"><p>' . __('Other user roles have been changed.') . '</p></div>';
                        break;
                case 'err_admin_del':
                        $messages[] = '<div id="message" class="error"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been deleted.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated"><p>' . __('Other users have been deleted.') . '</p></div>';
+                       break;
+               case 'remove':
+                       $messages[] = '<div id="message" class="updated fade"><p>' . __('User removed from this site.') . '</p></div>';
+                       break;
+               case 'err_admin_remove':
+                       $messages[] = '<div id="message" class="error"><p>' . __("You can't remove the current user.") . '</p></div>';
+                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been removed.') . '</p></div>';
                        break;
                }
        endif; ?>
@@ -239,7 +371,7 @@ if ( ! empty($messages) ) {
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?>  <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a> <?php
+<h2><?php echo esc_html( $title ); if ( current_user_can( 'create_users' ) ) { ?>  <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a><?php }
 if ( isset($_GET['usersearch']) && $_GET['usersearch'] )
        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $_GET['usersearch'] ) ); ?>
 </h2>
@@ -248,22 +380,14 @@ if ( isset($_GET['usersearch']) && $_GET['usersearch'] )
 <form id="list-filter" action="" method="get">
 <ul class="subsubsub">
 <?php
-$role_links = array();
-$avail_roles = array();
-$users_of_blog = get_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 ) {
-               if ( !isset($avail_roles[$b_role]) )
-                       $avail_roles[$b_role] = 0;
-               $avail_roles[$b_role]++;
-       }
-}
+$users_of_blog = count_users();
+$total_users = $users_of_blog['total_users'];
+$avail_roles =& $users_of_blog['avail_roles'];
 unset($users_of_blog);
 
 $current_role = false;
 $class = empty($role) ? ' class="current"' : '';
+$role_links = array();
 $role_links[] = "<li><a href='users.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
 foreach ( $wp_roles->get_names() as $this_role => $name ) {
        if ( !isset($avail_roles[$this_role]) )
@@ -306,7 +430,11 @@ unset($role_links);
 <div class="alignleft actions">
 <select name="action">
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ( !is_multisite() && current_user_can('delete_users') ) { ?>
 <option value="delete"><?php _e('Delete'); ?></option>
+<?php } else { ?>
+<option value="remove"><?php _e('Remove'); ?></option>
+<?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <label class="screen-reader-text" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option><?php wp_dropdown_roles(); ?></select>
@@ -356,8 +484,11 @@ foreach ( $wp_user_search->get_results() as $userid ) {
        $roles = $user_object->roles;
        $role = array_shift($roles);
 
+       if ( is_multisite() && empty( $role ) )
+               continue;
+
        $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
-       echo "\n\t" . user_row($user_object, $style, $role);
+       echo "\n\t", user_row( $user_object, $style, $role, $post_counts[ $userid ] );
 }
 ?>
 </tbody>
@@ -372,8 +503,11 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 <div class="alignleft actions">
 <select name="action2">
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ( !is_multisite() && current_user_can('delete_users') ) { ?>
 <option value="delete"><?php _e('Delete'); ?></option>
-</select>
+<?php } else { ?>
+<option value="remove"><?php _e('Remove'); ?></option>
+<?php } ?></select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
@@ -385,11 +519,21 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 </form>
 </div>
 
+<?php
+if ( is_multisite() ) {
+       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]) ? esc_attr(stripslashes($_REQUEST[$formpost])) : '';
+       }
+       unset($name);
+}
+?>
+
 <br class="clear" />
 <?php
 break;
 
 } // end of the $doaction switch
 
-include('admin-footer.php');
+include('./admin-footer.php');
 ?>
index e28f46ae9712529f3c90542b84e8bd3085dd8a90..d3c401b19fbc0978246a7db9ee2183d124319970 100644 (file)
@@ -7,12 +7,12 @@
  */
 
 /** 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') )
+if ( ! current_user_can('edit_theme_options') )
        wp_die( __( 'Cheatin&#8217; uh?' ));
 
 wp_admin_css( 'widgets' );
@@ -33,6 +33,19 @@ do_action( 'sidebar_admin_setup' );
 $title = __( 'Widgets' );
 $parent_file = 'themes.php';
 
+$help = '
+       <p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p>
+       <p>' . __('Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>
+       <p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p>
+       <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
+       <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>
+       <p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>
+';
+$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
+$help .= '<p>' . __('<a href="http://codex.wordpress.org/Appearance_Widgets_SubPanel" target="_blank">Widgets Documentation</a>') . '</p>';
+$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+add_contextual_help($current_screen, $help);
+
 // register the inactive_widgets area as sidebar
 register_sidebar(array(
        'name' => __('Inactive Widgets'),
@@ -120,7 +133,7 @@ retrieve_widgets();
 
 if ( count($wp_registered_sidebars) == 1 ) {
        // If only "wp_inactive_widgets" is defined the theme has no sidebars, die.
-       require_once( 'admin-header.php' );
+       require_once( './admin-header.php' );
 ?>
 
        <div class="wrap">
@@ -133,7 +146,7 @@ if ( count($wp_registered_sidebars) == 1 ) {
        </div>
 
 <?php
-       require_once( 'admin-footer.php' );
+       require_once( './admin-footer.php' );
        exit;
 }
 
@@ -244,7 +257,7 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
        $width = ' style="width:' . max($control['width'], 350) . 'px"';
        $key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
 
-       require_once( 'admin-header.php' ); ?>
+       require_once( './admin-header.php' ); ?>
        <div class="wrap">
        <?php screen_icon(); ?>
        <h2><?php echo esc_html( $title ); ?></h2>
@@ -279,7 +292,7 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
                        }
                        $selected = '';
                        echo "\t\t<select name='{$sbname}_position'>\n";
-                       echo "\t\t<option value=''>" . __('-- select --') . "</option>\n";
+                       echo "\t\t<option value=''>" . __('&mdash; Select &mdash;') . "</option>\n";
                        for ( $i = 1; $i <= $j; $i++ ) {
                                if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
                                        $selected = selected( $i, $key + 1, false );
@@ -309,7 +322,7 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
        </div>
        </div>
 <?php
-       require_once( 'admin-footer.php' );
+       require_once( './admin-footer.php' );
        exit;
 }
 
@@ -322,19 +335,21 @@ $errors = array(
        __('Error in displaying the widget settings form.')
 );
 
-require_once( 'admin-header.php' ); ?>
+require_once( './admin-header.php' ); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <?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"><p><?php echo $messages[$_GET['message']]; ?></p></div>
 <?php } ?>
 <?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
 <?php } ?>
 
+<?php do_action( 'widgets_admin_page' ); ?>
+
 <div class="widget-liquid-left">
 <div id="widgets-left">
        <div id="available-widgets" class="widgets-holder-wrap">
@@ -355,7 +370,7 @@ require_once( 'admin-header.php' ); ?>
                <div class="sidebar-name">
                <div class="sidebar-name-arrow"><br /></div>
                <h3><?php _e('Inactive Widgets'); ?>
-               <span><img src="images/wpspin_light.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
+               <span><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span></h3></div>
                <div class="widget-holder inactive">
                <p class="description"><?php _e('Drag widgets here to remove them from the sidebar but keep their settings.'); ?></p>
                <?php wp_list_widget_controls('wp_inactive_widgets'); ?>
@@ -377,7 +392,7 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
        <div class="sidebar-name">
        <div class="sidebar-name-arrow"><br /></div>
        <h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
-       <span><img src="images/wpspin_dark.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
+       <span><img src="<?php echo esc_url( admin_url( 'images/wpspin_dark.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span></h3></div>
        <?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
        </div>
 <?php
@@ -393,4 +408,4 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
 
 <?php
 do_action( 'sidebar_admin_page' );
-require_once( 'admin-footer.php' );
+require_once( './admin-footer.php' );
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
deleted file mode 100644 (file)
index fe9f54b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-width:1px;border-style:solid;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}p,ul,ol,blockquote,input,select{font-size:12px;}select option{padding:2px;}.plugins .name,#pass-strength-result.strong,#pass-strength-result.short,.button-highlighted,input.button-highlighted,#quicktags #ed_strong,#ed_reply_toolbar #ed_reply_strong{font-weight:bold;}.plugins p{margin:0 4px;padding:0;}.plugins .desc p{margin:0 0 8px;}.plugins td.desc{line-height:1.5em;}.plugins .desc ul,.plugins .desc ol{margin:0 0 0 2em;}.plugins .desc ul{list-style-type:disc;}.plugins .action-links{white-space:nowrap;}.plugins .row-actions-visible{padding:0;}.widefat tbody.plugins th.check-column{padding:7px 0;}.widefat .plugins td,.widefat .plugins th{border-bottom:0 none;}#install-plugins .plugins td,#install-plugins .plugins th{border-bottom-style:solid;border-bottom-width:1px;}.plugins .inactive td,.plugins .inactive th,.plugins .active td,.plugins .active th{border-top-style:solid;border-top-width:1px;padding:5px 7px 0;}#wpbody-content .plugins .plugin-title{padding-right:12px;}.plugins .second td,.plugins .second th{border-top:0 none;padding:0 7px 5px;}.plugins-php .widefat tfoot th,.plugins-php .widefat tfoot td{border-top-style:solid;border-top-width:1px;}.import-system{font-size:16px;}.anchors{margin:10px 20px 10px 20px;}table#availablethemes{border-spacing:0;border-width:1px 0;border-style:solid none;margin:10px auto;width:100%;}td.available-theme{vertical-align:top;width:240px;margin:0;padding:20px;text-align:left;}table#availablethemes td{border-width:0 1px 1px;border-style:none solid solid;}table#availablethemes td.right,table#availablethemes td.left{border-right:0 none;border-left:0 none;}table#availablethemes td.bottom{border-bottom:0 none;}.available-theme a.screenshot{width:240px;height:180px;display:block;border-width:1px;border-style:solid;margin-bottom:10px;overflow:hidden;}.available-theme img{width:240px;}.available-theme h3{margin:15px 0 5px;}#current-theme{margin:1em 0 1.5em;}#current-theme a{border-bottom:none;}#current-theme h3{font-size:17px;font-weight:normal;margin:0;}#current-theme .theme-description{margin-top:5px;}#current-theme img{float:left;border-width:1px;border-style:solid;margin-right:1em;margin-bottom:1.5em;width:150px;}#TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited{font-weight:bold;text-decoration:none;}#TB_window #TB_title{background-color:#222;color:#cfcfcf;}.checkbox{border:none;margin:0;padding:0;}.code,code{font-family:Consolas,Monaco,Courier,monospace;}kbd,code{padding:1px 3px;margin:0 1px;font-size:11px;}.commentlist li{padding:1em 1em .2em;margin:0;border-bottom-width:1px;border-bottom-style:solid;}.commentlist li li{border-bottom:0;padding:0;}.commentlist p{padding:0;margin:0 0 .8em;}.post-categories{display:inline;margin:0;padding:0;}.post-categories li{display:inline;}.quicktags,.search{font:12px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}.submit{padding:1.5em 0;margin:5px 0;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-left-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;}form p.submit a.cancel:hover{text-decoration:none;}#submitdiv 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;line-height:23px;}#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;}#post-status-display,#post-visibility-display{font-weight:bold;}.side-info{margin:0;padding:4px;font-size:11px;}.side-info h5{padding-bottom:7px;font-size:14px;margin:12px 2px 5px;border-bottom-width:1px;border-bottom-style:solid;}.side-info ul{margin:0;padding-left:18px;list-style:square;}.submit input,.button,input.button,.button-primary,input.button-primary,.button-secondary,input.button-secondary,.button-highlighted,input.button-highlighted,#postcustomstuff .submit input{text-decoration:none;font-size:11px!important;line-height:14px;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;-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:15px;padding:3px 10px;white-space:nowrap;-webkit-border-radius:10px;}#doaction,#doaction2,#post-query-submit{margin-right:8px;}.tablenav select[name="action"],.tablenav select[name="action2"]{width:130px;}.tablenav select[name="m"]{width:155px;}.tablenav select#cat{width:170px;}#wpcontent select{padding:2px;height:2em;font-size:11px;}#wpcontent option{padding:2px;}#timezone_string option{margin-left:1em;}.approve{display:none;}.unapproved .approve,.spam .approve,.trash .approve{display:inline;}.unapproved .unapprove{display:none;}.narrow{width:70%;margin-bottom:40px;}.narrow p{line-height:150%;}textarea.all-options,input.all-options{width:250px;}#namediv table{width:100%;}#namediv td.first{width:10px;white-space:nowrap;}#namediv input{width:98%;}#namediv p{margin:10px 0;}#wpbody-content .metabox-holder{padding-top:10px;}#content{margin:0;width:100%;}#editorcontainer #content{padding:6px;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,#quicktags{border-style:solid;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;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{padding:2px 4px 0;}#ed_toolbar input,#ed_reply_toolbar input{margin:3px 1px 4px;line-height:18px;display:inline-block;min-width:26px;padding:2px 4px;font-size:12px;}#ed_reply_toolbar input{margin:1px 2px 1px 1px;}#quicktags #ed_link,#ed_reply_toolbar #ed_reply_link{text-decoration:underline;}#quicktags #ed_del,#ed_reply_toolbar #ed_reply_del{text-decoration:line-through;}#quicktags #ed_em,#ed_reply_toolbar #ed_reply_em{font-style:italic;}#excerpt,.attachmentlinks{margin:0;height:4em;width:98%;}#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;}#postcustomstuff .updatemeta,#postcustomstuff .deletemeta{margin:auto;}#postcustomstuff thead th{padding:5px 8px 8px;}#postcustom #postcustomstuff .submit{border:0 none;float:none;padding:5px 8px;}#side-sortables #postcustom #postcustomstuff .submit{padding:0 5px;}#side-sortables #postcustom #postcustomstuff td.left input{margin:3px 3px 0;}#side-sortables #postcustom #postcustomstuff #the-list textarea{height:85px;margin:3px;}#postcustomstuff table{margin:0;width:100%;border-width:1px;border-style:solid;border-spacing:0;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{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 #newmetaleft{vertical-align:top;}#postcustomstuff #newmetaleft a{padding:0 10px;text-decoration:none;}#save{width:15em;}#template div{margin-right:190px;}* html #template div{margin-right:0;}.zerosize{height:0;width:0;margin:0;border:0;padding:0;overflow:hidden;position:absolute;}* html #themeselect{padding:0 3px;height:22px;}#your-profile legend{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:22px;}#your-profile #rich_editing{border:none;}#howto{font-size:11px;margin:0 5px;display:block;}#ajax-response.alignleft{margin-left:2em;}div.nav{height:2em;padding:7px 10px;vertical-align:text-top;margin:5px 0;}.nav .button-secondary{padding:2px 4px;}a.page-numbers{border-bottom-style:solid;border-bottom-width:2px;font-weight:bold;margin-right:1px;padding:0 2px;}p.pagenav{margin:0;display:inline;}.pagenav span{font-weight:bold;margin:0 6px;}.row-title{font-size:12px!important;font-weight:bold;}.widefat .column-comment p{margin:.6em 0;}.column-author img,.column-username img{float:left;margin-right:10px;margin-top:3px;}.tablenav a.button-secondary{display:block;margin:3px 8px 0 0;}.tablenav{clear:both;height:30px;margin:6px 0 4px;vertical-align:middle;}.tablenav .tablenav-pages{float:right;display:block;cursor:default;height:30px;line-height:30px;font-size:11px;}.tablenav .tablenav-pages a,.tablenav-pages span.current{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{text-align:center;width:80px;padding-top:8px;}td.media-icon img{max-width:80px;max-height:60px;}#update-nag{line-height:29px;font-size:12px;text-align:center;}#update-nag{border-width:1px 0;border-style:solid none;}.plugins .plugin-update{padding:0;}.plugin-update .update-message{margin:0 10px 8px 31px;font-weight:bold;}#pass-strength-result{border-style:solid;border-width:1px;float:left;margin:12px 5px 5px 1px;padding:3px 5px;text-align:center;width:200px;}.row-actions{visibility:hidden;padding:2px 0 0;}tr:hover .row-actions,div.comment-item:hover .row-actions{visibility:visible;}.row-actions-visible{padding:2px 0 0;cursor:pointer;}#wphead-info{margin:0 0 0 15px;padding-right:15px;}#user_info{float:right;font-size:12px;line-height:46px;height:46px;}#user_info p{margin:0;padding:0;line-height:46px;}#wphead{height:46px;}#wphead a,#adminmenu a,#sidemenu a,#taglist a,#catlist a,#show-settings a{text-decoration:none;}#header-logo{float:left;margin:7px 0 0 15px;}#wphead h1{font:normal 22px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:10px 8px 5px;margin:0;float:left;}#wphead h1.long-title{font:normal 18px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:12px 10px 5px;}#wphead #site-visit-button{background-repeat:repeat-x;background-position:0 0;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;cursor:pointer;display:-moz-inline-stack;display:inline-block;font-size:50%;font-style:normal;line-height:17px;margin-left:5px;padding:0 6px;vertical-align:middle;}#wphead h1 a:hover{text-decoration:none;}#wphead h1 a:hover #site-title{text-decoration:underline;}#adminmenu *{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}#adminmenu .wp-submenu{display:none;list-style:none;padding:0;margin:0;position:relative;z-index:2;border-width:1px 0 0;border-style:solid none none;}#adminmenu .wp-submenu a{font:normal 11px/18px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}#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,.no-js #adminmenu .open-if-no-js .wp-submenu{display:block;}#adminmenu div.wp-menu-image{float:left;width:28px;height:28px;}#adminmenu li{margin:0;padding:0;cursor:pointer;}#adminmenu a{display:block;line-height:18px;padding:1px 5px 3px;}#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;-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 .wp-menu-image img{float:left;padding:8px 6px 0;opacity:.6;filter:alpha(opacity=60);}#adminmenu li.menu-top:hover .wp-menu-image img,#adminmenu li.wp-has-current-submenu .wp-menu-image img{opacity:1;filter:alpha(opacity=100);}#adminmenu li.wp-menu-separator{height:21px;padding:0;margin:0;}#adminmenu a.separator{cursor:w-resize;height:20px;padding:0;}.folded #adminmenu a.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;}.folded #adminmenu a.wp-has-submenu{margin-left:40px;}#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;}#adminmenu li.wp-has-current-submenu ul{border-bottom-width:1px;border-bottom-style:solid;}#adminmenu .wp-menu-image a{height:24px;}#adminmenu .wp-menu-image img{padding:6px 0 0 1px;}#adminmenu #awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{position:absolute;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 span.count-0,#sidemenu li a .count-0{display:none;}.post-com-count-wrapper{min-width:22px;font-family:Helvetica,Arial,sans-serif;}.post-com-count{height:1.3em;line-height:1.1em;display:block;text-decoration:none;padding:0 0 6px;cursor:pointer;background-position:center -80px;background-repeat:no-repeat;}.post-com-count span{font-size:9px;font-weight:bold;height:1.7em;line-height:1.70em;min-width:.7em;padding:0 6px;display:inline-block;cursor:pointer;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}strong .post-com-count{background-position:center -55px;}.post-com-count:hover{background-position:center -3px;}.column-response .post-com-count{float:left;margin-right:5px;text-align:center;}.response-links{float:left;}#the-comment-list .attachment-80x60{padding:4px 8px;}#footer{margin-top:-45px;}#footer,#footer a{font-size:12px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-style:italic;}#footer p{margin:0;padding:15px;line-height:15px;}#footer a{text-decoration:none;}#footer a:hover{text-decoration:underline;}.form-table{border-collapse:collapse;margin-top:.5em;width:100%;margin-bottom:-8px;clear:both;}.form-table td{margin-bottom:9px;padding:8px 10px;line-height:20px;font-size:11px;}.form-table th,.form-wrap label{font-weight:normal;text-shadow:rgba(255,255,255,1) 0 1px 0;}.form-table th{vertical-align:top;text-align:left;padding:10px;width:200px;}.form-table th.th-full{width:auto;}.form-table div.color-option{display:block;clear:both;margin-top:12px;}.form-table input.tog{margin-top:2px;margin-right:2px;float:left;}.form-table table.color-palette{vertical-align:bottom;float:left;margin:-12px 3px 11px;}.form-table .color-palette td{border-width:1px 1px 0;border-style:solid solid none;height:10px;line-height:20px;width:10px;}textarea.large-text{width:99%;}.form-table input.regular-text,#adduser .form-field input{width:25em;}.form-table input.small-text{width:50px;}#profile-page .form-table textarea{width:500px;margin-bottom:6px;}#profile-page .form-table #rich_editing{margin-right:5px;}.form-table .pre{padding:8px;margin:0;}.pre{white-space:pre-wrap;white-space:-moz-pre-wrap!important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;}table.form-table td .updated{font-size:13px;}.form-wrap{margin:10px 0;width:97%;}.form-wrap p,.form-wrap label{font-size:11px;}.form-wrap label{display:block;padding:2px;font-size:12px;}.form-field input,.form-field textarea{border-style:solid;border-width:1px;width:95%;}p.description,.form-wrap p{margin:2px 0 5px;}p.help,p.description,span.description,.form-wrap p{font-size:12px;font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}.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;text-align:justify;}.tagcloud h3{margin:2px 0 12px;}#post-body #normal-sortables{min-height:50px;}#post-body #advanced-sortables{min-height:20px;}.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 .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,#normal-sortables .comments-box{border:0 none;}#side-sortables .comments-box thead th,#normal-sortables .comments-box thead th{background:transparent;padding:0 7px 4px;font-style:italic;}#commentsdiv img.waiting{padding-left:5px;vertical-align:middle;}#post-body .tagsdiv #newtag{margin-right:5px;width:16em;}#side-sortables input#post_password{width:94%;}#side-sortables .tagsdiv #newtag{width:68%;}#post-status-info{border-width:0 1px 1px;border-style:none solid solid;width:100%;-moz-border-radius:0 0 6px 6px;-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-left-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;}#post-status-info td{font-size:11px;}.autosave-info{padding:2px 15px 2px 2px;text-align:right;}#editorcontent #post-status-info{border:none;}#post-body .wp_themeSkin .mceStatusbar a.mceResize{display:block;background:transparent url(images/resize.gif) no-repeat scroll right bottom;width:12px;cursor:se-resize;margin:0 2px;position:relative;top:22px;}#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:14px;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 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}.howto{font-style:italic;display:block;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#poststuff h2{margin-top:20px;font-size:1.5em;margin-bottom:15px;padding:0 0 3px;clear:left;}.widget .widget-top,.postbox h3{cursor:move;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}.postbox .hndle span{padding:6px 0;}.postbox .hndle{cursor:move;}.hndle a{font-size:11px;font-weight:normal;}#dashboard-widgets .meta-box-sortables{margin:0 5px;}.postbox .handlediv{float:right;width:23px;height:26px;}.sortable-placeholder{border-width:1px;border-style:dashed;margin-bottom:20px;}#poststuff h3,.metabox-holder h3{font-size:12px;font-weight:bold;padding:7px 9px;margin:0;line-height:1;}.widget,.postbox,.stuffbox{margin-bottom:20px;border-width:1px;border-style:solid;line-height:1;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}.widget .widget-top,.postbox h3,.postbox h3,.stuffbox h3{-moz-border-radius:6px 6px 0 0;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-right-radius:6px;-khtml-border-top-left-radius:6px;border-top-right-radius:6px;border-top-left-radius:6px;}.postbox.closed h3{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;-khtml-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;-khtml-border-bottom-right-radius:4px;border-bottom-right-radius:4px;}.postbox table.form-table{margin-bottom:0;}.postbox 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 6px 8px;}#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{margin-bottom:20px;}#titlediv{margin-bottom:20px;}#titlediv label{cursor:text;}#titlediv div.inside{margin:0;}#poststuff #titlewrap{border:0;padding:0;}#titlediv #title{padding:3px 4px;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-submitbox,#side-sortables .inside-submitbox{margin:0 3px;font-size:11px;}input#link_description,input#link_url{width:98%;}#pending{background:0 none;border:0 none;padding:0;font-size:11px;margin-top:-1px;}#edit-slug-box{height:1em;margin-top:8px;padding:0 7px;}#editable-post-name-full{display:none;}#editable-post-name input{width:16em;}.postarea h3 label{float:left;}.postarea #add-media-button{float:right;margin:7px 0 0;position:relative;right:10px;}#poststuff #editor-toolbar{height:30px;}.wp_themeSkin tr.mceFirst td.mceToolbar{border-width:0 0 1px;border-style:none none solid;}#edButtonPreview,#edButtonHTML{height:18px;margin:5px 5px 0 0;padding:4px 5px 2px;float:right;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}.js .theEditor{color:white;}#poststuff #edButtonHTML{margin-right:15px;}#media-buttons{cursor:default;padding:8px 8px 0;}#media-buttons a{cursor:pointer;padding:0 0 5px 10px;}#media-buttons img,#submitpost #ajax-loading{vertical-align:middle;}.submitbox .submit{text-align:left;padding:12px 10px 10px;font-size:11px;}.submitbox .submitdelete{border-bottom-width:1px;border-bottom-style:solid;text-decoration:none;padding:1px 2px;}.inside-submitbox #post_status{margin:2px 0 2px -2px;}.submitbox .submit a:hover{border-bottom-width:1px;border-bottom-style:solid;}.submitbox .submit input{margin-bottom:8px;margin-right:4px;padding:6px;}#post-status-select{line-height:2.5em;margin-top:3px;}#category-adder{margin-left:120px;padding:4px 0;}#category-adder h4{margin:0 0 8px;}#side-sortables #category-adder{margin:0;}#post-body #category-add input,#category-add select{width:30%;}#side-sortables #category-add input{width:94%;}#side-sortables #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;margin:0 -120px 0 5px;padding:0;}#post-body ul#category-tabs li{padding:8px;}#post-body ul#category-tabs li.tabs{-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-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.tabs a{font-weight:bold;text-decoration:none;}#categorydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:200px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}#post-body #categorydiv div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 5px 0 125px;}#side-sortables #category-tabs li{display:inline;padding-right:8px;}#side-sortables #category-tabs a{text-decoration:none;}#side-sortables #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:0;}#categorydiv .tabs-panel{border-width:3px;border-style:solid;}ul#category-tabs{margin-top:12px;}ul#category-tabs li.tabs{border-style:solid solid none;border-width:1px 1px 0;}#post-body #category-tabs li.tabs{border-style:solid none solid solid;border-width:1px 0 1px 1px;margin-right:-1px;}ul#category-tabs li{padding:5px 8px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-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;}form#tags-filter{position:relative;}p.search-box{float:right;margin:-5px 0 0;}.screen-per-page{width:3em;}#posts-filter fieldset{float:left;margin:0 1.5ex 1em 0;padding:0;}#posts-filter fieldset legend{padding:0 0 .2em 1px;}td.post-title strong,td.plugin-title strong{display:block;margin-bottom:.2em;}td.post-title p,td.plugin-title p{margin:6px 0;}td.plugin-title{white-space:nowrap;}.wp-hidden-children .wp-hidden-child,.ui-tabs-hide,#codepress-off{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;}.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;}.indicator-hint{padding-top:8px;}#display_name{width:15em;}.tablenav .delete{margin-right:20px;}td.action-links,th.action-links{text-align:right;}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;padding:2px 7px;}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;}.settings-toggle{text-align:right;margin:5px 7px 15px 0;font-size:12px;}.settings-toggle h3{margin:0;}#timestampdiv select{height:20px;line-height:14px;padding:0;vertical-align:top;}#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;}#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;}#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{padding:2px 10px 0;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;}#screen-meta{position:relative;clear:both;}#screen-meta-links{margin:0 9px 0 0;}#screen-meta .screen-reader-text{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;}tr.inline-edit-row td{padding: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 .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:.5em;margin:.5em 0 0;}.inline-edit-row span.error{line-height:22px;margin:0 15px;padding:3px 5px;}.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:.5em;}.inline-edit-row .input-text-wrap input[type=text]{width:100%;}.inline-edit-row fieldset label input[type=checkbox]{vertical-align:text-bottom;}.inline-edit-row fieldset label textarea{width:100%;height:4em;}#wpbody-content .bulk-edit-row fieldset .inline-edit-group label{max-width:50%;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:.5em;}.inline-edit-row h4{text-transform:uppercase;}.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;}.inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea{border-style:solid;border-width:1px;}.inline-edit-row fieldset .inline-edit-date{float:left;}.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;}.inline-edit-row fieldset input[name=aa]{font-size:12px;width:3.5em;}.inline-edit-row fieldset label input.inline-edit-password-input{width:8em;}.inline-edit-row .catshow,.inline-edit-row .cathide{cursor:pointer;}ul.cat-checklist{height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0;}#bulk-titles{display:block;height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0 0 5px;}.inline-edit-row fieldset ul.cat-checklist li,.inline-edit-row fieldset ul.cat-checklist input{margin:0;}.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;}table .inline-edit-row fieldset ul.cat-hover{height:auto;max-height:30em;overflow-y:auto;position:absolute;}.inline-edit-row fieldset label input.inline-edit-menu-order-input{width:3em;}.inline-edit-row fieldset label input.inline-edit-slug-input{width:75%;}.quick-edit-row-post fieldset label.inline-edit-status{float:left;}#bulk-titles{line-height:140%;}#bulk-titles div{margin:.2em .3em;}#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;}#wpbody-content #media-items .describe{border-collapse:collapse;width:100%;border-top-style:solid;border-top-width:1px;clear:both;cursor:default;padding:5px;}#wpbody-content .describe th{vertical-align:top;text-align:left;padding:10px;width:140px;}#wpbody-content .describe .media-item-info tr{background-color:transparent;}#wpbody-content .describe .media-item-info td{padding:4px 10px 0;}.describe .media-item-info .A1B1{padding:0 15px 8px 0;}#wpbody-content .filename{padding:0 10px;}#wpbody-content .media-item .thumbnail{max-height:128px;max-width:128px;}#wpbody-content #async-upload-wrap a{display:none;}.media-upload-form td label{margin-right:6px;margin-left:2px;}.media-upload-form .align .field label{display:inline;padding:0 0 0 22px;margin:0 1em 0 0;font-weight:bold;}.media-upload-form tr.image-size label{margin:0 0 0 3px;font-weight:bold;}.media-upload-form th.label label{font-weight:bold;margin:.5em;font-size:13px;}.media-upload-form th.label label span{padding:0 5px;}abbr.required{border:medium none;text-decoration:none;}#wpbody-content .describe input[type="text"],#wpbody-content .describe textarea{width:460px;}#wpbody-content .describe p.help{margin:0;padding:0 0 0 5px;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}#wpbody-content .media-item{border-bottom-style:solid;border-bottom-width:1px;min-height:36px;position:relative;width:100%;}#wpbody-content .media-single .media-item{border-bottom-style:none;border-bottom-width:0;}#wpbody-content #media-items{border-style:solid solid none;border-width:1px;width:670px;}#wpbody-content #media-items .filename{line-height:36px;overflow:hidden;}.media-item .pinkynail{float:left;margin:2px;max-width:40px;max-height:32px;}.media-item .startopen,.media-item .startclosed{display:none;}.media-item .original{position:relative;height:34px;text-align:center;}.media-item .percent{font-weight:bold;}.crunching{display:block;line-height:32px;text-align:right;margin-right:5px;}button.dismiss{position:absolute;top:7px;right:5px;z-index:4;width:8em;}.file-error{float:left;font-weight:bold;padding:10px;}.progress{position:relative;margin-bottom:-36px;height:36px;}.bar{width:0;height:100%;border-right-width:3px;border-right-style:solid;}.upload-php .fixed .column-parent{width:25%;}.find-box{width:500px;height:300px;overflow:hidden;padding:33px 5px 40px;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%;}.find-box-inside{overflow:auto;width:100%;height:100%;}.find-box-search{padding:12px;border-width:1px;border-style:none none solid;}#find-posts-response{margin:8px 0;padding:0 1px;}#find-posts-response table{width:100%;}#find-posts-response .found-radio{padding:5px 0 0 8px;width:15px;}.find-box-buttons{width:480px;margin:8px;}.find-box-search label{padding-right:6px;}.find-box #resize-se{position:absolute;right:1px;bottom:1px;}#favorite-actions{float:right;margin:11px 12px 0;min-width:130px;position:relative;}#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;}#favorite-inside{margin:0;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;}#favorite-actions a{display:block;text-decoration:none;font-size:11px;}#favorite-inside a{padding:3px 5px 3px 10px;}#favorite-toggle{height:22px;position:absolute;right:0;top:1px;width:28px;}#favorite-actions .slide-down{-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;}#utc-time,#local-time{padding-left:25px;font-style:italic;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}ul#dismissed-updates{display:none;}form.upgrade{margin-top:8px;}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0;}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}br.clear{height:2px;line-height:2px;}.swfupload{margin:5px 10px;vertical-align:middle;}table.fixed{table-layout:fixed;}.fixed .column-rating,.fixed .column-visible{width:8%;}.fixed .column-date,.fixed .column-parent,.fixed .column-links{width:10%;}.fixed .column-response,.fixed .column-author,.fixed .column-categories,.fixed .column-tags,.fixed .column-rel,.fixed .column-role{width:15%;}.fixed .column-comments{width:4em;padding-top:8px;}.fixed .column-slug{width:25%;}.fixed .column-posts{width:10%;}.fixed .column-icon{width:80px;}#commentsdiv .fixed .column-author,#comments-form .fixed .column-author{width:20%;}.widefat th,.widefat td{overflow:hidden;}.widefat td p{margin:2px 0 .8em;}table .vers,table .column-visible,table .column-rating{text-align:center;}.icon32{float:left;height:36px;margin:14px 6px 0 0;width:36px;}.key-labels label{line-height:24px;}.subtitle{font-size:.75em;line-height:1;padding-left:25px;}ol{list-style-type:decimal;margin-left:2em;}.postbox-container{float:left;padding-right:.5%;}.postbox-container .meta-box-sortables{min-height:300px;}.temp-border{border:1px dotted #ccc;}.columns-prefs label{padding:0 5px;}.theme-install-php h4,.plugin-install-php h4{margin:2.5em 0 8px;}p.install-help{margin:8px 0;font-style:italic;}p.popular-tags{-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border-width:1px;border-style:solid;line-height:2em;padding:8px 12px 12px;text-align:justify;}p.popular-tags a{padding:0 3px;}.stuffbox .editcomment{clear:none;}.ajax-feedback{visibility:hidden;vertical-align:bottom;}.tagsdiv .newtag{width:180px;}.tagsdiv .the-tags{display:block;height:60px;margin:0 auto;overflow:auto;width:260px;}#post-body-content .tagsdiv .the-tags{margin:0 5px;}label,#your-profile label+a{vertical-align:middle;}#misc-publishing-actions label{vertical-align:baseline;}.plugin-update-tr .update-message{margin:5px;padding:3px 5px;border-width:1px;border-style:solid;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}.add-new-h2{font-style:normal;margin:0 6px;position:relative;top:-3px;}.describe .image-editor{vertical-align:top;}.imgedit-wrap{position:relative;}.imgedit-settings p{margin:8px 0;}.describe .imgedit-wrap table td{vertical-align:top;padding-top:0;}.imgedit-wrap p,.describe .imgedit-wrap table td{font-size:11px;line-height:18px;}.describe .imgedit-wrap table td.imgedit-settings{padding:0 5px;}td.imgedit-settings input{vertical-align:middle;}.imgedit-wait{position:absolute;top:0;background:#FFF url(images/wpspin_light.gif) no-repeat scroll 22px 10px;opacity:.7;filter:alpha(opacity=70);width:100%;height:500px;display:none;}.media-disabled,.imgedit-settings .disabled{color:grey;}.imgedit-wait-spin{padding:0 4px 4px;vertical-align:bottom;visibility:hidden;}.imgedit-menu{margin:0 0 12px;min-width:300px;}.imgedit-menu div{float:left;width:32px;height:32px;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;border-width:1px;border-style:solid;}.imgedit-crop-wrap{position:relative;}.imgedit-crop{background:transparent url(images/imgedit-icons.png) no-repeat scroll -9px -31px;margin:0 8px 0 0;}.imgedit-crop.disabled:hover{background-position:-9px -31px;}.imgedit-crop:hover{background-position:-9px -1px;}.imgedit-rleft{background:transparent url(images/imgedit-icons.png) no-repeat scroll -46px -31px;margin:0 3px;}.imgedit-rleft.disabled:hover{background-position:-46px -31px;}.imgedit-rleft:hover{background-position:-46px -1px;}.imgedit-rright{background:transparent url(images/imgedit-icons.png) no-repeat scroll -77px -31px;margin:0 8px 0 3px;}.imgedit-rright.disabled:hover{background-position:-77px -31px;}.imgedit-rright:hover{background-position:-77px -1px;}.imgedit-flipv{background:transparent url(images/imgedit-icons.png) no-repeat scroll -115px -31px;margin:0 3px;}.imgedit-flipv.disabled:hover{background-position:-115px -31px;}.imgedit-flipv:hover{background-position:-115px -1px;}.imgedit-fliph{background:transparent url(images/imgedit-icons.png) no-repeat scroll -147px -31px;margin:0 8px 0 3px;}.imgedit-fliph.disabled:hover{background-position:-147px -31px;}.imgedit-fliph:hover{background-position:-147px -1px;}.imgedit-undo{background:transparent url(images/imgedit-icons.png) no-repeat scroll -184px -31px;margin:0 3px;}.imgedit-undo.disabled:hover{background-position:-184px -31px;}.imgedit-undo:hover{background-position:-184px -1px;}.imgedit-redo{background:transparent url(images/imgedit-icons.png) no-repeat scroll -215px -31px;margin:0 8px 0 3px;}.imgedit-redo.disabled:hover{background-position:-215px -31px;}.imgedit-redo:hover{background-position:-215px -1px;}.imgedit-applyto img{margin:0 8px 0 0;}.imgedit-group-top{margin:5px 0;}.imgedit-applyto .imgedit-label{padding:2px 0 0;display:block;}.imgedit-help{display:none;font-style:italic;margin-bottom:8px;}.imgedit-help ul li{font-size:11px;}a.imgedit-help-toggle{text-decoration:none;}#wpbody-content .imgedit-response div{width:600px;margin:8px;}.form-table td.imgedit-response{padding:0;}.imgedit-submit{margin:8px 0;}.imgedit-submit-btn{margin-left:20px;}.imgedit-wrap .nowrap{white-space:nowrap;}span.imgedit-scale-warn{color:red;font-size:20px;font-style:normal;visibility:hidden;vertical-align:middle;}.imgedit-group{border-width:1px;border-style:solid;-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;margin-bottom:8px;padding:2px 10px;}#dashboard_recent_comments div.undo{border-top-style:solid;border-top-width:1px;margin:0 -10px;padding:3px 8px;font-size:11px;}.trash-undo-inside,.spam-undo-inside{margin:1px 8px 1px 0;line-height:16px;}.spam-undo-inside .avatar,.trash-undo-inside .avatar{height:20px;width:20px;margin-right:8px;vertical-align:middle;}.taghint{color:#aaa;margin:14px 0 -17px 8px;}#poststuff .tagsdiv .howto{margin:0 0 6px 8px;}.ajaxtag .newtag{background:transparent;position:relative;}#broken-themes{text-align:left;width:50%;border-spacing:3px;padding:3px;}.describe .del-link{padding-left:5px;}.comment-ays{margin-bottom:0;border-style:solid;border-width:1px;}.comment-ays th{border-right-style:solid;border-right-width:1px;}
\ No newline at end of file
index a7495f436a964e33fd6d91b6cac9f56304e9aa34..f8feb372e2238aa0a53e95eab5bf0d0bb831446f 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Atom Publishing Protocol support for WordPress
  *
- * @author Original by Elias Torres <http://torrez.us/archives/2006/08/31/491/>
- * @author Modified by Dougal Campbell <http://dougal.gunters.org/>
  * @version 1.0.5-dc
  */
 
@@ -226,10 +224,7 @@ class AtomServer {
        function AtomServer() {
 
                $this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
-               $this->app_base = get_bloginfo('url') . '/' . $this->script_name . '/';
-               if ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) {
-                       $this->app_base = preg_replace( '/^http:\/\//', 'https://', $this->app_base );
-               }
+               $this->app_base = site_url( $this->script_name . '/' );
 
                $this->selectors = array(
                        '@/service$@' =>
@@ -265,7 +260,7 @@ class AtomServer {
        function handle_request() {
                global $always_authenticate;
 
-               if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
+               if ( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
                        $path = $_SERVER['ORIG_PATH_INFO'];
                else
                        $path = $_SERVER['PATH_INFO'];
@@ -278,40 +273,38 @@ class AtomServer {
                //$this->process_conditionals();
 
                // exception case for HEAD (treat exactly as GET, but don't output)
-               if($method == 'HEAD') {
+               if ($method == 'HEAD') {
                        $this->do_output = false;
                        $method = 'GET';
                }
 
                // redirect to /service in case no path is found.
-               if(strlen($path) == 0 || $path == '/') {
+               if (strlen($path) == 0 || $path == '/')
                        $this->redirect($this->get_service_url());
-               }
 
                // check to see if AtomPub is enabled
-               if( !get_option( 'enable_app' ) )
-                       $this->forbidden( sprintf( __( 'AtomPub services are disabled on this blog.  An admin user can enable them at %s' ), admin_url('options-writing.php') ) );
+               if ( !get_option( 'enable_app' ) )
+                       $this->forbidden( sprintf( __( 'AtomPub services are disabled on this site.  An admin user can enable them at %s' ), admin_url('options-writing.php') ) );
 
                // dispatch
-               foreach($this->selectors as $regex => $funcs) {
-                       if(preg_match($regex, $path, $matches)) {
-                       if(isset($funcs[$method])) {
-
-                               // authenticate regardless of the operation and set the current
-                               // user. each handler will decide if auth is required or not.
-                               if(!$this->authenticate()) {
-                                       if ($always_authenticate) {
-                                               $this->auth_required('Credentials required.');
+               foreach ( $this->selectors as $regex => $funcs ) {
+                       if ( preg_match($regex, $path, $matches) ) {
+                               if ( isset($funcs[$method]) ) {
+
+                                       // authenticate regardless of the operation and set the current
+                                       // user. each handler will decide if auth is required or not.
+                                       if ( !$this->authenticate() ) {
+                                               if ( $always_authenticate )
+                                                       $this->auth_required('Credentials required.');
                                        }
-                               }
 
-                               array_shift($matches);
-                               call_user_func_array(array(&$this,$funcs[$method]), $matches);
-                               exit();
-                       } else {
-                               // only allow what we have handlers for...
-                               $this->not_allowed(array_keys($funcs));
-                       }
+                                       array_shift($matches);
+                                       call_user_func_array(array(&$this,$funcs[$method]), $matches);
+                                       exit();
+                               } else {
+                                       // only allow what we have handlers for...
+                                       $this->not_allowed(array_keys($funcs));
+                               }
                        }
                }
 
@@ -327,8 +320,8 @@ class AtomServer {
        function get_service() {
                log_app('function','get_service()');
 
-               if( !current_user_can( 'edit_posts' ) )
-                       $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
 
                $entries_url = esc_attr($this->get_entries_url());
                $categories_url = esc_attr($this->get_categories_url());
@@ -338,7 +331,7 @@ class AtomServer {
                        $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
                }
                $atom_prefix="atom";
-               $atom_blogname=get_bloginfo('name');
+               $atom_blogname = get_bloginfo('name');
                $service_doc = <<<EOD
 <service xmlns="$this->ATOMPUB_NS" xmlns:$atom_prefix="$this->ATOM_NS">
   <workspace>
@@ -368,16 +361,16 @@ EOD;
        function get_categories_xml() {
                log_app('function','get_categories_xml()');
 
-               if( !current_user_can( 'edit_posts' ) )
-                       $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
 
-               $home = esc_attr(get_bloginfo_rss('home'));
+               $home = esc_attr(get_bloginfo_rss('url'));
 
                $categories = "";
-               $cats = get_categories("hierarchical=0&hide_empty=0");
-               foreach ((array) $cats as $cat) {
+               $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0));
+               foreach ( (array) $cats as $cat ) {
                        $categories .= "    <category term=\"" . esc_attr($cat->name) .  "\" />\n";
-}
+               }
                $output = <<<EOD
 <app:categories xmlns:app="$this->ATOMPUB_NS"
        xmlns="$this->ATOM_NS"
@@ -385,8 +378,8 @@ EOD;
        $categories
 </app:categories>
 EOD;
-       $this->output($output, $this->CATEGORIES_CONTENT_TYPE);
-}
+               $this->output($output, $this->CATEGORIES_CONTENT_TYPE);
+       }
 
        /**
         * Create new post.
@@ -398,32 +391,32 @@ EOD;
                $this->get_accepted_content_type($this->atom_content_types);
 
                $parser = new AtomParser();
-               if(!$parser->parse()) {
+               if ( !$parser->parse() )
                        $this->client_error();
-               }
 
                $entry = array_pop($parser->feed->entries);
 
                log_app('Received entry:', print_r($entry,true));
 
                $catnames = array();
-               foreach($entry->categories as $cat)
+               foreach ( $entry->categories as $cat ) {
                        array_push($catnames, $cat["term"]);
+               }
 
                $wp_cats = get_categories(array('hide_empty' => false));
 
                $post_category = array();
 
-               foreach($wp_cats as $cat) {
-                       if(in_array($cat->name, $catnames))
+               foreach ( $wp_cats as $cat ) {
+                       if ( in_array($cat->name, $catnames) )
                                array_push($post_category, $cat->term_id);
                }
 
-               $publish = (isset($entry->draft) && trim($entry->draft) == 'yes') ? false : true;
+               $publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
 
                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
 
-               if(!current_user_can($cap))
+               if ( !current_user_can($cap) )
                        $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
 
                $blog_ID = (int ) $blog_id;
@@ -448,7 +441,7 @@ EOD;
                if ( is_wp_error( $postID ) )
                        $this->internal_error($postID->get_error_message());
 
-               if (!$postID)
+               if ( !$postID )
                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
 
                // getting warning here about unable to set headers
@@ -475,7 +468,7 @@ EOD;
        function get_post($postID) {
                global $entry;
 
-               if( !current_user_can( 'edit_post', $postID ) )
+               if ( !current_user_can( 'edit_post', $postID ) )
                        $this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) );
 
                $this->set_current_entry($postID);
@@ -498,9 +491,8 @@ EOD;
                $this->get_accepted_content_type($this->atom_content_types);
 
                $parser = new AtomParser();
-               if(!$parser->parse()) {
+               if ( !$parser->parse() )
                        $this->bad_request();
-               }
 
                $parsed = array_pop($parser->feed->entries);
 
@@ -510,10 +502,10 @@ EOD;
                global $entry;
                $this->set_current_entry($postID);
 
-               if(!current_user_can('edit_post', $entry['ID']))
+               if ( !current_user_can('edit_post', $entry['ID']) )
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
 
-               $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
+               $publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) );
                $post_status = ($publish) ? 'publish' : 'draft';
 
                extract($entry);
@@ -533,9 +525,8 @@ EOD;
 
                $result = wp_update_post($postdata);
 
-               if (!$result) {
+               if ( !$result )
                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
-               }
 
                do_action( 'atompub_put_post', $ID, $parsed );
 
@@ -556,16 +547,15 @@ EOD;
                global $entry;
                $this->set_current_entry($postID);
 
-               if(!current_user_can('edit_post', $postID)) {
+               if ( !current_user_can('edit_post', $postID) )
                        $this->auth_required(__('Sorry, you do not have the right to delete this post.'));
-               }
 
-               if ($entry['post_type'] == 'attachment') {
+               if ( $entry['post_type'] == 'attachment' ) {
                        $this->delete_attachment($postID);
                } else {
                        $result = wp_delete_post($postID);
 
-                       if (!$result) {
+                       if ( !$result ) {
                                $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
                        }
 
@@ -583,10 +573,10 @@ EOD;
         * @param int $postID Optional. Post ID.
         */
        function get_attachment($postID = null) {
-               if( !current_user_can( 'upload_files' ) )
+               if ( !current_user_can( 'upload_files' ) )
                        $this->auth_required( __( 'Sorry, you do not have permission to upload files.' ) );
 
-               if (!isset($postID)) {
+               if ( !isset($postID) ) {
                        $this->get_attachments();
                } else {
                        $this->set_current_entry($postID);
@@ -605,12 +595,12 @@ EOD;
 
                $type = $this->get_accepted_content_type();
 
-               if(!current_user_can('upload_files'))
+               if ( !current_user_can('upload_files') )
                        $this->auth_required(__('You do not have permission to upload files.'));
 
                $fp = fopen("php://input", "rb");
                $bits = null;
-               while(!feof($fp)) {
+               while ( !feof($fp) ) {
                        $bits .= fread($fp, 4096);
                }
                fclose($fp);
@@ -668,7 +658,7 @@ EOD;
                $this->get_accepted_content_type($this->atom_content_types);
 
                $parser = new AtomParser();
-               if(!$parser->parse()) {
+               if (!$parser->parse()) {
                        $this->bad_request();
                }
 
@@ -678,7 +668,7 @@ EOD;
                global $entry;
                $this->set_current_entry($postID);
 
-               if(!current_user_can('edit_post', $entry['ID']))
+               if ( !current_user_can('edit_post', $entry['ID']) )
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
 
                extract($entry);
@@ -694,9 +684,8 @@ EOD;
 
                $result = wp_update_post($postdata);
 
-               if (!$result) {
+               if ( !$result )
                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
-               }
 
                log_app('function',"put_attachment($postID)");
                $this->ok();
@@ -716,14 +705,13 @@ EOD;
                global $entry;
                $this->set_current_entry($postID);
 
-               if(!current_user_can('edit_post', $postID)) {
+               if ( !current_user_can('edit_post', $postID) )
                        $this->auth_required(__('Sorry, you do not have the right to delete this post.'));
-               }
 
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
                $filetype = wp_check_filetype($location);
 
-               if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
+               if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) )
                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
 
                // delete file
@@ -732,9 +720,8 @@ EOD;
                // delete attachment
                $result = wp_delete_post($postID);
 
-               if (!$result) {
+               if ( !$result )
                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
-               }
 
                log_app('function',"delete_attachment($postID). File '$location' deleted.");
                $this->ok();
@@ -754,27 +741,26 @@ EOD;
                $this->set_current_entry($postID);
 
                // then whether user can edit the specific post
-               if(!current_user_can('edit_post', $postID)) {
+               if ( !current_user_can('edit_post', $postID) )
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
-               }
 
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
                $location = get_option ('upload_path') . '/' . $location;
                $filetype = wp_check_filetype($location);
 
-               if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
+               if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) )
                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
 
                status_header('200');
                header('Content-Type: ' . $entry['post_mime_type']);
                header('Connection: close');
 
-               if ($fp = fopen($location, "rb")) {
+               if ( $fp = fopen($location, "rb") ) {
                        status_header('200');
                        header('Content-Type: ' . $entry['post_mime_type']);
                        header('Connection: close');
 
-                       while(!feof($fp)) {
+                       while ( !feof($fp) ) {
                                echo fread($fp, 4096);
                        }
 
@@ -797,7 +783,7 @@ EOD;
        function put_file($postID) {
 
                // first check if user can upload
-               if(!current_user_can('upload_files'))
+               if ( !current_user_can('upload_files') )
                        $this->auth_required(__('You do not have permission to upload files.'));
 
                // check for not found
@@ -805,9 +791,8 @@ EOD;
                $this->set_current_entry($postID);
 
                // then whether user can edit the specific post
-               if(!current_user_can('edit_post', $postID)) {
+               if ( !current_user_can('edit_post', $postID) )
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
-               }
 
                $upload_dir = wp_upload_dir( );
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
@@ -815,12 +800,12 @@ EOD;
 
                $location = "{$upload_dir['basedir']}/{$location}";
 
-               if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
+               if (!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
 
                $fp = fopen("php://input", "rb");
                $localfp = fopen($location, "w+");
-               while(!feof($fp)) {
+               while ( !feof($fp) ) {
                        fwrite($localfp,fread($fp, 4096));
                }
                fclose($fp);
@@ -837,9 +822,8 @@ EOD;
                $post_data = compact('ID', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt');
                $result = wp_update_post($post_data);
 
-               if (!$result) {
+               if ( !$result )
                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
-               }
 
                wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
 
@@ -856,15 +840,13 @@ EOD;
         * @return string
         */
        function get_entries_url($page = null) {
-               if ( isset($GLOBALS['post_type']) && ( $GLOBALS['post_type'] == 'attachment' ) ) {
+               if ( isset($GLOBALS['post_type']) && ( $GLOBALS['post_type'] == 'attachment' ) )
                        $path = $this->MEDIA_PATH;
-               } else {
+               else
                        $path = $this->ENTRIES_PATH;
-               }
                $url = $this->app_base . $path;
-               if(isset($page) && is_int($page)) {
+               if ( isset($page) && is_int($page) )
                        $url .= "/$page";
-               }
                return $url;
        }
 
@@ -884,10 +866,12 @@ EOD;
         *
         * @since 2.2.0
         *
-        * @param mixed $deprecated Optional, not used.
+        * @param mixed $deprecated Not used.
         * @return string
         */
        function get_categories_url($deprecated = '') {
+               if ( !empty( $deprecated ) )
+                       _deprecated_argument( __FUNCTION__, '2.5' );
                return $this->app_base . $this->CATEGORIES_PATH;
        }
 
@@ -910,7 +894,7 @@ EOD;
         */
        function get_attachments_url($page = null) {
                $url = $this->app_base . $this->MEDIA_PATH;
-               if(isset($page) && is_int($page)) {
+               if (isset($page) && is_int($page)) {
                        $url .= "/$page";
                }
                return $url;
@@ -947,7 +931,7 @@ EOD;
         * @return string
         */
        function get_entry_url($postID = null) {
-               if(!isset($postID)) {
+               if (!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
                }
@@ -978,7 +962,7 @@ EOD;
         * @return string
         */
        function get_media_url($postID = null) {
-               if(!isset($postID)) {
+               if (!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
                }
@@ -1011,14 +995,14 @@ EOD;
                global $entry;
                log_app('function',"set_current_entry($postID)");
 
-               if(!isset($postID)) {
+               if (!isset($postID)) {
                        // $this->bad_request();
                        $this->not_found();
                }
 
                $entry = wp_get_single_post($postID,ARRAY_A);
 
-               if(!isset($entry) || !isset($entry['ID']))
+               if (!isset($entry) || !isset($entry['ID']))
                        $this->not_found();
 
                return;
@@ -1069,7 +1053,7 @@ EOD;
 
                $this->ENTRY_PATH = $post_type;
 
-               if(!isset($page)) {
+               if (!isset($page)) {
                        $page = 1;
                }
                $page = (int) $page;
@@ -1092,22 +1076,22 @@ EOD;
                $prev_page = ($page - 1) < 1 ? NULL : $page - 1;
                $last_page = ((int)$last_page == 1 || (int)$last_page == 0) ? NULL : (int) $last_page;
                $self_page = $page > 1 ? $page : NULL;
-?><feed xmlns="<?php echo $this->ATOM_NS ?>" xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
+?><feed xmlns="<?php echo $this->ATOM_NS ?>" xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>" <?php do_action('app_ns'); ?> >
 <id><?php $this->the_entries_url() ?></id>
 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
 <title type="text"><?php bloginfo_rss('name') ?></title>
 <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 <link rel="first" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url() ?>" />
-<?php if(isset($prev_page)): ?>
+<?php if (isset($prev_page)): ?>
 <link rel="previous" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($prev_page) ?>" />
 <?php endif; ?>
-<?php if(isset($next_page)): ?>
+<?php if (isset($next_page)): ?>
 <link rel="next" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($next_page) ?>" />
 <?php endif; ?>
 <link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
 <link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" />
 <rights type="text">Copyright <?php echo date('Y'); ?></rights>
-<?php the_generator( 'atom' ); ?>
+<?php do_action('app_head'); ?>
 <?php if ( have_posts() ) {
                        while ( have_posts() ) {
                                the_post();
@@ -1166,7 +1150,7 @@ EOD;
        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'); ?>">
-       <id><?php the_guid($GLOBALS['post']->ID); ?></id>
+       <id><?php the_guid( $GLOBALS['post']->ID ); ?></id>
 <?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?>
        <title type="<?php echo $content_type ?>"><?php echo $content ?></title>
        <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
@@ -1181,9 +1165,9 @@ EOD;
                <uri><?php the_author_meta('url') ?></uri>
 <?php } ?>
        </author>
-<?php if($GLOBALS['post']->post_type == 'attachment') { ?>
+<?php if ($GLOBALS['post']->post_type == 'attachment') { ?>
        <link rel="edit-media" href="<?php $this->the_media_url() ?>" />
-       <content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid(); ?>"/>
+       <content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid() ; ?>"/>
 <?php } else { ?>
        <link href="<?php the_permalink_rss() ?>" />
 <?php if ( strlen( $GLOBALS['post']->post_content ) ) :
@@ -1195,6 +1179,7 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
        <?php the_category_rss( 'atom' ); ?>
 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?>
        <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary>
+       <?php do_action('app_entry'); ?>
 </entry>
 <?php }
 
@@ -1373,7 +1358,7 @@ EOD;
                                break;
                }
                header("Content-Type: $this->ATOM_CONTENT_TYPE");
-               if(isset($ctloc))
+               if (isset($ctloc))
                        header('Content-Location: ' . $ctloc);
                header('Location: ' . $edit);
                status_header('201');
@@ -1428,7 +1413,7 @@ EOD;
                        header('Content-Type: ' . $ctype);
                        header('Content-Disposition: attachment; filename=atom.xml');
                        header('Date: '. date('r'));
-                       if($this->do_output)
+                       if ($this->do_output)
                                echo $xml;
                        log_app('function', "output:\n$xml");
                        exit;
@@ -1467,7 +1452,7 @@ EOD;
 
                // if using mod_rewrite/ENV hack
                // http://www.besthostratings.com/articles/http-auth-php-cgi.html
-               if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
+               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'])) {
@@ -1478,7 +1463,7 @@ EOD;
                }
 
                // If Basic Auth is working...
-               if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
+               if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
                        log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
 
                        $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
@@ -1502,11 +1487,11 @@ EOD;
         */
        function get_accepted_content_type($types = null) {
 
-               if(!isset($types)) {
+               if (!isset($types)) {
                        $types = $this->media_content_types;
                }
 
-               if(!isset($_SERVER['CONTENT_LENGTH']) || !isset($_SERVER['CONTENT_TYPE'])) {
+               if (!isset($_SERVER['CONTENT_LENGTH']) || !isset($_SERVER['CONTENT_TYPE'])) {
                        $this->length_required();
                }
 
@@ -1517,8 +1502,8 @@ EOD;
 
                foreach($types as $t) {
                        list($acceptedType,$acceptedSubtype) = explode('/',$t);
-                       if($acceptedType == '*' || $acceptedType == $type) {
-                               if($acceptedSubtype == '*' || $acceptedSubtype == $subtype)
+                       if ($acceptedType == '*' || $acceptedType == $type) {
+                               if ($acceptedSubtype == '*' || $acceptedSubtype == $subtype)
                                        return $type . "/" . $subtype;
                        }
                }
@@ -1533,8 +1518,8 @@ EOD;
         */
        function process_conditionals() {
 
-               if(empty($this->params)) return;
-               if($_SERVER['REQUEST_METHOD'] == 'DELETE') return;
+               if (empty($this->params)) return;
+               if ($_SERVER['REQUEST_METHOD'] == 'DELETE') return;
 
                switch($this->params[0]) {
                        case $this->ENTRY_PATH:
@@ -1585,11 +1570,11 @@ EOD;
        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))
+               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;
 
-               if($match[3] == 'Z')
-                       $match[3] == '+0000';
+               if ($match[3] == 'Z')
+                       $match[3] = '+0000';
 
                return strtotime($match[1] . " " . $match[2] . " " . $match[3]);
        }
@@ -1606,7 +1591,7 @@ EOD;
 
                $pubtime = $this->rfc3339_str2time($published);
 
-               if(!$pubtime) {
+               if (!$pubtime) {
                        return array(current_time('mysql'),current_time('mysql',1));
                } else {
                        return array(date("Y-m-d H:i:s", $pubtime), gmdate("Y-m-d H:i:s", $pubtime));
index e60d159ddcf0b3a5556648b5ef249e6f54af6383..e2e12f76cba98cbbe11b66ddd976e4ad8a8dcb83 100644 (file)
@@ -19,20 +19,27 @@ nocache_headers();
 
 $comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
 
-$status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
+$post = get_post($comment_post_ID);
 
-if ( empty($status->comment_status) ) {
+if ( empty($post->comment_status) ) {
        do_action('comment_id_not_found', $comment_post_ID);
        exit;
-} elseif ( !comments_open($comment_post_ID) ) {
+}
+
+// get_post_status() will get the parent status for attachments.
+$status = get_post_status($post);
+
+$status_obj = get_post_status_object($status);
+
+if ( !comments_open($comment_post_ID) ) {
        do_action('comment_closed', $comment_post_ID);
        wp_die( __('Sorry, comments are closed for this item.') );
-} elseif ( in_array($status->post_status, array('draft', 'future', 'pending') ) ) {
-       do_action('comment_on_draft', $comment_post_ID);
-       exit;
-} elseif ( 'trash' == $status->post_status ) {
+} elseif ( 'trash' == $status ) {
        do_action('comment_on_trash', $comment_post_ID);
        exit;
+} elseif ( !$status_obj->public && !$status_obj->private ) {
+       do_action('comment_on_draft', $comment_post_ID);
+       exit;
 } elseif ( post_password_required($comment_post_ID) ) {
        do_action('comment_on_password_protected', $comment_post_ID);
        exit;
@@ -60,7 +67,7 @@ if ( $user->ID ) {
                }
        }
 } else {
-       if ( get_option('comment_registration') || 'private' == $status->post_status )
+       if ( get_option('comment_registration') || 'private' == $status )
                wp_die( __('Sorry, you must be logged in to post a comment.') );
 }
 
index c884ff0cd7a96eb27b756a6c665c66b5c13f1c86..69cd75e53b3add4ccfaceba1c825f1a6b4a4a86c 100644 (file)
@@ -1,10 +1,10 @@
 <?php\r
-/** \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
+ * Secret Keys, WordPress Language, and ABSPATH. You can find more information\r
+ * by 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
 \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
+define('DB_NAME', 'database_name_here');\r
 \r
 /** MySQL database username */\r
-define('DB_USER', 'usernamehere');\r
+define('DB_USER', 'username_here');\r
 \r
 /** MySQL database password */\r
-define('DB_PASSWORD', 'yourpasswordhere');\r
+define('DB_PASSWORD', 'password_here');\r
 \r
 /** MySQL hostname */\r
 define('DB_HOST', 'localhost');\r
@@ -34,18 +34,23 @@ define('DB_CHARSET', 'utf8');
 define('DB_COLLATE', '');\r
 \r
 /**#@+\r
- * Authentication Unique Keys.\r
+ * Authentication Unique Keys and Salts.\r
  *\r
  * Change these to different unique phrases!\r
- * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}\r
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}\r
  * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\r
  *\r
  * @since 2.6.0\r
  */\r
-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
+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
+define('AUTH_SALT',        'put your unique phrase here');\r
+define('SECURE_AUTH_SALT', 'put your unique phrase here');\r
+define('LOGGED_IN_SALT',   'put your unique phrase here');\r
+define('NONCE_SALT',       'put your unique phrase here');\r
+\r
 /**#@-*/\r
 \r
 /**\r
@@ -66,6 +71,15 @@ $table_prefix  = 'wp_';
  */\r
 define ('WPLANG', '');\r
 \r
+/**\r
+ * For developers: WordPress debugging mode.\r
+ *\r
+ * Change this to true to enable the display of notices during development.\r
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG\r
+ * in their development environments.\r
+ */\r
+define('WP_DEBUG', false);\r
+\r
 /* That's all, stop editing! Happy blogging. */\r
 \r
 /** Absolute path to the WordPress directory. */\r
index d71bc99b2b2f0e852c9ba2e51b9a6944d39e74b3..c70d92673d68400fd12d9a69923102f69d7044bd 100644 (file)
@@ -2,13 +2,13 @@
 /*
 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://akismet.com/get/">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.7
-Author: Matt Mullenweg
-Author URI: http://ma.tt/
+Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need an <a href="http://akismet.com/get/">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.3.0
+Author: Automattic
+Author URI: http://automattic.com/wordpress-plugins/
 */
 
-define('AKISMET_VERSION', '2.2.7');
+define('AKISMET_VERSION', '2.3.0');
 
 // If you hardcode a WP.com API key here, all key config screens will be hidden
 if ( defined('WPCOM_API_KEY') )
@@ -134,19 +134,19 @@ function akismet_conf() {
 <div class="narrow">
 <form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; ">
 <?php if ( !$wpcom_api_key ) { ?>
-       <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have a WordPress.com account yet, you can get one at <a href="%2$s">Akismet.com</a>.'), 'http://akismet.com/', 'http://akismet.com/get/'); ?></p>
+       <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at <a href="%2$s">Akismet.com</a>.'), 'http://akismet.com/', 'http://akismet.com/get/'); ?></p>
 
-<?php akismet_nonce_field($akismet_nonce) ?>
-<h3><label for="key"><?php _e('WordPress.com API Key'); ?></label></h3>
+<h3><label for="key"><?php _e('Akismet API Key'); ?></label></h3>
 <?php foreach ( $ms as $m ) : ?>
        <p style="padding: .5em; background-color: #<?php echo $messages[$m]['color']; ?>; color: #fff; font-weight: bold;"><?php echo $messages[$m]['text']; ?></p>
 <?php endforeach; ?>
-<p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://faq.wordpress.com/2005/10/19/api-key/">What is this?</a>'); ?>)</p>
+<p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://akismet.com/get/">What is this?</a>'); ?>)</p>
 <?php if ( $invalid_key ) { ?>
 <h3><?php _e('Why might my key be invalid?'); ?></h3>
 <p><?php _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the Akismet servers, which is most often caused by an issue with your web host around firewalls or similar.'); ?></p>
 <?php } ?>
 <?php } ?>
+<?php akismet_nonce_field($akismet_nonce) ?>
 <p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Automatically discard spam comments on posts older than a month.'); ?></label></p>
        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options &raquo;'); ?>" /></p>
 </form>
@@ -155,35 +155,37 @@ function akismet_conf() {
 
 <h3><?php _e('Server Connectivity'); ?></h3>
 <?php
-       $servers = akismet_get_server_connectivity();
-       $fail_count = count($servers) - count( array_filter($servers) );
-       if ( is_array($servers) && count($servers) > 0 ) {
-               // some connections work, some fail
-               if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
-                       <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p>
-                       <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com.  Akismet is working but this may cause problems during times of network congestion.  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
-               <?php
-               // all connections fail
-               } elseif ( $fail_count > 0 ) { ?>
-                       <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p>
-                       <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
-               <?php
-               // all connections work
-               } else { ?>
-                       <p style="padding: .5em; background-color: #2d2; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p>
-                       <p><?php _e('Akismet is working correctly.  All servers are accessible.'); ?></p>
-               <?php
-               }
-       } elseif ( !is_callable('fsockopen') ) {
+       if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) {
                ?>
                        <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p>
-                       <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> function.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+                       <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
                <?php
        } else {
-               ?>
-                       <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p>
-                       <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
-               <?php
+               $servers = akismet_get_server_connectivity();
+               $fail_count = count($servers) - count( array_filter($servers) );
+               if ( is_array($servers) && count($servers) > 0 ) {
+                       // some connections work, some fail
+                       if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
+                               <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p>
+                               <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com.  Akismet is working but this may cause problems during times of network congestion.  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+                       <?php
+                       // all connections fail
+                       } elseif ( $fail_count > 0 ) { ?>
+                               <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p>
+                               <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+                       <?php
+                       // all connections work
+                       } else { ?>
+                               <p style="padding: .5em; background-color: #2d2; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p>
+                               <p><?php _e('Akismet is working correctly.  All servers are accessible.'); ?></p>
+                       <?php
+                       }
+               } else {
+                       ?>
+                               <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p>
+                               <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+                       <?php
+               }
        }
        
        if ( !empty($servers) ) {
@@ -278,7 +280,7 @@ function akismet_check_server_connectivity() {
        $test_host = 'rest.akismet.com';
        
        // Some web hosts may disable one or both functions
-       if ( !is_callable('fsockopen') || !is_callable('gethostbynamel') )
+       if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') )
                return array();
        
        $ips = gethostbynamel($test_host);
@@ -328,7 +330,7 @@ function akismet_admin_warnings() {
        if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
                function akismet_warning() {
                        echo "
-                       <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your WordPress.com API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div>
+                       <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your Akismet API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div>
                        ";
                }
                add_action('admin_notices', 'akismet_warning');
@@ -370,6 +372,22 @@ function akismet_get_host($host) {
        return $host;
 }
 
+// return a comma-separated list of role names for the given user
+function akismet_get_user_roles($user_id ) {
+       $roles = false;
+       
+       if ( !class_exists('WP_User') )
+               return false;
+       
+       if ( $user_id > 0 ) {
+               $comment_user = new WP_User($user_id);
+               if ( isset($comment_user->roles) )
+                       $roles = join(',', $comment_user->roles);
+       }
+       
+       return $roles;
+}
+
 // Returns array with headers in $response[0] and body in $response[1]
 function akismet_http_post($request, $host, $path, $port = 80, $ip=null) {
        global $wp_version;
@@ -415,13 +433,15 @@ function akismet_result_spam( $approved ) {
 function akismet_auto_check_comment( $comment ) {
        global $akismet_api_host, $akismet_api_port;
 
-       $comment['user_ip']    = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
+       $comment['user_ip']    = $_SERVER['REMOTE_ADDR'];
        $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
        $comment['referrer']   = $_SERVER['HTTP_REFERER'];
        $comment['blog']       = get_option('home');
        $comment['blog_lang']  = get_locale();
        $comment['blog_charset'] = get_option('blog_charset');
        $comment['permalink']  = get_permalink($comment['comment_post_ID']);
+       
+       $comment['user_role'] = akismet_get_user_roles($comment['user_ID']);
 
        $ignore = array( 'HTTP_COOKIE' );
 
@@ -445,7 +465,7 @@ function akismet_auto_check_comment( $comment ) {
                $diff = time() - $last_updated;
                $diff = $diff / 86400;
                
-               if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' ) {
+               if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' && empty($comment['user_ID']) ) {
                        // akismet_result_spam() won't be called so bump the counter here
                        if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
                                update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
@@ -468,7 +488,7 @@ function akismet_delete_old() {
 function akismet_submit_nonspam_comment ( $comment_id ) {
        global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;
        $comment_id = (int) $comment_id;
-       
+
        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
        if ( !$comment ) // it was deleted
                return;
@@ -482,6 +502,8 @@ function akismet_submit_nonspam_comment ( $comment_id ) {
        if ( is_object($current_site) ) {
                $comment->site_domain = $current_site->domain;
        }
+       $comment->user_role = akismet_get_user_roles($comment->user_ID);
+
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
@@ -508,6 +530,7 @@ function akismet_submit_spam_comment ( $comment_id ) {
        if ( is_object($current_site) ) {
                $comment->site_domain = $current_site->domain;
        }
+       $comment->user_role = akismet_get_user_roles($comment->user_ID);
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
@@ -515,13 +538,39 @@ function akismet_submit_spam_comment ( $comment_id ) {
        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port);
 }
 
-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);
 
+// For old versions of WP only
+function akismet_set_comment_status( $comment_id, $status ) {
+       if ( $status == 'spam' ) {
+               akismet_submit_spam_comment( $comment_id );
+       } elseif ( $status == 'approve' ) {
+               akismet_submit_nonspam_comment( $comment_id );
+       }
+}
+
+// For WP 2.7+
+function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
+       if ( $new_status == $old_status )
+               return;
+
+       if ( $new_status == 'spam' ) {
+               akismet_submit_spam_comment( $comment->comment_ID );
+       } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) {
+               akismet_submit_nonspam_comment( $comment->comment_ID );
+       }
+}
+
 function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); }
-add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' );
 
+if ( function_exists( 'wp_transition_comment_status' ) ) {
+       add_action( 'transition_comment_status', 'akismet_transition_comment_status', 10, 3 );
+} else {
+       add_action('wp_set_comment_status', 'akismet_set_comment_status', 10, 2);
+       add_action('edit_comment', 'akismet_submit_spam_comment');
+       add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' );
+       add_filter( 'comment_spam_to_unapproved', 'akismet_spamtoham' );
+}
 // Total spam in queue
 // get_option( 'akismet_spam_count' ) is the total caught ever
 function akismet_spam_count( $type = false ) {
@@ -956,6 +1005,8 @@ function akismet_rightnow() {
 add_action('rightnow_end', 'akismet_rightnow');
 
 // For WP <= 2.3.x
+global $pagenow;
+
 if ( 'moderation.php' == $pagenow ) {
        function akismet_recheck_button( $page ) {
                global $submenu;
@@ -999,6 +1050,7 @@ function akismet_recheck_queue() {
                $c['blog_lang']  = get_locale();
                $c['blog_charset'] = get_option('blog_charset');
                $c['permalink']  = get_permalink($c['comment_post_ID']);
+               $c['user_role']  = akismet_get_user_roles($c['user_ID']);
                $id = (int) $c['comment_ID'];
 
                $query_string = '';
@@ -1055,7 +1107,7 @@ function widget_akismet_register() {
                ?>
                        <?php echo $before_widget; ?>
                                <?php echo $before_title . $options['title'] . $after_title; ?>
-                               <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><?php printf( __( '%1$s %2$sspam comments%3$s %4$sblocked by%5$s<br />%6$sAkismet%7$s' ), '<div id="akismet1"><span id="akismetcount">' . $count . '</span>', '<span id="akismetsc">', '</span></div>', '<div id="akismet2"><span id="akismetbb">', '</span>', '<span id="akismeta">', '</span></div>' ); ?></a></div></div>
+                               <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><?php printf( __( '%1$s %2$sspam comments%3$s %4$sblocked by%5$s<br />%6$sAkismet%7$s' ), '<span id="akismet1"><span id="akismetcount">' . $count . '</span>', '<span id="akismetsc">', '</span></span>', '<span id="akismet2"><span id="akismetbb">', '</span>', '<span id="akismeta">', '</span></span>' ); ?></a></div></div>
                        <?php echo $after_widget; ?>
        <?php
        }
@@ -1079,7 +1131,7 @@ function widget_akismet_register() {
                $options = $newoptions = get_option('widget_akismet');
                if ( $_POST["akismet-submit"] ) {
                        $newoptions['title'] = strip_tags(stripslashes($_POST["akismet-title"]));
-                       if ( empty($newoptions['title']) ) $newoptions['title'] = 'Spam Blocked';
+                       if ( empty($newoptions['title']) ) $newoptions['title'] = __('Spam Blocked');
                }
                if ( $options != $newoptions ) {
                        $options = $newoptions;
index c3b117695d38220a6eab1756e8aa8b5b218dc5f6..f6b27fc253e54d880899935fae1c6c265626a282 100644 (file)
@@ -2,7 +2,8 @@
 Contributors: matt, ryan, andy, mdawaffe, tellyworth, automattic
 Tags: akismet, comments, spam
 Requires at least: 2.0
-Tested up to: 2.9
+Tested up to: 3.0
+Stable tag: 2.3.0
 
 Akismet checks your comments against the Akismet web service to see if they look like spam or not.
 
@@ -15,16 +16,34 @@ Want to show off how much spam Akismet has caught for you? Just put `<?php akism
 
 See also: [WP Stats plugin](http://wordpress.org/extend/plugins/stats/).
 
-PS: You'll need a [WordPress.com API key](http://wordpress.com/api-keys/) to use it.
+PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it.
 
 == Installation ==
 
-Upload the Akismet plugin to your blog, Activate it, then enter your [WordPress.com API key](http://wordpress.com/api-keys/).
+Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.com API key](http://akismet.com/get/).
 
 1, 2, 3: You're done!
 
 == Changelog ==
 
+* Fix "Are you sure" nonce message on config screen in WPMU
+* Fix XHTML compliance issue in sidebar widget
+* Change author link; remove some old references to WordPress.com accounts
+* Localize the widget title (core ticket #13879)
+
+= 2.2.9 =
+
+* Eliminate a potential conflict with some plugins that may cause spurious reports
+
+= 2.2.8 =
+
+* Fix bug in initial comment check for ipv6 addresses
+* Report comments as ham when they are moved from spam to moderation
+* Report comments as ham when clicking undo after spam
+* Use transition_comment_status action when available instead of older actions for spam/ham submissions
+* Better diagnostic messages when PHP network functions are unavailable
+* Better handling of comments by logged-in users
+
 = 2.2.7 =
 
 * Add a new AKISMET_VERSION constant
index a80b1ea24567683d171fb299372b9f605ca4566f..2877f083468c9df5966b4cc604ac23942d98feaa 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
  * @package Hello_Dolly
- * @author Matt Mullenweg
  * @version 1.5.1
  */
 /*
@@ -63,7 +62,7 @@ add_action('admin_footer', 'hello_dolly');
 // We need some CSS to position the paragraph
 function dolly_css() {
        // This makes sure that the posinioning is also good for right-to-left languages
-       $x = ( 'rtl' == get_bloginfo( 'text_direction' ) ) ? 'left' : 'right';
+       $x = ( is_rtl() ) ? 'left' : 'right';
 
        echo "
        <style type='text/css'>
diff --git a/wp-content/themes/classic/comments.php b/wp-content/themes/classic/comments.php
deleted file mode 100644 (file)
index 3ccd074..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Classic_Theme
- */
-
-if ( post_password_required() ) : ?>
-<p><?php _e('Enter your password to view comments.'); ?></p>
-<?php return; endif; ?>
-
-<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
-<?php if ( comments_open() ) : ?>
-       <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
-<?php endif; ?>
-</h2>
-
-<?php if ( have_comments() ) : ?>
-<ol id="commentlist">
-
-<?php foreach ($comments as $comment) : ?>
-       <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
-       <?php echo get_avatar( $comment, 32 ); ?>
-       <?php comment_text() ?>
-       <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
-       </li>
-
-<?php endforeach; ?>
-
-</ol>
-
-<?php else : // If there are no comments yet ?>
-       <p><?php _e('No comments yet.'); ?></p>
-<?php endif; ?>
-
-<p><?php post_comments_feed_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
-<?php if ( pings_open() ) : ?>
-       <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
-<?php endif; ?>
-</p>
-
-<?php if ( comments_open() ) : ?>
-<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
-
-<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
-<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() ) );?></p>
-<?php else : ?>
-
-<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
-
-<?php if ( is_user_logged_in() ) : ?>
-
-<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
-
-<?php else : ?>
-
-<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
-<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
-
-<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
-<label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>
-
-<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
-<label for="url"><small><?php _e('Website'); ?></small></label></p>
-
-<?php endif; ?>
-
-<!--<p><small><strong>XHTML:</strong> <?php printf(__('You can use these tags: %s'), allowed_tags()); ?></small></p>-->
-
-<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>
-
-<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
-<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
-</p>
-<?php do_action('comment_form', $post->ID); ?>
-
-</form>
-
-<?php endif; // If registration required and not logged in ?>
-
-<?php else : // Comments are closed ?>
-<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
-<?php endif; ?>
diff --git a/wp-content/themes/classic/footer.php b/wp-content/themes/classic/footer.php
deleted file mode 100644 (file)
index 819ed42..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Classic_Theme
- */
-?>
-<!-- begin footer -->
-</div>
-
-<?php get_sidebar(); ?>
-
-<p class="credit"><!--<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> <cite><?php echo sprintf(__("Powered by <a href='http://wordpress.org/' title='%s'><strong>WordPress</strong></a>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></cite></p>
-
-</div>
-
-<?php wp_footer(); ?>
-</body>
-</html>
\ No newline at end of file
diff --git a/wp-content/themes/classic/functions.php b/wp-content/themes/classic/functions.php
deleted file mode 100644 (file)
index 1bc06e2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Classic_Theme
- */
-
-automatic_feed_links();
-
-if ( function_exists('register_sidebar') )
-       register_sidebar(array(
-               'before_widget' => '<li id="%1$s" class="widget %2$s">',
-               'after_widget' => '</li>',
-               'before_title' => '',
-               'after_title' => '',
-       ));
-
-?>
diff --git a/wp-content/themes/classic/header.php b/wp-content/themes/classic/header.php
deleted file mode 100644 (file)
index f16c280..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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'); ?>" />
-
-       <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
-
-       <style type="text/css" media="screen">
-               @import url( <?php bloginfo('stylesheet_url'); ?> );
-       </style>
-
-       <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
-       <?php wp_get_archives('type=monthly&format=link'); ?>
-       <?php //comments_popup_script(); // off by default ?>
-       <?php wp_head(); ?>
-</head>
-
-<body <?php body_class(); ?>>
-<div id="rap">
-<h1 id="header"><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
-
-<div id="content">
-<!-- end header -->
diff --git a/wp-content/themes/classic/index.php b/wp-content/themes/classic/index.php
deleted file mode 100644 (file)
index 6cb8c63..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Classic_Theme
- */
-get_header();
-?>
-
-<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
-<?php the_date('','<h2>','</h2>'); ?>
-
-<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>
-
-       <div class="storycontent">
-               <?php the_content(__('(more...)')); ?>
-       </div>
-
-       <div class="feedback">
-               <?php wp_link_pages(); ?>
-               <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
-       </div>
-
-</div>
-
-<?php comments_template(); // Get wp-comments.php template ?>
-
-<?php endwhile; else: ?>
-<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
-<?php endif; ?>
-
-<?php posts_nav_link(' &#8212; ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/classic/rtl.css b/wp-content/themes/classic/rtl.css
deleted file mode 100644 (file)
index 18188ff..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Based on Arabic (RTL) version of WordPress Classic theme, converted by Serdal (Serdal.com) */
-
-#menu ul ul, #wp-calendar caption, #wp-calendar #prev a { text-align: right; }
-#wp-calendar #next a, .feedback { text-align: left; }
-
-blockquote {
-       border-left: 0;
-       border-right: 5px solid #ccc;
-       margin-left: auto;
-       margin-right: 1.5em;
-       padding-left: 0;
-       padding-right: 5px;
-}
-
-body { font-family: 'Geeza Pro', Tahoma, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; }
-
-h2 { font: 95% 'Al Bayan', 'Traditional Arabic', "Times New Roman", Times, serif; }
-
-p, li, .feedback {
-       font: 90%/175% 'Geeza Pro', Tahoma, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       text-align: justify;
-}
-
-acronym, abbr, span.caps, h2, p, li, #header, #menu ul li, #menu ul ul li, #wp-calendar td, .feedback, .meta, .meta a { letter-spacing: normal; }
-
-#commentlist li ul {
-       border-left: 0;
-       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;
-       padding-left: 60px;
-}
-
-#header {
-       border-left: solid 1px #9a9;
-       border-right: solid 1px #565;
-       font: normal normal 230% 'Al Bayan', 'Traditional Arabic', 'Times New Roman', Times, serif;
-       padding: 15px 60px 15px 10px;
-}
-
-#menu {
-       border-left: 0;
-       border-right: 1px dotted #ccc;
-       padding: 20px 30px 10px 0;
-       right: auto;
-       left: 2px;
-}
-
-#menu form { margin: 0 13px 0 0; }
-
-#menu ul {
-       padding-left: 0;
-       padding-right: 3px;
-}
-
-#menu ul li { font: normal normal 110% 'Geeza Pro', Tahoma, 'Times New Roman', Times, serif; }
-
-#menu ul ul li {
-       font: normal normal 12px/115% 'Geeza Pro', Tahoma, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       padding-left: 0;
-       padding-right: 12px;
-}
-
-#menu ul ul ul.children {
-       padding-left: 0;
-       padding-right: 4px;
-}
-
-#wp-calendar #next a {
-       padding-right: 0;
-       padding-left: 10px;
-}
-
-#wp-calendar #prev a {
-       padding-left: 0;
-       padding-right: 10px;
-}
-
-#wp-calendar td { font: normal normal 12px 'Geeza Pro', Tahoma, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; }
diff --git a/wp-content/themes/classic/screenshot.png b/wp-content/themes/classic/screenshot.png
deleted file mode 100644 (file)
index 6692130..0000000
Binary files a/wp-content/themes/classic/screenshot.png and /dev/null differ
diff --git a/wp-content/themes/classic/sidebar.php b/wp-content/themes/classic/sidebar.php
deleted file mode 100644 (file)
index ab7d745..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Classic_Theme
- */
-?>
-<!-- begin sidebar -->
-<div id="menu">
-
-<ul>
-<?php  /* Widgetized sidebar, if you have the plugin installed. */
-               if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
-       <?php wp_list_pages('title_li=' . __('Pages:')); ?>
-       <?php wp_list_bookmarks('title_after=&title_before='); ?>
-       <?php wp_list_categories('title_li=' . __('Categories:')); ?>
- <li id="search">
-   <label for="s"><?php _e('Search:'); ?></label>
-   <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
-       <div>
-               <input type="text" name="s" id="s" size="15" /><br />
-               <input type="submit" value="<?php esc_attr_e('Search'); ?>" />
-       </div>
-       </form>
- </li>
- <li id="archives"><?php _e('Archives:'); ?>
-       <ul>
-        <?php wp_get_archives('type=monthly'); ?>
-       </ul>
- </li>
- <li id="meta"><?php _e('Meta:'); ?>
-       <ul>
-               <?php wp_register(); ?>
-               <li><?php wp_loginout(); ?></li>
-               <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-               <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('The latest comments to all posts in RSS'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-               <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
-               <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
-               <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>"><abbr title="WordPress">WP</abbr></a></li>
-               <?php wp_meta(); ?>
-       </ul>
- </li>
-<?php endif; ?>
-
-</ul>
-
-</div>
-<!-- end sidebar -->
diff --git a/wp-content/themes/classic/style.css b/wp-content/themes/classic/style.css
deleted file mode 100644 (file)
index a3b8df9..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
-Theme Name: WordPress Classic
-Theme URI: http://wordpress.org/
-Description: The original WordPress theme that graced versions 1.2.x and prior.
-Version: 1.5
-Author: Dave Shea
-Tags: mantle color, variable width, two columns, widgets
-
-Default WordPress by Dave Shea || http://mezzoblue.com
-Modifications by Matthew Mullenweg || http://photomatt.net
-This is just a basic layout, with only the bare minimum defined.
-Please tweak this and make it your own. :)
-*/
-
-.screen-reader-text {
-     position: absolute;
-     left: -1000em;
-}
-
-a {
-       color: #675;
-}
-
-a img {
-       border: none;
-}
-
-a:visited {
-       color: #342;
-}
-
-a:hover {
-       color: #9a8;
-}
-
-acronym, abbr {
-       border-bottom: 1px dashed #333;
-}
-
-acronym, abbr, span.caps {
-       font-size: 90%;
-       letter-spacing: .07em;
-}
-
-acronym, abbr {
-       cursor: help;
-}
-
-blockquote {
-       border-left: 5px solid #ccc;
-       margin-left: 1.5em;
-       padding-left: 5px;
-}
-
-body {
-       background: #fff;
-       border: 2px solid #565;
-       border-bottom: 1px solid #565;
-       border-top: 3px solid #565;
-       color: #000;
-       font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       margin: 0;
-       padding: 0;
-}
-
-cite {
-       font-size: 90%;
-       font-style: normal;
-}
-
-h2 {
-       border-bottom: 1px dotted #ccc;
-       font: 95% "Times New Roman", Times, serif;
-       letter-spacing: 0.2em;
-       margin: 15px 0 2px 0;
-       padding-bottom: 2px;
-}
-
-h3 {
-       border-bottom: 1px dotted #eee;
-       font-family: "Times New Roman", Times, serif;
-       margin-top: 0;
-}
-
-ol#comments li p {
-       font-size: 100%;
-}
-
-p, li, .feedback {
-       font: 90%/175% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       letter-spacing: -1px;
-}
-
-/* classes used by the_meta() */
-ul.post-meta {
-       list-style: none;
-}
-
-ul.post-meta span.post-meta-key {
-       font-weight: bold;
-}
-
-.credit {
-       background: #90a090;
-       border-top: 3px double #aba;
-       color: #fff;
-       font-size: 11px;
-       margin: 10px 0 0 0;
-       padding: 3px;
-       text-align: center;
-}
-
-.credit a:link, .credit a:hover {
-       color: #fff;
-}
-
-.feedback {
-       color: #ccc;
-       text-align: right;
-       clear: both;
-}
-
-.meta {
-       font-size: .75em;
-}
-
-.meta li, ul.post-meta li {
-       display: inline;
-}
-
-.meta ul {
-       display: inline;
-       list-style: none;
-       margin: 0;
-       padding: 0;
-}
-
-.meta, .meta a {
-       color: #808080;
-       font-weight: normal;
-       letter-spacing: 0;
-}
-
-.storytitle {
-       margin: 0;
-}
-
-.storytitle a {
-       text-decoration: none;
-}
-
-#commentform #author, #commentform #email, #commentform #url, #commentform textarea {
-       background: #fff;
-       border: 1px solid #333;
-       padding: .2em;
-}
-
-#commentform textarea {
-       width: 100%;
-}
-
-#commentlist li ul {
-       border-left: 1px solid #ddd;
-       font-size: 110%;
-       list-style-type: none;
-}
-
-#commentlist li .avatar {
-       float: right;
-       margin-right: 25px;
-       border: 1px dotted #ccc;
-       padding: 2px;
-}
-
-#content {
-       margin: 30px 13em 0 3em;
-       padding-right: 60px;
-}
-
-#header {
-       background: #90a090;
-       border-bottom: 3px double #aba;
-       border-left: 1px solid #9a9;
-       border-right: 1px solid #565;
-       border-top: 1px solid #9a9;
-       font: italic normal 230% 'Times New Roman', Times, serif;
-       letter-spacing: 0.2em;
-       margin: 0;
-       padding: 15px 10px 15px 60px;
-}
-
-#header a {
-       color: #fff;
-       text-decoration: none;
-}
-
-#header a:hover {
-       text-decoration: underline;
-}
-
-#menu {
-       background: #fff;
-       border-left: 1px dotted #ccc;
-       border-top: 3px solid #e0e6e0;
-       padding: 20px 0 10px 30px;
-       position: absolute;
-       right: 2px;
-       top: 0;
-       width: 11em;
-}
-
-#menu form {
-       margin: 0 0 0 13px;
-}
-
-#menu input#s {
-       width: 80%;
-       background: #eee;
-       border: 1px solid #999;
-       color: #000;
-}
-
-#menu ul {
-       color: #ccc;
-       font-weight: bold;
-       list-style-type: none;
-       margin: 0;
-       padding-left: 3px;
-       text-transform: lowercase;
-}
-
-#menu ul li {
-       font: italic normal 110% 'Times New Roman', Times, serif;
-       letter-spacing: 0.1em;
-       margin-top: 10px;
-       padding-bottom: 2px; /*border-bottom: dotted 1px #ccc;*/
-}
-
-#menu ul ul {
-       font-variant: normal;
-       font-weight: normal;
-       line-height: 100%;
-       list-style-type: none;
-       margin: 0;
-       padding: 0;
-       text-align: left;
-}
-
-#menu ul ul li {
-       border: 0;
-       font: normal normal 12px/115% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       letter-spacing: 0;
-       margin-top: 0;
-       padding: 0;
-       padding-left: 12px;
-}
-
-#menu ul ul li a {
-       color: #000;
-       text-decoration: none;
-}
-
-#menu ul ul li a:hover {
-       border-bottom: 1px solid #809080;
-}
-
-#menu ul ul ul.children {
-       font-size: 142%;
-       padding-left: 4px;
-}
-
-#wp-calendar {
-       border: 1px solid #ddd;
-       empty-cells: show;
-       font-size: 14px;
-       margin: 0;
-       width: 90%;
-}
-
-#wp-calendar #next a {
-       padding-right: 10px;
-       text-align: right;
-}
-
-#wp-calendar #prev a {
-       padding-left: 10px;
-       text-align: left;
-}
-
-#wp-calendar a {
-       display: block;
-       text-decoration: none;
-}
-
-#wp-calendar a:hover {
-       background: #e0e6e0;
-       color: #333;
-}
-
-#wp-calendar caption {
-       color: #999;
-       font-size: 16px;
-       text-align: left;
-}
-
-#wp-calendar td {
-       color: #ccc;
-       font: normal 12px 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-       letter-spacing: normal;
-       padding: 2px 0;
-       text-align: center;
-}
-
-#wp-calendar td.pad:hover {
-       background: #fff;
-}
-
-#wp-calendar td:hover, #wp-calendar #today {
-       background: #eee;
-       color: #bbb;
-}
-
-#wp-calendar th {
-       font-style: normal;
-       text-transform: capitalize;
-}
-
-/* Captions & aligment */
-.aligncenter,
-div.aligncenter {
-       display: block;
-       margin-left: auto;
-       margin-right: auto;
-}
-
-.alignleft {
-       float: left;
-}
-
-.alignright {
-       float: right;
-}
-
-.wp-caption {
-       border: 1px solid #ddd;
-       text-align: center;
-       background-color: #f3f3f3;
-       padding-top: 4px;
-       margin: 10px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-}
-
-.wp-caption img {
-       margin: 0;
-       padding: 0;
-       border: 0 none;
-}
-
-.wp-caption p.wp-caption-text {
-       font-size: 11px;
-       line-height: 17px;
-       padding: 0 4px 5px;
-       margin: 0;
-}
-/* End captions & aligment */
diff --git a/wp-content/themes/default/404.php b/wp-content/themes/default/404.php
deleted file mode 100644 (file)
index f9fee47..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header();
-?>
-
-       <div id="content" class="narrowcolumn">
-
-               <h2 class="center">Error 404 - Not Found</h2>
-
-       </div>
-
-<?php get_sidebar(); ?>
-
-<?php get_footer(); ?>
\ No newline at end of file
diff --git a/wp-content/themes/default/archive.php b/wp-content/themes/default/archive.php
deleted file mode 100644 (file)
index 70c2a8c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header();
-?>
-
-       <div id="content" class="narrowcolumn" role="main">
-
-               <?php if (have_posts()) : ?>
-
-         <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
-         <?php /* If this is a category archive */ if (is_category()) { ?>
-               <h2 class="pagetitle">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2>
-         <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
-               <h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
-         <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
-               <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
-         <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
-               <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
-         <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
-               <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
-         <?php /* If this is an author archive */ } elseif (is_author()) { ?>
-               <h2 class="pagetitle">Author Archive</h2>
-         <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
-               <h2 class="pagetitle">Blog Archives</h2>
-         <?php } ?>
-
-
-               <div class="navigation">
-                       <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
-                       <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
-               </div>
-
-               <?php while (have_posts()) : the_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>
-
-                               <div class="entry">
-                                       <?php the_content() ?>
-                               </div>
-
-                               <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
-
-                       </div>
-
-               <?php endwhile; ?>
-
-               <div class="navigation">
-                       <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 :
-
-               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>
-
-<?php get_sidebar(); ?>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/archives.php b/wp-content/themes/default/archives.php
deleted file mode 100644 (file)
index 2042805..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-/*
-Template Name: Archives
-*/
-?>
-
-<?php get_header(); ?>
-
-<div id="content" class="widecolumn">
-
-<?php get_search_form(); ?>
-
-<h2>Archives by Month:</h2>
-       <ul>
-               <?php wp_get_archives('type=monthly'); ?>
-       </ul>
-
-<h2>Archives by Subject:</h2>
-       <ul>
-                <?php wp_list_categories(); ?>
-       </ul>
-
-</div>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/comments-popup.php b/wp-content/themes/default/comments-popup.php
deleted file mode 100644 (file)
index 49fe744..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?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">
-<head>
-     <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title>
-
-       <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-       <style type="text/css" media="screen">
-               @import url( <?php bloginfo('stylesheet_url'); ?> );
-               body { margin: 3px; }
-       </style>
-
-</head>
-<body id="commentspopup">
-
-<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>
-
-<?php if ( pings_open() ) { ?>
-<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
-<?php } ?>
-
-<?php
-// this line is WordPress' motor, do not delete it.
-$commenter = wp_get_current_commenter();
-extract($commenter);
-$comments = get_approved_comments($id);
-$post = get_post($id);
-if ( post_password_required($post) ) {  // and it doesn't match the cookie
-       echo(get_the_password_form());
-} else { ?>
-
-<?php if ($comments) { ?>
-<ol id="commentlist">
-<?php foreach ($comments as $comment) { ?>
-       <li id="comment-<?php comment_ID() ?>">
-       <?php comment_text() ?>
-       <p><cite><?php comment_type('Comment', 'Trackback', 'Pingback'); ?> 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 ?>
-</ol>
-<?php } else { // this is displayed if there are no comments so far ?>
-       <p>No comments yet.</p>
-<?php } ?>
-
-<?php if ( comments_open() ) { ?>
-<h2>Leave a comment</h2>
-<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
-
-<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 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 esc_attr($comment_author); ?>" size="28" tabindex="1" />
-          <label for="author">Name</label>
-       </p>
-
-       <p>
-         <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="28" tabindex="2" />
-          <label for="email">E-mail</label>
-       </p>
-
-       <p>
-         <input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="28" tabindex="3" />
-          <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label>
-       </p>
-<?php endif; ?>
-
-       <p>
-         <label for="comment">Your Comment</label>
-       <br />
-         <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
-       </p>
-
-       <p>
-      <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
-         <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
-         <input name="submit" type="submit" tabindex="5" value="Say It!" />
-       </p>
-       <?php do_action('comment_form', $post->ID); ?>
-</form>
-<?php } else { // comments are closed ?>
-<p>Sorry, the comment form is closed at this time.</p>
-<?php }
-} // end password check
-?>
-
-<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 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>
-<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
-<script type="text/javascript">
-<!--
-document.onkeypress = function esc(e) {
-       if(typeof(e) == "undefined") { e=event; }
-       if (e.keyCode == 27) { self.close(); }
-}
-// -->
-</script>
-</body>
-</html>
diff --git a/wp-content/themes/default/footer.php b/wp-content/themes/default/footer.php
deleted file mode 100644 (file)
index 02f6d19..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-?>
-
-<hr />
-<div id="footer" role="contentinfo">
-<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
-       <p>
-               <?php bloginfo('name'); ?> is proudly powered by
-               <a href="http://wordpress.org/">WordPress</a>
-               <br /><a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a>
-               and <a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.
-               <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. -->
-       </p>
-</div>
-</div>
-
-<!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ -->
-<?php /* "Just what do you think you're doing Dave?" */ ?>
-
-               <?php wp_footer(); ?>
-</body>
-</html>
diff --git a/wp-content/themes/default/functions.php b/wp-content/themes/default/functions.php
deleted file mode 100644 (file)
index 072ab66..0000000
+++ /dev/null
@@ -1,433 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-$content_width = 450;
-
-automatic_feed_links();
-
-if ( function_exists('register_sidebar') ) {
-       register_sidebar(array(
-               'before_widget' => '<li id="%1$s" class="widget %2$s">',
-               'after_widget' => '</li>',
-               'before_title' => '<h2 class="widgettitle">',
-               'after_title' => '</h2>',
-       ));
-}
-
-/** @ignore */
-function kubrick_head() {
-       $head = "<style type='text/css'>\n<!--";
-       $output = '';
-       if ( kubrick_header_image() ) {
-               $url =  kubrick_header_image_url() ;
-               $output .= "#header { background: url('$url') no-repeat bottom center; }\n";
-       }
-       if ( false !== ( $color = kubrick_header_color() ) ) {
-               $output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
-       }
-       if ( false !== ( $display = kubrick_header_display() ) ) {
-               $output .= "#headerimg { display: $display }\n";
-       }
-       $foot = "--></style>\n";
-       if ( '' != $output )
-               echo $head . $output . $foot;
-}
-
-add_action('wp_head', 'kubrick_head');
-
-function kubrick_header_image() {
-       return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
-}
-
-function kubrick_upper_color() {
-       if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
-               parse_str(substr($url, strpos($url, '?') + 1), $q);
-               return $q['upper'];
-       } else
-               return '69aee7';
-}
-
-function kubrick_lower_color() {
-       if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
-               parse_str(substr($url, strpos($url, '?') + 1), $q);
-               return $q['lower'];
-       } else
-               return '4180b6';
-}
-
-function kubrick_header_image_url() {
-       if ( $image = kubrick_header_image() )
-               $url = get_template_directory_uri() . '/images/' . $image;
-       else
-               $url = get_template_directory_uri() . '/images/kubrickheader.jpg';
-
-       return $url;
-}
-
-function kubrick_header_color() {
-       return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
-}
-
-function kubrick_header_color_string() {
-       $color = kubrick_header_color();
-       if ( false === $color )
-               return 'white';
-
-       return $color;
-}
-
-function kubrick_header_display() {
-       return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
-}
-
-function kubrick_header_display_string() {
-       $display = kubrick_header_display();
-       return $display ? $display : 'inline';
-}
-
-add_action('admin_menu', 'kubrick_add_theme_page');
-
-function kubrick_add_theme_page() {
-       if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
-               if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
-                       check_admin_referer('kubrick-header');
-                       if ( isset($_REQUEST['njform']) ) {
-                               if ( isset($_REQUEST['defaults']) ) {
-                                       delete_option('kubrick_header_image');
-                                       delete_option('kubrick_header_color');
-                                       delete_option('kubrick_header_display');
-                               } else {
-                                       if ( '' == $_REQUEST['njfontcolor'] )
-                                               delete_option('kubrick_header_color');
-                                       else {
-                                               $fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
-                                               update_option('kubrick_header_color', $fontcolor);
-                                       }
-                                       if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
-                                               $uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
-                                               $lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
-                                               update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
-                                       }
-
-                                       if ( isset($_REQUEST['toggledisplay']) ) {
-                                               if ( false === get_option('kubrick_header_display') )
-                                                       update_option('kubrick_header_display', 'none');
-                                               else
-                                                       delete_option('kubrick_header_display');
-                                       }
-                               }
-                       } else {
-
-                               if ( isset($_REQUEST['headerimage']) ) {
-                                       check_admin_referer('kubrick-header');
-                                       if ( '' == $_REQUEST['headerimage'] )
-                                               delete_option('kubrick_header_image');
-                                       else {
-                                               $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']);
-                                               update_option('kubrick_header_image', $headerimage);
-                                       }
-                               }
-
-                               if ( isset($_REQUEST['fontcolor']) ) {
-                                       check_admin_referer('kubrick-header');
-                                       if ( '' == $_REQUEST['fontcolor'] )
-                                               delete_option('kubrick_header_color');
-                                       else {
-                                               $fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
-                                               update_option('kubrick_header_color', $fontcolor);
-                                       }
-                               }
-
-                               if ( isset($_REQUEST['fontdisplay']) ) {
-                                       check_admin_referer('kubrick-header');
-                                       if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
-                                               delete_option('kubrick_header_display');
-                                       else
-                                               update_option('kubrick_header_display', 'none');
-                               }
-                       }
-                       //print_r($_REQUEST);
-                       wp_redirect("themes.php?page=functions.php&saved=true");
-                       die;
-               }
-               add_action('admin_head', 'kubrick_theme_page_head');
-       }
-       add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
-}
-
-function kubrick_theme_page_head() {
-?>
-<script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
-<script type='text/javascript'>
-// <![CDATA[
-       function pickColor(color) {
-               ColorPicker_targetInput.value = color;
-               kUpdate(ColorPicker_targetInput.id);
-       }
-       function PopupWindow_populate(contents) {
-               contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" class="button-secondary" value="<?php esc_attr_e('Close Color Picker'); ?>" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
-               this.contents = contents;
-               this.populated = false;
-       }
-       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);
-               }
-       }
-       function PopupWindow_setSize(width,height) {
-               this.width = 162;
-               this.height = 210;
-       }
-
-       var cp = new ColorPicker();
-       function advUpdate(val, obj) {
-               document.getElementById(obj).value = val;
-               kUpdate(obj);
-       }
-       function kUpdate(oid) {
-               if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
-                       uc = document.getElementById('uppercolor').value.replace('#', '');
-                       lc = document.getElementById('lowercolor').value.replace('#', '');
-                       hi = document.getElementById('headerimage');
-                       hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
-                       document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
-                       document.getElementById('advuppercolor').value = '#'+uc;
-                       document.getElementById('advlowercolor').value = '#'+lc;
-               }
-               if ( 'fontcolor' == oid ) {
-                       document.getElementById('header').style.color = document.getElementById('fontcolor').value;
-                       document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
-               }
-               if ( 'fontdisplay' == oid ) {
-                       document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
-               }
-       }
-       function toggleDisplay() {
-               td = document.getElementById('fontdisplay');
-               td.value = ( td.value == 'none' ) ? 'inline' : 'none';
-               kUpdate('fontdisplay');
-       }
-       function toggleAdvanced() {
-               a = document.getElementById('jsAdvanced');
-               if ( a.style.display == 'none' )
-                       a.style.display = 'block';
-               else
-                       a.style.display = 'none';
-       }
-       function kDefaults() {
-               document.getElementById('headerimage').value = '';
-               document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
-               document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
-               document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
-               document.getElementById('header').style.color = '#FFFFFF';
-               document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
-               document.getElementById('fontdisplay').value = 'inline';
-               document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
-       }
-       function kRevert() {
-               document.getElementById('headerimage').value = '<?php echo esc_js(kubrick_header_image()); ?>';
-               document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo esc_js(kubrick_upper_color()); ?>';
-               document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo esc_js(kubrick_lower_color()); ?>';
-               document.getElementById('header').style.background = 'url("<?php echo esc_js(kubrick_header_image_url()); ?>") center no-repeat';
-               document.getElementById('header').style.color = '';
-               document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo esc_js(kubrick_header_color_string()); ?>';
-               document.getElementById('fontdisplay').value = '<?php echo esc_js(kubrick_header_display_string()); ?>';
-               document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
-       }
-       function kInit() {
-               document.getElementById('jsForm').style.display = 'block';
-               document.getElementById('nonJsForm').style.display = 'none';
-       }
-       addLoadEvent(kInit);
-// ]]>
-</script>
-<style type='text/css'>
-       #headwrap {
-               text-align: center;
-       }
-       #kubrick-header {
-               font-size: 80%;
-       }
-       #kubrick-header .hibrowser {
-               width: 780px;
-               height: 260px;
-               overflow: scroll;
-       }
-       #kubrick-header #hitarget {
-               display: none;
-       }
-       #kubrick-header #header h1 {
-               font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
-               font-weight: bold;
-               font-size: 4em;
-               text-align: center;
-               padding-top: 70px;
-               margin: 0;
-       }
-
-       #kubrick-header #header .description {
-               font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
-               font-size: 1.2em;
-               text-align: center;
-       }
-       #kubrick-header #header {
-               text-decoration: none;
-               color: <?php echo kubrick_header_color_string(); ?>;
-               padding: 0;
-               margin: 0;
-               height: 200px;
-               text-align: center;
-               background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
-       }
-       #kubrick-header #headerimg {
-               margin: 0;
-               height: 200px;
-               width: 100%;
-               display: <?php echo kubrick_header_display_string(); ?>;
-       }
-       
-       .description {
-               margin-top: 16px;
-               color: #fff;
-       }
-
-       #jsForm {
-               display: none;
-               text-align: center;
-       }
-       #jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
-               padding: 0px;
-               margin: 0px;
-       }
-       #advanced {
-               text-align: center;
-               width: 620px;
-       }
-       html>body #advanced {
-               text-align: center;
-               position: relative;
-               left: 50%;
-               margin-left: -380px;
-       }
-       #jsAdvanced {
-               text-align: right;
-       }
-       #nonJsForm {
-               position: relative;
-               text-align: left;
-               margin-left: -370px;
-               left: 50%;
-       }
-       #nonJsForm label {
-               padding-top: 6px;
-               padding-right: 5px;
-               float: left;
-               width: 100px;
-               text-align: right;
-       }
-       .defbutton {
-               font-weight: bold;
-       }
-       .zerosize {
-               width: 0px;
-               height: 0px;
-               overflow: hidden;
-       }
-       #colorPickerDiv a, #colorPickerDiv a:hover {
-               padding: 1px;
-               text-decoration: none;
-               border-bottom: 0px;
-       }
-</style>
-<?php
-}
-
-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'>
-       <h2><?php _e('Customize Header'); ?></h2>
-       <div id="kubrick-header">
-               <div id="headwrap">
-                       <div id="header">
-                               <div id="headerimg">
-                                       <h1><?php bloginfo('name'); ?></h1>
-                                       <div class="description"><?php bloginfo('description'); ?></div>
-                               </div>
-                       </div>
-               </div>
-               <br />
-               <div id="nonJsForm">
-                       <form method="post" action="">
-                               <?php wp_nonce_field('kubrick-header'); ?>
-                               <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php esc_attr_e('Save'); ?>" /></div>
-                                       <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br />
-                                       <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
-                               <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
-                               <input type="hidden" name="hi" id="hi" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
-                               <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php esc_attr_e('Toggle Text'); ?>" />
-                               <input type="submit" name="defaults" value="<?php esc_attr_e('Use Defaults'); ?>" />
-                               <input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;<?php esc_attr_e('Save'); ?>&nbsp;&nbsp;" />
-                               <input type="hidden" name="action" value="save" />
-                               <input type="hidden" name="njform" value="true" />
-                       </form>
-               </div>
-               <div id="jsForm">
-                       <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo esc_attr($_SERVER['REQUEST_URI']); ?>">
-                               <?php wp_nonce_field('kubrick-header'); ?>
-       <input type="button"  class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php esc_attr_e('Font Color'); ?>"></input>
-               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php esc_attr_e('Upper Color'); ?>"></input>
-               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php esc_attr_e('Lower Color'); ?>"></input>
-                               <input type="button" class="button-secondary" name="revert" value="<?php esc_attr_e('Revert'); ?>" onclick="kRevert()" />
-                               <input type="button" class="button-secondary" value="<?php esc_attr_e('Advanced'); ?>" onclick="toggleAdvanced()" />
-                               <input type="hidden" name="action" value="save" />
-                               <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo esc_attr(kubrick_header_display()); ?>" />
-                               <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" />
-                               <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo esc_attr(kubrick_upper_color()); ?>" />
-                               <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo esc_attr(kubrick_lower_color()); ?>" />
-                               <input type="hidden" name="headerimage" id="headerimage" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
-                               <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php esc_attr_e('Update Header'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
-                       </form>
-                       <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
-                       <div id="advanced">
-                               <form id="jsAdvanced" style="display:none;" action="">
-                                       <?php wp_nonce_field('kubrick-header'); ?>
-                                       <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo esc_attr(kubrick_header_color()); ?>" /><br />
-                                       <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /><br />
-                                       <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /><br />
-                                       <input type="button" class="button-secondary" name="default" value="<?php esc_attr_e('Select Default Colors'); ?>" onclick="kDefaults()" /><br />
-                                       <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php esc_attr_e('Toggle Text Display'); ?>"></input><br />
-                               </form>
-                       </div>
-               </div>
-       </div>
-</div>
-<?php } ?>
diff --git a/wp-content/themes/default/image.php b/wp-content/themes/default/image.php
deleted file mode 100644 (file)
index 4312630..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header();
-?>
-
-       <div id="content" class="widecolumn">
-
-  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
-               <div class="post" id="post-<?php the_ID(); ?>">
-                       <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>
-
-                               <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
-
-                               <div class="navigation">
-                                       <div class="alignleft"><?php previous_image_link() ?></div>
-                                       <div class="alignright"><?php next_image_link() ?></div>
-                               </div>
-                               <br class="clear" />
-
-                               <p class="postmetadata alt">
-                                       <small>
-                                               This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
-                                               and is filed under <?php the_category(', ') ?>.
-                                               <?php the_taxonomies(); ?>
-                                               You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
-
-                                               <?php if ( comments_open() && pings_open() ) {
-                                                       // Both Comments and Pings are open ?>
-                                                       You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
-
-                                               <?php } elseif ( !comments_open() && pings_open() ) {
-                                                       // Only Pings are Open ?>
-                                                       Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
-
-                                               <?php } elseif ( comments_open() && !pings_open() ) {
-                                                       // Comments are open, Pings are not ?>
-                                                       You can skip to the end and leave a response. Pinging is currently not allowed.
-
-                                               <?php } elseif ( !comments_open() && !pings_open() ) {
-                                                       // Neither Comments, nor Pings are open ?>
-                                                       Both comments and pings are currently closed.
-
-                                               <?php } edit_post_link('Edit this entry.','',''); ?>
-
-                                       </small>
-                               </p>
-
-                       </div>
-
-               </div>
-
-       <?php comments_template(); ?>
-
-       <?php endwhile; else: ?>
-
-               <p>Sorry, no attachments matched your criteria.</p>
-
-<?php endif; ?>
-
-       </div>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/images/audio.jpg b/wp-content/themes/default/images/audio.jpg
deleted file mode 100644 (file)
index b02e1c8..0000000
Binary files a/wp-content/themes/default/images/audio.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/header-img.php b/wp-content/themes/default/images/header-img.php
deleted file mode 100644 (file)
index 50bd3c3..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-/** @ignore */
-$img = 'kubrickheader.jpg';
-
-// If we don't have image processing support, redirect.
-if ( ! function_exists('imagecreatefromjpeg') )
-       die(header("Location: kubrickheader.jpg"));
-
-// Assign and validate the color values
-$default = false;
-$vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2'));
-foreach ( $vars as $var => $subvars ) {
-       if ( isset($_GET[$var]) ) {
-               foreach ( $subvars as $index => $subvar ) {
-                       $length = strlen($_GET[$var]) / 3;
-                       $v = substr($_GET[$var], $index * $length, $length);
-                       if ( $length == 1 ) $v = '' . $v . $v;
-                       $$subvar = hexdec( $v );
-                       if ( $$subvar < 0 || $$subvar > 255 )
-                               $default = true;
-               }
-       } else {
-               $default = true;
-       }
-}
-
-if ( $default )
-       list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );
-
-// Create the image
-$im = imagecreatefromjpeg($img);
-
-// Get the background color, define the rectangle height
-$white = imagecolorat( $im, 15, 15 );
-$h = 182;
-
-// Define the boundaries of the rounded edges ( y => array ( x1, x2 ) )
-$corners = array(
-       0 => array ( 25, 734 ),
-       1 => array ( 23, 736 ),
-       2 => array ( 22, 737 ),
-       3 => array ( 21, 738 ),
-       4 => array ( 21, 738 ),
-       177 => array ( 21, 738 ),
-       178 => array ( 21, 738 ),
-       179 => array ( 22, 737 ),
-       180 => array ( 23, 736 ),
-       181 => array ( 25, 734 ),
-       );
-
-// Blank out the blue thing
-for ( $i = 0; $i < $h; $i++ ) {
-       $x1 = 19;
-       $x2 = 740;
-       imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
-}
-
-// Draw a new color thing
-for ( $i = 0; $i < $h; $i++ ) {
-       $x1 = 20;
-       $x2 = 739;
-       $r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1;
-       $g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1;
-       $b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1;
-       $color = imagecolorallocate( $im, $r, $g, $b );
-       if ( array_key_exists($i, $corners) ) {
-               imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
-               list ( $x1, $x2 ) = $corners[$i];
-       }
-       imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color );
-}
-
-//die;
-header("Content-Type: image/jpeg");
-imagejpeg($im, '', 92);
-imagedestroy($im);
-?>
diff --git a/wp-content/themes/default/images/kubrickbg-ltr.jpg b/wp-content/themes/default/images/kubrickbg-ltr.jpg
deleted file mode 100644 (file)
index dc74fb8..0000000
Binary files a/wp-content/themes/default/images/kubrickbg-ltr.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/kubrickbg-rtl.jpg b/wp-content/themes/default/images/kubrickbg-rtl.jpg
deleted file mode 100644 (file)
index 2e9e237..0000000
Binary files a/wp-content/themes/default/images/kubrickbg-rtl.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/kubrickbgcolor.jpg b/wp-content/themes/default/images/kubrickbgcolor.jpg
deleted file mode 100644 (file)
index 4653b68..0000000
Binary files a/wp-content/themes/default/images/kubrickbgcolor.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/kubrickbgwide.jpg b/wp-content/themes/default/images/kubrickbgwide.jpg
deleted file mode 100644 (file)
index 77096f2..0000000
Binary files a/wp-content/themes/default/images/kubrickbgwide.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/kubrickfooter.jpg b/wp-content/themes/default/images/kubrickfooter.jpg
deleted file mode 100644 (file)
index d7a4c65..0000000
Binary files a/wp-content/themes/default/images/kubrickfooter.jpg and /dev/null differ
diff --git a/wp-content/themes/default/images/kubrickheader.jpg b/wp-content/themes/default/images/kubrickheader.jpg
deleted file mode 100644 (file)
index 69441ee..0000000
Binary files a/wp-content/themes/default/images/kubrickheader.jpg and /dev/null differ
diff --git a/wp-content/themes/default/index.php b/wp-content/themes/default/index.php
deleted file mode 100644 (file)
index ae5bf80..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header(); ?>
-
-       <div id="content" class="narrowcolumn" role="main">
-
-       <?php if (have_posts()) : ?>
-
-               <?php while (have_posts()) : the_post(); ?>
-
-                       <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>
-
-                               <div class="entry">
-                                       <?php the_content('Read the rest of this entry &raquo;'); ?>
-                               </div>
-
-                               <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
-                       </div>
-
-               <?php endwhile; ?>
-
-               <div class="navigation">
-                       <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>
-               <p class="center">Sorry, but you are looking for something that isn't here.</p>
-               <?php get_search_form(); ?>
-
-       <?php endif; ?>
-
-       </div>
-
-<?php get_sidebar(); ?>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/links.php b/wp-content/themes/default/links.php
deleted file mode 100644 (file)
index 81fdc00..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-/*
-Template Name: Links
-*/
-?>
-
-<?php get_header(); ?>
-
-<div id="content" class="widecolumn">
-
-<h2>Links:</h2>
-<ul>
-<?php wp_list_bookmarks(); ?>
-</ul>
-
-</div>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/page.php b/wp-content/themes/default/page.php
deleted file mode 100644 (file)
index 87b3dd5..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header(); ?>
-
-       <div id="content" class="narrowcolumn" role="main">
-
-               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-               <div class="post" id="post-<?php the_ID(); ?>">
-               <h2><?php the_title(); ?></h2>
-                       <div class="entry">
-                               <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
-
-                               <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
-
-                       </div>
-               </div>
-               <?php endwhile; endif; ?>
-       <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
-       
-       <?php comments_template(); ?>
-       
-       </div>
-
-<?php get_sidebar(); ?>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/rtl.css b/wp-content/themes/default/rtl.css
deleted file mode 100644 (file)
index 0583b52..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-Theme name: WordPress Default - kubrick -
-Editors: Navid Kashani
-Persian WordPress Project : wp-persian.com
-*/
-body, .commentlist li, #commentform input, #commentform textarea, #commentform p, #sidebar, #wp-calendar caption  {
-       font-family:tahoma, arial;
-}
-#page {
-       text-align:right;
-       direction:rtl;
-}
-h1, h2, h3, #sidebar h2 {
-       font-family:arial, tahoma;
-}
-.commentlist li .avatar {
-       float:left;
-}
-
-.commentlist li {
-       padding: 5px 10px 10px 5px;
-       }
-.commentlist li ul li { 
-       margin-left: -5px;
-       margin-right: 10px;
-}
-
-.commentlist p {
-       margin: 10px 0 10px 5px;
-}
-#header {
-       margin:0 1px 0 0;
-}
-.narrowcolumn {
-       float:right;
-       padding: 0 45px 20px 0;
-}
-.widecolumn {
-       margin: 5px 150px 0 0;
-}
-.widecolumn .smallattachment {
-       margin: 5px 0 5px 5px;
-}
-.postmetadata {
-       clear:right;
-}
-#sidebar {
-       margin-left: 0;
-       margin-right: 545px;
-}
-img.alignright {
-       margin: 0 7px 2px 0;
-}
-
-img.alignleft {
-       margin: 0 0 2px 7px;
-}
-
-.alignright {
-       float: left;
-}
-
-.alignleft {
-       float: right;
-}
-code {
-       display:block;
-       direction:ltr;
-       text-align:left;
-}
-acronym, abbr, span.caps {
-       letter-spacing:0; /* fix opera bug */
-}
-html>body .entry ul {
-       padding:0 10px 0 0;
-       text-indent:10px;
-}
-html>body .entry li {
-       margin: 7px 10px 8px 0;
-}
-.entry ol {
-       padding: 0 35px 0 0;
-}
-#sidebar ul ul, #sidebar ul ol {
-       margin: 5px 10px 0 0;
-}
-#sidebar ul ul ul, #sidebar ul ol {
-       margin: 0 10px 0 0;
-}
-#commentform {
-       margin: 5px 0 0 10px;
-       }
-#commentform input {
-       margin: 5px 0 1px 5px;
-}
-#commentform #submit {
-       float:left;
-}
-.commentlist p {
-       margin: 10px 0 10px 5px;
-}
-
-.children .even, .alt {
-       border-left: 0;
-       border-right: 1px solid #ddd;
-}
-
-#wp-calendar #next a {
-       padding-right:0;
-       padding-left:10px;
-       text-align:left;
-}
-#wp-calendar #prev a {
-       padding-left:0;
-       padding-right:10px;
-       text-align:right;
-}
-blockquote {
-       margin: 15px 10px 0 30px;
-       padding-left: 0;
-       padding-right: 20px;
-       border-left: 0 none;
-       border-right: 5px solid #ddd;
-}
-#email, #url {
-       direction:ltr;
-}
\ No newline at end of file
diff --git a/wp-content/themes/default/screenshot.png b/wp-content/themes/default/screenshot.png
deleted file mode 100644 (file)
index e0b1d48..0000000
Binary files a/wp-content/themes/default/screenshot.png and /dev/null differ
diff --git a/wp-content/themes/default/search.php b/wp-content/themes/default/search.php
deleted file mode 100644 (file)
index 4e7ad6d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header(); ?>
-
-       <div id="content" class="narrowcolumn" role="main">
-
-       <?php if (have_posts()) : ?>
-
-               <h2 class="pagetitle">Search Results</h2>
-
-               <div class="navigation">
-                       <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
-                       <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
-               </div>
-
-
-               <?php while (have_posts()) : the_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>
-
-                               <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
-                       </div>
-
-               <?php endwhile; ?>
-
-               <div class="navigation">
-                       <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">No posts found. Try a different search?</h2>
-               <?php get_search_form(); ?>
-
-       <?php endif; ?>
-
-       </div>
-
-<?php get_sidebar(); ?>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/sidebar.php b/wp-content/themes/default/sidebar.php
deleted file mode 100644 (file)
index e38b0be..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-?>
-       <div id="sidebar" role="complementary">
-               <ul>
-                       <?php   /* Widgetized sidebar, if you have the plugin installed. */
-                                       if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
-                       <li>
-                               <?php get_search_form(); ?>
-                       </li>
-
-                       <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
-                       <li><h2>Author</h2>
-                       <p>A little something about you, the author. Nothing lengthy, just an overview.</p>
-                       </li>
-                       -->
-
-                       <?php if ( is_404() || is_category() || is_day() || is_month() ||
-                                               is_year() || is_search() || is_paged() ) {
-                       ?> <li>
-
-                       <?php /* If this is a 404 page */ if (is_404()) { ?>
-                       <?php /* If this is a category archive */ } elseif (is_category()) { ?>
-                       <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
-
-                       <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
-                       <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
-                       for the day <?php the_time('l, F jS, Y'); ?>.</p>
-
-                       <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
-                       <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
-                       for <?php the_time('F, Y'); ?>.</p>
-
-                       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
-                       <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
-                       for the year <?php the_time('Y'); ?>.</p>
-
-                       <?php /* If this is a search result */ } elseif (is_search()) { ?>
-                       <p>You have searched the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives
-                       for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
-
-                       <?php /* If this set is paginated */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
-                       <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a> blog archives.</p>
-
-                       <?php } ?>
-
-                       </li>
-               <?php }?>
-               </ul>
-               <ul role="navigation">
-                       <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
-
-                       <li><h2>Archives</h2>
-                               <ul>
-                               <?php wp_get_archives('type=monthly'); ?>
-                               </ul>
-                       </li>
-
-                       <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
-               </ul>
-               <ul>
-                       <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
-                               <?php wp_list_bookmarks(); ?>
-
-                               <li><h2>Meta</h2>
-                               <ul>
-                                       <?php wp_register(); ?>
-                                       <li><?php wp_loginout(); ?></li>
-                                       <li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
-                                       <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
-                                       <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
-                                       <?php wp_meta(); ?>
-                               </ul>
-                               </li>
-                       <?php } ?>
-
-                       <?php endif; ?>
-               </ul>
-       </div>
-
diff --git a/wp-content/themes/default/single.php b/wp-content/themes/default/single.php
deleted file mode 100644 (file)
index c9cb4d8..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/**
- * @package WordPress
- * @subpackage Default_Theme
- */
-
-get_header();
-?>
-
-       <div id="content" class="widecolumn" role="main">
-
-       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
-               <div class="navigation">
-                       <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
-                       <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
-               </div>
-
-               <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
-                       <h2><?php the_title(); ?></h2>
-
-                       <div class="entry">
-                               <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
-
-                               <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
-                               <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
-
-                               <p class="postmetadata alt">
-                                       <small>
-                                               This entry was posted
-                                               <?php /* This is commented, because it requires a little adjusting sometimes.
-                                                       You'll need to download this plugin, and follow the instructions:
-                                                       http://binarybonsai.com/wordpress/time-since/ */
-                                                       /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
-                                               on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
-                                               and is filed under <?php the_category(', ') ?>.
-                                               You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
-
-                                               <?php if ( comments_open() && pings_open() ) {
-                                                       // Both Comments and Pings are open ?>
-                                                       You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
-
-                                               <?php } elseif ( !comments_open() && pings_open() ) {
-                                                       // Only Pings are Open ?>
-                                                       Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
-
-                                               <?php } elseif ( comments_open() && !pings_open() ) {
-                                                       // Comments are open, Pings are not ?>
-                                                       You can skip to the end and leave a response. Pinging is currently not allowed.
-
-                                               <?php } elseif ( !comments_open() && !pings_open() ) {
-                                                       // Neither Comments, nor Pings are open ?>
-                                                       Both comments and pings are currently closed.
-
-                                               <?php } edit_post_link('Edit this entry','','.'); ?>
-
-                                       </small>
-                               </p>
-
-                       </div>
-               </div>
-
-       <?php comments_template(); ?>
-
-       <?php endwhile; else: ?>
-
-               <p>Sorry, no posts matched your criteria.</p>
-
-<?php endif; ?>
-
-       </div>
-
-<?php get_footer(); ?>
diff --git a/wp-content/themes/default/style.css b/wp-content/themes/default/style.css
deleted file mode 100644 (file)
index d64c5e7..0000000
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
-Theme Name: WordPress Default
-Theme URI: http://wordpress.org/
-Description: The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.
-Version: 1.6
-Author: Michael Heilemann
-Author URI: http://binarybonsai.com/
-Tags: blue, custom header, fixed width, two columns, widgets
-
-       Kubrick v1.5
-        http://binarybonsai.com/kubrick/
-
-       This theme was designed and built by Michael Heilemann,
-       whose blog you will find at http://binarybonsai.com/
-
-       The CSS, XHTML and design is released under GPL:
-       http://www.opensource.org/licenses/gpl-license.php
-
-*/
-
-
-
-/* Begin Typography & Colors */
-body {
-       font-size: 62.5%; /* Resets 1em to 10px */
-       font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       background: #d5d6d7 url('images/kubrickbgcolor.jpg');
-       color: #333;
-       text-align: center;
-       }
-
-#page {
-       background-color: white;
-       border: 1px solid #959596;
-       text-align: left;
-       }
-
-#header {
-       background: #73a0c5 url('images/kubrickheader.jpg') no-repeat bottom center;
-       }
-
-#headerimg     {
-       margin: 7px 9px 0;
-       height: 192px;
-       width: 740px;
-       }
-
-#content {
-       font-size: 1.2em;
-       }
-
-.widecolumn .entry p {
-       font-size: 1.05em;
-       }
-
-.narrowcolumn .entry, .widecolumn .entry {
-       line-height: 1.4em;
-       }
-
-.widecolumn {
-       line-height: 1.6em;
-       }
-
-.narrowcolumn .postmetadata {
-       text-align: center;
-       }
-
-.thread-alt {
-       background-color: #f8f8f8;
-}
-.thread-even {
-       background-color: white;
-}
-.depth-1 {
-border: 1px solid #ddd;
-}
-
-.even, .alt {
-
-       border-left: 1px solid #ddd;
-}
-
-#footer {
-       background: #e7e7e7 url('images/kubrickfooter.jpg') no-repeat top;
-       border: none;
-       }
-
-small {
-       font-family: Arial, Helvetica, Sans-Serif;
-       font-size: 0.9em;
-       line-height: 1.5em;
-       }
-
-h1, h2, h3 {
-       font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       font-weight: bold;
-       }
-
-h1 {
-       font-size: 4em;
-       text-align: center;
-       }
-
-#headerimg .description {
-       font-size: 1.2em;
-       text-align: center;
-       }
-
-h2 {
-       font-size: 1.6em;
-       }
-
-h2.pagetitle {
-       font-size: 1.6em;
-       }
-
-#sidebar h2 {
-       font-family: 'Lucida Grande', Verdana, Sans-Serif;
-       font-size: 1.2em;
-       }
-
-h3 {
-       font-size: 1.3em;
-       }
-
-h1, h1 a, h1 a:hover, h1 a:visited, #headerimg .description {
-       text-decoration: none;
-       color: white;
-       }
-
-h2, h2 a, h2 a:visited, h3, h3 a, h3 a:visited {
-       color: #333;
-       }
-
-h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar h2, #wp-calendar caption, cite {
-       text-decoration: none;
-       }
-
-.entry p a:visited {
-       color: #b85b5a;
-       }
-
-.sticky {
-       background: #f7f7f7;
-       padding: 0 10px 10px;
-       }
-.sticky h2 {
-       padding-top: 10px;
-       }
-
-.commentlist li, #commentform input, #commentform textarea {
-       font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       }
-.commentlist li ul li {
-       font-size: 1em;
-}
-
-.commentlist li {
-       font-weight: bold;
-}
-
-.commentlist li .avatar { 
-       float: right;
-       border: 1px solid #eee;
-       padding: 2px;
-       background: #fff;
-       }
-
-.commentlist cite, .commentlist cite a {
-       font-weight: bold;
-       font-style: normal;
-       font-size: 1.1em;
-       }
-
-.commentlist p {
-       font-weight: normal;
-       line-height: 1.5em;
-       text-transform: none;
-       }
-
-#commentform p {
-       font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       }
-
-.commentmetadata {
-       font-weight: normal;
-       }
-
-#sidebar {
-       font: 1em 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       }
-
-small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
-       color: #777;
-       }
-
-code {
-       font: 1.1em 'Courier New', Courier, Fixed;
-       }
-
-acronym, abbr, span.caps
-{
-       font-size: 0.9em;
-       letter-spacing: .07em;
-       }
-
-a, h2 a:hover, h3 a:hover {
-       color: #06c;
-       text-decoration: none;
-       }
-
-a:hover {
-       color: #147;
-       text-decoration: underline;
-       }
-
-#wp-calendar #prev a, #wp-calendar #next a {
-       font-size: 9pt;
-       }
-
-#wp-calendar a {
-       text-decoration: none;
-       }
-
-#wp-calendar caption {
-       font: bold 1.3em 'Lucida Grande', Verdana, Arial, Sans-Serif;
-       text-align: center;
-       }
-
-#wp-calendar th {
-       font-style: normal;
-       text-transform: capitalize;
-       }
-/* End Typography & Colors */
-
-
-
-/* Begin Structure */
-body {
-       margin: 0 0 20px 0;
-       padding: 0;
-       }
-
-#page {
-       background-color: white;
-       margin: 20px auto;
-       padding: 0;
-       width: 760px;
-       border: 1px solid #959596;
-       }
-
-#header {
-       background-color: #73a0c5;
-       margin: 0 0 0 1px;
-       padding: 0;
-       height: 200px;
-       width: 758px;
-       }
-
-#headerimg {
-       margin: 0;
-       height: 200px;
-       width: 100%;
-       }
-
-.narrowcolumn {
-       float: left;
-       padding: 0 0 20px 45px;
-       margin: 0px 0 0;
-       width: 450px;
-       }
-
-.widecolumn {
-       padding: 10px 0 20px 0;
-       margin: 5px 0 0 150px;
-       width: 450px;
-       }
-
-.post {
-       margin: 0 0 40px;
-       text-align: justify;
-       }
-
-.post hr {
-       display: block;
-       }
-
-.widecolumn .post {
-       margin: 0;
-       }
-
-.narrowcolumn .postmetadata {
-       padding-top: 5px;
-       }
-
-.widecolumn .postmetadata {
-       margin: 30px 0;
-       }
-
-.widecolumn .smallattachment {
-       text-align: center;
-       float: left;
-       width: 128px;
-       margin: 5px 5px 5px 0px;
-}
-
-.widecolumn .attachment {
-       text-align: center;
-       margin: 5px 0px;
-}
-
-.postmetadata {
-       clear: both;
-}
-
-.clear {
-       clear: both;
-}
-
-#footer {
-       padding: 0;
-       margin: 0 auto;
-       width: 760px;
-       clear: both;
-       }
-
-#footer p {
-       margin: 0;
-       padding: 20px 0;
-       text-align: center;
-       }
-/* End Structure */
-
-
-
-/*     Begin Headers */
-h1 {
-       padding-top: 70px;
-       margin: 0;
-       }
-
-h2 {
-       margin: 30px 0 0;
-       }
-
-h2.pagetitle {
-       margin-top: 30px;
-       text-align: center;
-}
-
-#sidebar h2 {
-       margin: 5px 0 0;
-       padding: 0;
-       }
-
-h3 {
-       padding: 0;
-       margin: 30px 0 0;
-       }
-
-h3.comments {
-       padding: 0;
-       margin: 40px auto 20px ;
-       }
-/* End Headers */
-
-
-
-/* Begin Images */
-p img {
-       padding: 0;
-       max-width: 100%;
-       }
-
-/*     Using 'class="alignright"' on an image will (who would've
-       thought?!) align the image to the right. And using 'class="centered',
-       will of course center the image. This is much better than using
-       align="center", being much more futureproof (and valid) */
-
-img.centered {
-       display: block;
-       margin-left: auto;
-       margin-right: auto;
-       }
-
-img.alignright {
-       padding: 4px;
-       margin: 0 0 2px 7px;
-       display: inline;
-       }
-
-img.alignleft {
-       padding: 4px;
-       margin: 0 7px 2px 0;
-       display: inline;
-       }
-
-.alignright {
-       float: right;
-       }
-
-.alignleft {
-       float: left;
-       }
-/* End Images */
-
-
-
-/* Begin Lists
-
-       Special stylized non-IE bullets
-       Do not work in Internet Explorer, which merely default to normal bullets. */
-
-html>body .entry ul {
-       margin-left: 0px;
-       padding: 0 0 0 30px;
-       list-style: none;
-       padding-left: 10px;
-       text-indent: -10px;
-       }
-
-html>body .entry li {
-       margin: 7px 0 8px 10px;
-       }
-
-.entry ul li:before, #sidebar ul ul li:before {
-       content: "\00BB \0020";
-       }
-
-.entry ol {
-       padding: 0 0 0 35px;
-       margin: 0;
-       }
-
-.entry ol li {
-       margin: 0;
-       padding: 0;
-       }
-
-.postmetadata ul, .postmetadata li {
-       display: inline;
-       list-style-type: none;
-       list-style-image: none;
-       }
-
-#sidebar ul, #sidebar ul ol {
-       margin: 0;
-       padding: 0;
-       }
-
-#sidebar ul li {
-       list-style-type: none;
-       list-style-image: none;
-       margin-bottom: 15px;
-       }
-
-#sidebar ul p, #sidebar ul select {
-       margin: 5px 0 8px;
-       }
-
-#sidebar ul ul, #sidebar ul ol {
-       margin: 5px 0 0 10px;
-       }
-
-#sidebar ul ul ul, #sidebar ul ol {
-       margin: 0 0 0 10px;
-       }
-
-ol li, #sidebar ul ol li {
-       list-style: decimal outside;
-       }
-
-#sidebar ul ul li, #sidebar ul ol li {
-       margin: 3px 0 0;
-       padding: 0;
-       }
-/* End Entry Lists */
-
-
-
-/* Begin Form Elements */
-#searchform {
-       margin: 10px auto;
-       padding: 5px 3px;
-       text-align: center;
-       }
-
-#sidebar #searchform #s {
-       width: 108px;
-       padding: 2px;
-       }
-
-#sidebar #searchsubmit {
-       padding: 1px;
-       }
-
-.entry form { /* This is mainly for password protected posts, makes them look better. */
-       text-align:center;
-       }
-
-select {
-       width: 130px;
-       }
-
-#commentform input {
-       width: 170px;
-       padding: 2px;
-       margin: 5px 5px 1px 0;
-       }
-
-#commentform {
-       margin: 5px 10px 0 0;
-       }
-#commentform textarea {
-       width: 100%;
-       padding: 2px;
-       }
-#respond:after {
-               content: "."; 
-           display: block; 
-           height: 0; 
-           clear: both; 
-           visibility: hidden;
-       }
-#commentform #submit {
-       margin: 0 0 5px auto;
-       float: right;
-       }
-/* End Form Elements */
-
-
-
-/* Begin Comments*/
-.alt {
-       margin: 0;
-       padding: 10px;
-       }
-
-.commentlist {
-       padding: 0;
-       text-align: justify;
-       }
-
-.commentlist li {
-       margin: 15px 0 10px;
-       padding: 5px 5px 10px 10px;
-       list-style: none;
-
-       }
-.commentlist li ul li { 
-       margin-right: -5px;
-       margin-left: 10px;
-}
-
-.commentlist p {
-       margin: 10px 5px 10px 0;
-}
-.children { padding: 0; }
-
-#commentform p {
-       margin: 5px 0;
-       }
-
-.nocomments {
-       text-align: center;
-       margin: 0;
-       padding: 0;
-       }
-
-.commentmetadata {
-       margin: 0;
-       display: block;
-       }
-/* End Comments */
-
-
-
-/* Begin Sidebar */
-#sidebar
-{
-       padding: 20px 0 10px 0;
-       margin-left: 545px;
-       width: 190px;
-       }
-
-#sidebar form {
-       margin: 0;
-       }
-/* End Sidebar */
-
-
-
-/* Begin Calendar */
-#wp-calendar {
-       empty-cells: show;
-       margin: 10px auto 0;
-       width: 155px;
-       }
-
-#wp-calendar #next a {
-       padding-right: 10px;
-       text-align: right;
-       }
-
-#wp-calendar #prev a {
-       padding-left: 10px;
-       text-align: left;
-       }
-
-#wp-calendar a {
-       display: block;
-       }
-
-#wp-calendar caption {
-       text-align: center;
-       width: 100%;
-       }
-
-#wp-calendar td {
-       padding: 3px 0;
-       text-align: center;
-       }
-
-#wp-calendar td.pad:hover { /* Doesn't work in IE */
-       background-color: #fff; }
-/* End Calendar */
-
-
-
-/* Begin Various Tags & Classes */
-acronym, abbr, span.caps {
-       cursor: help;
-       }
-
-acronym, abbr {
-       border-bottom: 1px dashed #999;
-       }
-
-blockquote {
-       margin: 15px 30px 0 10px;
-       padding-left: 20px;
-       border-left: 5px solid #ddd;
-       }
-
-blockquote cite {
-       margin: 5px 0 0;
-       display: block;
-       }
-
-.center {
-       text-align: center;
-       }
-
-.hidden {
-       display: none;
-       }
-       
-.screen-reader-text {
-     position: absolute;
-     left: -1000em;
-}
-
-hr {
-       display: none;
-       }
-
-a img {
-       border: none;
-       }
-
-.navigation {
-       display: block;
-       text-align: center;
-       margin-top: 10px;
-       margin-bottom: 60px;
-       }
-/* End Various Tags & Classes*/
-
-
-
-/* Captions */
-.aligncenter,
-div.aligncenter {
-       display: block;
-       margin-left: auto;
-       margin-right: auto;
-}
-
-.wp-caption {
-       border: 1px solid #ddd;
-       text-align: center;
-       background-color: #f3f3f3;
-       padding-top: 4px;
-       margin: 10px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-}
-
-.wp-caption img {
-       margin: 0;
-       padding: 0;
-       border: 0 none;
-}
-
-.wp-caption p.wp-caption-text {
-       font-size: 11px;
-       line-height: 17px;
-       padding: 0 4px 5px;
-       margin: 0;
-}
-/* End captions */
-
-
-/* "Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you.
-       It won't be a stylish marriage, I can't afford a carriage.
-       But you'll look sweet upon the seat of a bicycle built for two." */
diff --git a/wp-content/themes/twentyten/404.php b/wp-content/themes/twentyten/404.php
new file mode 100644 (file)
index 0000000..3baea81
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+ * The template for displaying 404 pages (Not Found).
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+       <div id="container">
+               <div id="content" role="main">
+
+                       <div id="post-0" class="post error404 not-found">
+                               <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
+                               <div class="entry-content">
+                                       <p><?php _e( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', 'twentyten' ); ?></p>
+                                       <?php get_search_form(); ?>
+                               </div><!-- .entry-content -->
+                       </div><!-- #post-0 -->
+
+               </div><!-- #content -->
+       </div><!-- #container -->
+       <script type="text/javascript">
+               // focus on search field after it has loaded
+               document.getElementById('s') && document.getElementById('s').focus();
+       </script>
+
+<?php get_footer(); ?>
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/archive.php b/wp-content/themes/twentyten/archive.php
new file mode 100644 (file)
index 0000000..52baaa7
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * The template for displaying Archive pages.
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php
+       /* Queue the first post, that way we know
+        * what date we're dealing with (if that is the case).
+        *
+        * We reset this later so we can run the loop
+        * properly with a call to rewind_posts().
+        */
+       if ( have_posts() )
+               the_post();
+?>
+
+                       <h1 class="page-title">
+<?php if ( is_day() ) : ?>
+                               <?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
+<?php elseif ( is_month() ) : ?>
+                               <?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date('F Y') ); ?>
+<?php elseif ( is_year() ) : ?>
+                               <?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date('Y') ); ?>
+<?php else : ?>
+                               <?php _e( 'Blog Archives', 'twentyten' ); ?>
+<?php endif; ?>
+                       </h1>
+
+<?php
+       /* Since we called the_post() above, we need to
+        * rewind the loop back to the beginning that way
+        * we can run the loop properly, in full.
+        */
+       rewind_posts();
+
+       /* Run the loop for the archives page to output the posts.
+        * If you want to overload this in a child theme then include a file
+        * called loop-archives.php and that will be used instead.
+        */
+        get_template_part( 'loop', 'archive' );
+?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/attachment.php b/wp-content/themes/twentyten/attachment.php
new file mode 100644 (file)
index 0000000..262f63e
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+/**
+ * The template for displaying attachments.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+                               <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'twentyten' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
+                                       /* translators: %s - title of parent post */
+                                       printf( __( '<span class="meta-nav">&larr;</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
+                               ?></a></p>
+
+                               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                                       <h2 class="entry-title"><?php the_title(); ?></h2>
+
+                                       <div class="entry-meta">
+                                               <?php
+                                                       printf(__('<span class="%1$s">By</span> %2$s', 'twentyten'),
+                                                               'meta-prep meta-prep-author',
+                                                               sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
+                                                                       get_author_posts_url( get_the_author_meta( 'ID' ) ),
+                                                                       sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
+                                                                       get_the_author()
+                                                               )
+                                                       );
+                                               ?>
+                                               <span class="meta-sep">|</span>
+                                               <?php
+                                                       printf( __('<span class="%1$s">Published</span> %2$s', 'twentyten'),
+                                                               'meta-prep meta-prep-entry-date',
+                                                               sprintf( '<span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>',
+                                                                       esc_attr( get_the_time() ),
+                                                                       get_the_date()
+                                                               )
+                                                       );
+                                                       if ( wp_attachment_is_image() ) {
+                                                               echo ' <span class="meta-sep">|</span> ';
+                                                               $metadata = wp_get_attachment_metadata();
+                                                               printf( __( 'Full size is %s pixels', 'twentyten'),
+                                                                       sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
+                                                                               wp_get_attachment_url(),
+                                                                               esc_attr( __('Link to full-size image', 'twentyten') ),
+                                                                               $metadata['width'],
+                                                                               $metadata['height']
+                                                                       )
+                                                               );
+                                                       }
+                                               ?>
+                                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+                                       </div><!-- .entry-meta -->
+
+                                       <div class="entry-content">
+                                               <div class="entry-attachment">
+<?php if ( wp_attachment_is_image() ) :
+       $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
+       foreach ( $attachments as $k => $attachment ) {
+               if ( $attachment->ID == $post->ID )
+                       break;
+       }
+       $k++;
+       // If there is more than 1 image attachment in a gallery
+       if ( count( $attachments ) > 1 ) {
+               if ( isset( $attachments[ $k ] ) )
+                       // get the URL of the next image attachment
+                       $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
+               else
+                       // or get the URL of the first image attachment
+                       $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
+       } else {
+               // or, if there's only 1 image attachment, get the URL of the image
+               $next_attachment_url = wp_get_attachment_url();
+       }
+?>
+                                               <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
+                                                       $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
+                                                       echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
+                                               ?></a></p>
+
+                                               <div id="nav-below" class="navigation">
+                                                       <div class="nav-previous"><?php previous_image_link( false ); ?></div>
+                                                       <div class="nav-next"><?php next_image_link( false ); ?></div>
+                                               </div><!-- #nav-below -->
+<?php else : ?>
+                                               <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
+<?php endif; ?>
+                                               </div><!-- .entry-attachment -->
+                                               <div class="entry-caption"><?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?></div>
+
+<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+
+                                       </div><!-- .entry-content -->
+
+                                       <div class="entry-utility">
+                                               <?php twentyten_posted_in(); ?>
+                                               <?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
+                                       </div><!-- .entry-utility -->
+                               </div><!-- #post-## -->
+
+<?php comments_template(); ?>
+
+<?php endwhile; ?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/author.php b/wp-content/themes/twentyten/author.php
new file mode 100644 (file)
index 0000000..2bd48c8
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The template for displaying Author Archive pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php
+       /* Queue the first post, that way we know who
+        * the author is when we try to get their name,
+        * URL, description, avatar, etc.
+        *
+        * We reset this later so we can run the loop
+        * properly with a call to rewind_posts().
+        */
+       if ( have_posts() )
+               the_post();
+?>
+
+                               <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyten' ), "<span class='vcard'><a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?></h1>
+
+<?php
+// If a user has filled out their description, show a bio on their entries.
+if ( get_the_author_meta( 'description' ) ) : ?>
+                                       <div id="entry-author-info">
+                                               <div id="author-avatar">
+                                                       <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); ?>
+                                               </div><!-- #author-avatar -->
+                                               <div id="author-description">
+                                                       <h2><?php printf( __( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
+                                                       <?php the_author_meta( 'description' ); ?>
+                                               </div><!-- #author-description  -->
+                                       </div><!-- #entry-author-info -->
+<?php endif; ?>
+
+<?php
+       /* Since we called the_post() above, we need to
+        * rewind the loop back to the beginning that way
+        * we can run the loop properly, in full.
+        */
+       rewind_posts();
+
+       /* Run the loop for the author archive page to output the authors posts
+        * If you want to overload this in a child theme then include a file
+        * called loop-author.php and that will be used instead.
+        */
+        get_template_part( 'loop', 'author' );
+?>
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/category.php b/wp-content/themes/twentyten/category.php
new file mode 100644 (file)
index 0000000..0792e1f
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * The template for displaying Category Archive pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+                               <h1 class="page-title"><?php
+                                       printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
+                               ?></h1>
+                               <?php
+                                       $category_description = category_description();
+                                       if ( ! empty( $category_description ) )
+                                               echo '<div class="archive-meta">' . $category_description . '</div>';
+
+                               /* Run the loop for the category page to output the posts.
+                                * If you want to overload this in a child theme then include a file
+                                * called loop-category.php and that will be used instead.
+                                */
+                               get_template_part( 'loop', 'category' );
+                               ?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/comments.php b/wp-content/themes/twentyten/comments.php
new file mode 100644 (file)
index 0000000..7863ca1
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+/**
+ * The template for displaying Comments.
+ *
+ * The area of the page that contains both current comments
+ * and the comment form.  The actual display of comments is
+ * handled by a callback to twentyten_comment which is
+ * located in the functions.php file.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+                       <div id="comments">
+<?php if ( post_password_required() ) : ?>
+                               <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?></p>
+                       </div><!-- #comments -->
+<?php
+               /* Stop the rest of comments.php from being processed,
+                * but don't kill the script entirely -- we still have
+                * to fully load the template.
+                */
+               return;
+       endif;
+?>
+
+<?php
+       // You can start editing here -- including this comment!
+?>
+
+<?php if ( have_comments() ) : ?>
+                       <h3 id="comments-title"><?php
+                       printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
+                       number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' );
+                       ?></h3>
+
+<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
+                       <div class="navigation">
+                               <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'twentyten' ) ); ?></div>
+                               <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+                       </div> <!-- .navigation -->
+<?php endif; // check for comment navigation ?>
+
+                       <ol class="commentlist">
+                               <?php
+                                       /* Loop through and list the comments. Tell wp_list_comments()
+                                        * to use twentyten_comment() to format the comments.
+                                        * If you want to overload this in a child theme then you can
+                                        * define twentyten_comment() and that will be used instead.
+                                        * See twentyten_comment() in twentyten/functions.php for more.
+                                        */
+                                       wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
+                               ?>
+                       </ol>
+
+<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
+                       <div class="navigation">
+                               <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'twentyten' ) ); ?></div>
+                               <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+                       </div><!-- .navigation -->
+<?php endif; // check for comment navigation ?>
+
+<?php else : // or, if we don't have comments:
+
+       /* If there are no comments and comments are closed,
+        * let's leave a little note, shall we?
+        */
+       if ( ! comments_open() ) :
+?>
+       <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyten' ); ?></p>
+<?php endif; // end ! comments_open() ?>
+
+<?php endif; // end have_comments() ?>
+
+<?php comment_form(); ?>
+
+</div><!-- #comments -->
diff --git a/wp-content/themes/twentyten/editor-style-rtl.css b/wp-content/themes/twentyten/editor-style-rtl.css
new file mode 100644 (file)
index 0000000..2c69a7c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+Theme Name: Twenty Ten
+*/
+/*
+Used to style the TinyMCE editor.
+*/
+html .mceContentBody{
+       direction:rtl;
+       unicode-bidi:embed;
+       float:right;
+}
+* {
+       font-family: Arial, Tahoma, sans-serif;
+}
+/* Text elements */
+ul {
+       margin: 0 -18px 18px 0;
+}
+ol {
+       margin: 0 -18px 18px 0;
+}
+dd {
+       margin-right: 0;
+}
+blockquote {
+       font-style: normal;
+}
+table {
+       text-align: right;
+       margin: 0 0 24px -1px;
+}
+html .mceContentBody{
+       direction:rtl;
+       unicode-bidi:embed;
+       float:right;
+}
+* {
+       font-family: Arial, Tahoma, sans-serif;
+}
+/* Text elements */
+ul {
+       margin: 0 -18px 18px 0;
+}
+ol {
+       margin: 0 -18px 18px 0;
+}
+dd {
+       margin-right: 0;
+}
+blockquote {
+       font-style: normal;
+}
+table {
+       text-align: right;
+       margin: 0 0 24px -1px;
+}
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/editor-style.css b/wp-content/themes/twentyten/editor-style.css
new file mode 100644 (file)
index 0000000..fa875ca
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+Theme Name: Twenty Ten
+*/
+/*
+Used to style the TinyMCE editor.
+*/
+html .mceContentBody {
+       max-width:640px;
+}
+* {
+       font-family: Georgia, "Bitstream Charter", serif;
+       color: #444;
+       line-height: 1.5;
+}
+p,
+dl,
+td,
+th,
+ul,
+ol,
+blockquote {
+       font-size: 16px;
+}
+tr th,
+thead th,
+label,
+tr th,
+thead th {
+       font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
+}
+pre {
+       font-family: "Courier 10 Pitch", Courier, monospace;
+}
+code, code var {
+       font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
+}
+body, input, textarea {
+       font-size: 12px;
+       line-height: 18px;
+}
+hr {
+       background-color: #E7E7E7;
+       border:0;
+       height: 1px;
+       margin-bottom: 18px;
+       clear:both;
+}
+/* Text elements */
+p {
+       margin-bottom: 18px;
+}
+ul {
+       list-style: square;
+       margin: 0 0 18px 1.5em;
+}
+ol {
+       list-style: decimal;
+       margin: 0 0 18px 1.5em;
+}
+ol ol {
+       list-style:upper-alpha;
+}
+ol ol ol {
+       list-style:lower-roman;
+}
+ol ol ol ol {
+       list-style:lower-alpha;
+}
+ul ul,
+ol ol,
+ul ol,
+ol ul {
+       margin-bottom:0;
+}
+dl {
+       margin:0 0 24px 0;
+}
+dt {
+       font-weight: bold;
+}
+dd {
+       margin-bottom: 18px;
+}
+strong {
+       font-weight: bold;
+       color: #000;
+}
+cite,
+em,
+i {
+       font-style: italic;
+       border: none;
+}
+big {
+       font-size: 131.25%;
+}
+ins {
+       background: #FFFFCC;
+       border: none;
+       color: #333;
+}
+del {
+       text-decoration: line-through;
+       color: #555;
+}
+blockquote {
+       font-style: italic;
+       padding: 0 3em;
+}
+blockquote cite,
+blockquote em,
+blockquote i {
+       font-style: normal;
+}
+pre {
+       background: #f7f7f7;
+       color: #222;
+       line-height: 18px;
+       margin-bottom: 18px;
+       padding: 1.5em;
+}
+abbr,
+acronym {
+       border-bottom: 1px dotted #666;
+       cursor: help;
+}
+ins {
+       text-decoration: none;
+}
+sup,
+sub {
+       height: 0;
+       line-height: 1;
+       vertical-align: baseline;
+       position: relative;
+       font-size: 10px;
+}
+sup {
+       bottom: 1ex;
+}
+sub {
+       top: .5ex;
+}
+a:link {
+       color:#0066CC;
+}
+a:visited {
+       color:#743399;
+}
+a:active,
+a:hover {
+       color: #FF4B33;
+}
+p,
+ul,
+ol,
+dd,
+pre,
+hr {
+       margin-bottom:24px;
+}
+ul ul,
+ol ol,
+ul ol,
+ol ul {
+       margin-bottom:0;
+}
+pre,
+kbd,
+tt,
+var {
+       font-size: 15px;
+       line-height: 21px;
+}
+code {
+       font-size: 13px;
+}
+strong,
+b,
+dt,
+th {
+       color: #000;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+       color: #000;
+       margin: 0 0 20px 0;
+       line-height: 1.5em;
+       font-weight: normal;
+}
+h1 {
+       font-size: 2.4em;
+}
+h2 {
+       font-size: 1.8em;
+}
+h3 {
+       font-size: 1.4em;
+}
+h4 {
+       font-size: 1.2em;
+}
+h5 {
+       font-size: 1em;
+}
+h6 {
+       font-size: 0.9em;
+}
+table {
+       border: 1px solid #e7e7e7 !important;
+       text-align: left;
+       margin: 0 -1px 24px 0;
+       width: 100%;
+       border-collapse: collapse;
+       border-spacing: 0;
+}
+tr th,
+thead th {
+       border: none !important;
+       color: #888;
+       font-size: 12px;
+       font-weight: bold;
+       line-height: 18px;
+       padding: 9px 24px;
+}
+tr td {
+       border: none !important;
+       border-top: 1px solid #e7e7e7 !important;
+       padding: 6px 24px;
+}
+
+
+img {
+       margin: 0;
+       max-width: 640px;
+}
+.alignleft,
+img.alignleft {
+       display: inline;
+       float: left;
+       margin-right: 24px;
+       margin-top: 4px;
+}
+.alignright,
+img.alignright {
+       display: inline;
+       float: right;
+       margin-left: 24px;
+       margin-top: 4px;
+}
+.aligncenter,
+img.aligncenter {
+       clear: both;
+       display: block;
+       margin-left: auto;
+       margin-right: auto;
+}
+img.alignleft,
+img.alignright,
+img.aligncenter {
+       margin-bottom: 12px;
+}
+.wp-caption {
+       border: none;
+       background: #f1f1f1;
+       color: #888;
+       font-size: 12px;
+       line-height: 18px;
+       text-align: center;
+       margin-bottom: 20px;
+       padding: 4px;
+       -moz-border-radius: 0;
+       -khtml-border-radius: 0;
+       -webkit-border-radius: 0;
+       border-radius: 0;
+}
+.wp-caption img {
+       margin: 5px;
+}
+.wp-caption p.wp-caption-text {
+       margin: 0 0 4px;
+}
+.wp-smiley {
+       margin:0;
+}
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/footer.php b/wp-content/themes/twentyten/footer.php
new file mode 100644 (file)
index 0000000..61f2d94
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+ * The template for displaying the footer.
+ *
+ * Contains the closing of the id=main div and all content
+ * after.  Calls sidebar-footer.php for bottom widgets.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+       </div><!-- #main -->
+
+       <div id="footer" role="contentinfo">
+               <div id="colophon">
+
+<?php
+       /* A sidebar in the footer? Yep. You can can customize
+        * your footer with four columns of widgets.
+        */
+       get_sidebar( 'footer' );
+?>
+
+                       <div id="site-info">
+                               <a href="<?php echo home_url( '/' ) ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
+                                       <?php bloginfo( 'name' ); ?>
+                               </a>
+                       </div><!-- #site-info -->
+
+                       <div id="site-generator">
+                               <?php do_action( 'twentyten_credits' ); ?>
+                               <a href="<?php echo esc_url( __('http://wordpress.org/', 'twentyten') ); ?>"
+                                               title="<?php esc_attr_e('Semantic Personal Publishing Platform', 'twentyten'); ?>" rel="generator">
+                                       <?php printf( __('Proudly powered by %s.', 'twentyten'), 'WordPress' ); ?>
+                               </a>
+                       </div><!-- #site-generator -->
+
+               </div><!-- #colophon -->
+       </div><!-- #footer -->
+
+</div><!-- #wrapper -->
+
+<?php
+       /* Always have wp_footer() just before the closing </body>
+        * tag of your theme, or you will break many plugins, which
+        * generally use this hook to reference JavaScript files.
+        */
+
+       wp_footer();
+?>
+</body>
+</html>
diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php
new file mode 100644 (file)
index 0000000..3a61e9d
--- /dev/null
@@ -0,0 +1,541 @@
+<?php
+/**
+ * TwentyTen functions and definitions
+ *
+ * Sets up the theme and provides some helper functions. Some helper functions
+ * are used in the theme as custom template tags. Others are attached to action and
+ * filter hooks in WordPress to change core functionality.
+ *
+ * The first function, twentyten_setup(), sets up the theme by registering support
+ * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development and
+ * http://codex.wordpress.org/Child_Themes), you can override certain functions
+ * (those wrapped in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before the parent
+ * theme's file, so the child theme functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
+ * to a filter or action hook. The hook can be removed by using remove_action() or
+ * remove_filter() and you can attach your own function to the hook.
+ *
+ * We can remove the parent theme's hook only after it is attached, which means we need to
+ * wait until setting up the child theme:
+ *
+ * <code>
+ * add_action( 'after_setup_theme', 'my_child_theme_setup' );
+ * function my_child_theme_setup() {
+ *     // We are providing our own filter for excerpt_length (or using the unfiltered value)
+ *     remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
+ *     ...
+ * }
+ * </code>
+ *
+ * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+/**
+ * Set the content width based on the theme's design and stylesheet.
+ *
+ * Used to set the width of images and content. Should be equal to the width the theme
+ * is designed for, generally via the style.css stylesheet.
+ */
+if ( ! isset( $content_width ) )
+       $content_width = 640;
+
+/** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */
+add_action( 'after_setup_theme', 'twentyten_setup' );
+
+if ( ! function_exists( 'twentyten_setup' ) ):
+/**
+ * Sets up theme defaults and registers support for various WordPress features.
+ *
+ * Note that this function is hooked into the after_setup_theme hook, which runs
+ * before the init hook. The init hook is too late for some features, such as indicating
+ * support post thumbnails.
+ *
+ * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
+ * functions.php file.
+ *
+ * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
+ * @uses register_nav_menus() To add support for navigation menus.
+ * @uses add_custom_background() To add support for a custom background.
+ * @uses add_editor_style() To style the visual editor.
+ * @uses load_theme_textdomain() For translation/localization support.
+ * @uses add_custom_image_header() To add support for a custom header.
+ * @uses register_default_headers() To register the default custom header images provided with the theme.
+ * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_setup() {
+
+       // This theme styles the visual editor with editor-style.css to match the theme style.
+       add_editor_style();
+
+       // This theme uses post thumbnails
+       add_theme_support( 'post-thumbnails' );
+
+       // Add default posts and comments RSS feed links to head
+       add_theme_support( 'automatic-feed-links' );
+
+       // Make theme available for translation
+       // Translations can be filed in the /languages/ directory
+       load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );
+
+       $locale = get_locale();
+       $locale_file = TEMPLATEPATH . "/languages/$locale.php";
+       if ( is_readable( $locale_file ) )
+               require_once( $locale_file );
+
+       // This theme uses wp_nav_menu() in one location.
+       register_nav_menus( array(
+               'primary' => __( 'Primary Navigation', 'twentyten' ),
+       ) );
+
+       // This theme allows users to set a custom background
+       add_custom_background();
+
+       // Your changeable header business starts here
+       define( 'HEADER_TEXTCOLOR', '' );
+       // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
+       define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );
+
+       // The height and width of your custom header. You can hook into the theme's own filters to change these values.
+       // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
+       define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
+       define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
+
+       // We'll be using post thumbnails for custom header images on posts and pages.
+       // We want them to be 940 pixels wide by 198 pixels tall.
+       // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
+       set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
+
+       // Don't support text inside the header image.
+       define( 'NO_HEADER_TEXT', true );
+
+       // Add a way for the custom header to be styled in the admin panel that controls
+       // custom headers. See twentyten_admin_header_style(), below.
+       add_custom_image_header( '', 'twentyten_admin_header_style' );
+
+       // ... and thus ends the changeable header business.
+
+       // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
+       register_default_headers( array(
+               'berries' => array(
+                       'url' => '%s/images/headers/berries.jpg',
+                       'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Berries', 'twentyten' )
+               ),
+               'cherryblossom' => array(
+                       'url' => '%s/images/headers/cherryblossoms.jpg',
+                       'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Cherry Blossoms', 'twentyten' )
+               ),
+               'concave' => array(
+                       'url' => '%s/images/headers/concave.jpg',
+                       'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Concave', 'twentyten' )
+               ),
+               'fern' => array(
+                       'url' => '%s/images/headers/fern.jpg',
+                       'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Fern', 'twentyten' )
+               ),
+               'forestfloor' => array(
+                       'url' => '%s/images/headers/forestfloor.jpg',
+                       'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Forest Floor', 'twentyten' )
+               ),
+               'inkwell' => array(
+                       'url' => '%s/images/headers/inkwell.jpg',
+                       'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Inkwell', 'twentyten' )
+               ),
+               'path' => array(
+                       'url' => '%s/images/headers/path.jpg',
+                       'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Path', 'twentyten' )
+               ),
+               'sunset' => array(
+                       'url' => '%s/images/headers/sunset.jpg',
+                       'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
+                       /* translators: header image description */
+                       'description' => __( 'Sunset', 'twentyten' )
+               )
+       ) );
+}
+endif;
+
+if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
+/**
+ * Styles the header image displayed on the Appearance > Header admin panel.
+ *
+ * Referenced via add_custom_image_header() in twentyten_setup().
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_admin_header_style() {
+?>
+<style type="text/css">
+/* Shows the same border as on front end */
+#headimg {
+       border-bottom: 1px solid #000;
+       border-top: 4px solid #000;
+}
+/* If NO_HEADER_TEXT is false, you would style the text with these selectors:
+       #headimg #name { }
+       #headimg #desc { }
+*/
+</style>
+<?php
+}
+endif;
+
+/**
+ * Makes some changes to the <title> tag, by filtering the output of wp_title().
+ *
+ * If we have a site description and we're viewing the home page or a blog posts
+ * page (when using a static front page), then we will add the site description.
+ *
+ * If we're viewing a search result, then we're going to recreate the title entirely.
+ * We're going to add page numbers to all titles as well, to the middle of a search
+ * result title and the end of all other titles.
+ *
+ * The site title also gets added to all titles.
+ *
+ * @since Twenty Ten 1.0
+ *
+ * @param string $title Title generated by wp_title()
+ * @param string $separator The separator passed to wp_title(). Twenty Ten uses a
+ *     vertical bar, "|", as a separator in header.php.
+ * @return string The new title, ready for the <title> tag.
+ */
+function twentyten_filter_wp_title( $title, $separator ) {
+       // Don't affect wp_title() calls in feeds.
+       if ( is_feed() )
+               return $title;
+
+       // The $paged global variable contains the page number of a listing of posts.
+       // The $page global variable contains the page number of a single post that is paged.
+       // We'll display whichever one applies, if we're not looking at the first page.
+       global $paged, $page;
+
+       if ( is_search() ) {
+               // If we're a search, let's start over:
+               $title = sprintf( __( 'Search results for %s', 'twentyten' ), '"' . get_search_query() . '"' );
+               // Add a page number if we're on page 2 or more:
+               if ( $paged >= 2 )
+                       $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), $paged );
+               // Add the site name to the end:
+               $title .= " $separator " . get_bloginfo( 'name', 'display' );
+               // We're done. Let's send the new title back to wp_title():
+               return $title;
+       }
+
+       // Otherwise, let's start by adding the site name to the end:
+       $title .= get_bloginfo( 'name', 'display' );
+
+       // If we have a site description and we're on the home/front page, add the description:
+       $site_description = get_bloginfo( 'description', 'display' );
+       if ( $site_description && ( is_home() || is_front_page() ) )
+               $title .= " $separator " . $site_description;
+
+       // Add a page number if necessary:
+       if ( $paged >= 2 || $page >= 2 )
+               $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
+
+       // Return the new title to wp_title():
+       return $title;
+}
+add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 );
+
+/**
+ * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
+ *
+ * To override this in a child theme, remove the filter and optionally add
+ * your own function tied to the wp_page_menu_args filter hook.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_page_menu_args( $args ) {
+       $args['show_home'] = true;
+       return $args;
+}
+add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
+
+/**
+ * Sets the post excerpt length to 40 characters.
+ *
+ * To override this length in a child theme, remove the filter and add your own
+ * function tied to the excerpt_length filter hook.
+ *
+ * @since Twenty Ten 1.0
+ * @return int
+ */
+function twentyten_excerpt_length( $length ) {
+       return 40;
+}
+add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
+
+/**
+ * Returns a "Continue Reading" link for excerpts
+ *
+ * @since Twenty Ten 1.0
+ * @return string "Continue Reading" link
+ */
+function twentyten_continue_reading_link() {
+       return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
+}
+
+/**
+ * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
+ *
+ * To override this in a child theme, remove the filter and add your own
+ * function tied to the excerpt_more filter hook.
+ *
+ * @since Twenty Ten 1.0
+ * @return string An ellipsis
+ */
+function twentyten_auto_excerpt_more( $more ) {
+       return ' &hellip;' . twentyten_continue_reading_link();
+}
+add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
+
+/**
+ * Adds a pretty "Continue Reading" link to custom post excerpts.
+ *
+ * To override this link in a child theme, remove the filter and add your own
+ * function tied to the get_the_excerpt filter hook.
+ *
+ * @since Twenty Ten 1.0
+ * @return string Excerpt with a pretty "Continue Reading" link
+ */
+function twentyten_custom_excerpt_more( $output ) {
+       if ( has_excerpt() && ! is_attachment() ) {
+               $output .= twentyten_continue_reading_link();
+       }
+       return $output;
+}
+add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
+
+/**
+ * Remove inline styles printed when the gallery shortcode is used.
+ *
+ * Galleries are styled by the theme in Twenty Ten's style.css.
+ *
+ * @since Twenty Ten 1.0
+ * @return string The gallery style filter, with the styles themselves removed.
+ */
+function twentyten_remove_gallery_css( $css ) {
+       return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
+}
+add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
+
+if ( ! function_exists( 'twentyten_comment' ) ) :
+/**
+ * Template for comments and pingbacks.
+ *
+ * To override this walker in a child theme without modifying the comments template
+ * simply create your own twentyten_comment(), and that function will be used instead.
+ *
+ * Used as a callback by wp_list_comments() for displaying the comments.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_comment( $comment, $args, $depth ) {
+       $GLOBALS['comment'] = $comment;
+       switch ( $comment->comment_type ) :
+               case '' :
+       ?>
+       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
+               <div id="comment-<?php comment_ID(); ?>">
+               <div class="comment-author vcard">
+                       <?php echo get_avatar( $comment, 40 ); ?>
+                       <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
+               </div><!-- .comment-author .vcard -->
+               <?php if ( $comment->comment_approved == '0' ) : ?>
+                       <em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
+                       <br />
+               <?php endif; ?>
+
+               <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
+                       <?php
+                               /* translators: 1: date, 2: time */
+                               printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
+                       ?>
+               </div><!-- .comment-meta .commentmetadata -->
+
+               <div class="comment-body"><?php comment_text(); ?></div>
+
+               <div class="reply">
+                       <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+               </div><!-- .reply -->
+       </div><!-- #comment-##  -->
+
+       <?php
+                       break;
+               case 'pingback'  :
+               case 'trackback' :
+       ?>
+       <li class="post pingback">
+               <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten'), ' ' ); ?></p>
+       <?php
+                       break;
+       endswitch;
+}
+endif;
+
+/**
+ * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
+ *
+ * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
+ * function tied to the init hook.
+ *
+ * @since Twenty Ten 1.0
+ * @uses register_sidebar
+ */
+function twentyten_widgets_init() {
+       // Area 1, located at the top of the sidebar.
+       register_sidebar( array(
+               'name' => __( 'Primary Widget Area', 'twentyten' ),
+               'id' => 'primary-widget-area',
+               'description' => __( 'The primary widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+
+       // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
+       register_sidebar( array(
+               'name' => __( 'Secondary Widget Area', 'twentyten' ),
+               'id' => 'secondary-widget-area',
+               'description' => __( 'The secondary widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+
+       // Area 3, located in the footer. Empty by default.
+       register_sidebar( array(
+               'name' => __( 'First Footer Widget Area', 'twentyten' ),
+               'id' => 'first-footer-widget-area',
+               'description' => __( 'The first footer widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+
+       // Area 4, located in the footer. Empty by default.
+       register_sidebar( array(
+               'name' => __( 'Second Footer Widget Area', 'twentyten' ),
+               'id' => 'second-footer-widget-area',
+               'description' => __( 'The second footer widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+
+       // Area 5, located in the footer. Empty by default.
+       register_sidebar( array(
+               'name' => __( 'Third Footer Widget Area', 'twentyten' ),
+               'id' => 'third-footer-widget-area',
+               'description' => __( 'The third footer widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+
+       // Area 6, located in the footer. Empty by default.
+       register_sidebar( array(
+               'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
+               'id' => 'fourth-footer-widget-area',
+               'description' => __( 'The fourth footer widget area', 'twentyten' ),
+               'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h3 class="widget-title">',
+               'after_title' => '</h3>',
+       ) );
+}
+/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
+add_action( 'widgets_init', 'twentyten_widgets_init' );
+
+/**
+ * Removes the default styles that are packaged with the Recent Comments widget.
+ *
+ * To override this in a child theme, remove the filter and optionally add your own
+ * function tied to the widgets_init action hook.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_remove_recent_comments_style() {
+       global $wp_widget_factory;
+       remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
+}
+add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
+
+if ( ! function_exists( 'twentyten_posted_on' ) ) :
+/**
+ * Prints HTML with meta information for the current post—date/time and author.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_posted_on() {
+       printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
+               'meta-prep meta-prep-author',
+               sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
+                       get_permalink(),
+                       esc_attr( get_the_time() ),
+                       get_the_date()
+               ),
+               sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
+                       get_author_posts_url( get_the_author_meta( 'ID' ) ),
+                       sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
+                       get_the_author()
+               )
+       );
+}
+endif;
+
+if ( ! function_exists( 'twentyten_posted_in' ) ) :
+/**
+ * Prints HTML with meta information for the current post (category, tags and permalink).
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_posted_in() {
+       // Retrieves tag list of current post, separated by commas.
+       $tag_list = get_the_tag_list( '', ', ' );
+       if ( $tag_list ) {
+               $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+       } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
+               $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+       } else {
+               $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+       }
+       // Prints the string, replacing the placeholders.
+       printf(
+               $posted_in,
+               get_the_category_list( ', ' ),
+               $tag_list,
+               get_permalink(),
+               the_title_attribute( 'echo=0' )
+       );
+}
+endif;
diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php
new file mode 100644 (file)
index 0000000..fbd2486
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+/**
+ * The Header for our theme.
+ *
+ * Displays all of the <head> section and everything up till <div id="main">
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?><!DOCTYPE html>
+<html <?php language_attributes(); ?>>
+<head>
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
+<title><?php
+       /*
+        * Print the <title> tag based on what is being viewed.
+        * We filter the output of wp_title() a bit -- see
+        * twentyten_filter_wp_title() in functions.php.
+        */
+       wp_title( '|', true, 'right' );
+
+       ?></title>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
+<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
+<?php
+       /* We add some JavaScript to pages with the comment form
+        * to support sites with threaded comments (when in use).
+        */
+       if ( is_singular() && get_option( 'thread_comments' ) )
+               wp_enqueue_script( 'comment-reply' );
+
+       /* Always have wp_head() just before the closing </head>
+        * tag of your theme, or you will break many plugins, which
+        * generally use this hook to add elements to <head> such
+        * as styles, scripts, and meta tags.
+        */
+       wp_head();
+?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="wrapper" class="hfeed">
+       <div id="header">
+               <div id="masthead">
+                       <div id="branding" role="banner">
+                               <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
+                               <<?php echo $heading_tag; ?> id="site-title">
+                                       <span>
+                                               <a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
+                                       </span>
+                               </<?php echo $heading_tag; ?>>
+                               <div id="site-description"><?php bloginfo( 'description' ); ?></div>
+
+                               <?php
+                                       // Check if this is a post or page, if it has a thumbnail, and if it's a big one
+                                       if ( is_singular() &&
+                                                       has_post_thumbnail( $post->ID ) &&
+                                                       ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
+                                                       $image[1] >= HEADER_IMAGE_WIDTH ) :
+                                               // Houston, we have a new header image!
+                                               echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
+                                       else : ?>
+                                               <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
+                                       <?php endif; ?>
+                       </div><!-- #branding -->
+
+                       <div id="access" role="navigation">
+                         <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
+                               <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
+                               <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>
+                               <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
+                       </div><!-- #access -->
+               </div><!-- #masthead -->
+       </div><!-- #header -->
+
+       <div id="main">
diff --git a/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg
new file mode 100644 (file)
index 0000000..6e684f4
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/berries.jpg b/wp-content/themes/twentyten/images/headers/berries.jpg
new file mode 100644 (file)
index 0000000..3031a05
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/berries.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg
new file mode 100644 (file)
index 0000000..710049a
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg b/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg
new file mode 100644 (file)
index 0000000..56e9df0
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg
new file mode 100644 (file)
index 0000000..b271867
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/concave.jpg b/wp-content/themes/twentyten/images/headers/concave.jpg
new file mode 100644 (file)
index 0000000..9970de2
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/concave.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg
new file mode 100644 (file)
index 0000000..c6113ab
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/fern.jpg b/wp-content/themes/twentyten/images/headers/fern.jpg
new file mode 100644 (file)
index 0000000..fc0b394
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/fern.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg
new file mode 100644 (file)
index 0000000..b888fc3
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/forestfloor.jpg b/wp-content/themes/twentyten/images/headers/forestfloor.jpg
new file mode 100644 (file)
index 0000000..4533948
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/forestfloor.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg
new file mode 100644 (file)
index 0000000..61e775e
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/inkwell.jpg b/wp-content/themes/twentyten/images/headers/inkwell.jpg
new file mode 100644 (file)
index 0000000..82b0b7d
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/inkwell.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg
new file mode 100644 (file)
index 0000000..0585ec4
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/path.jpg b/wp-content/themes/twentyten/images/headers/path.jpg
new file mode 100644 (file)
index 0000000..d869497
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/path.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg b/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg
new file mode 100644 (file)
index 0000000..416c11a
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg differ
diff --git a/wp-content/themes/twentyten/images/headers/sunset.jpg b/wp-content/themes/twentyten/images/headers/sunset.jpg
new file mode 100644 (file)
index 0000000..66eddaa
Binary files /dev/null and b/wp-content/themes/twentyten/images/headers/sunset.jpg differ
diff --git a/wp-content/themes/twentyten/images/wordpress.png b/wp-content/themes/twentyten/images/wordpress.png
new file mode 100644 (file)
index 0000000..224f7c8
Binary files /dev/null and b/wp-content/themes/twentyten/images/wordpress.png differ
diff --git a/wp-content/themes/twentyten/index.php b/wp-content/themes/twentyten/index.php
new file mode 100644 (file)
index 0000000..9f7d240
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * The main template file.
+ *
+ * This is the most generic template file in a WordPress theme
+ * and one of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query. 
+ * E.g., it puts together the home page when no home.php file exists.
+ * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+                       <?php
+                       /* Run the loop to output the posts.
+                        * If you want to overload this in a child theme then include a file
+                        * called loop-index.php and that will be used instead.
+                        */
+                        get_template_part( 'loop', 'index' );
+                       ?>
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/languages/twentyten.pot b/wp-content/themes/twentyten/languages/twentyten.pot
new file mode 100644 (file)
index 0000000..b8985cf
--- /dev/null
@@ -0,0 +1,433 @@
+# Translation of the WordPress theme Twenty Ten 1.0 by the WordPress team.
+# Copyright (C) 2010 the WordPress team
+# This file is distributed under the same license as the Twenty Ten package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Ten 1.0\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyten\n"
+"POT-Creation-Date: 2010-06-15 16:21+0000\n"
+"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: 404.php:16 loop.php:33
+msgid "Not Found"
+msgstr ""
+
+#: 404.php:18
+msgid ""
+"Apologies, but the page you requested could not be found. Perhaps searching "
+"will help."
+msgstr ""
+
+#: archive.php:33
+#, php-format
+msgid "Daily Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:35
+#, php-format
+msgid "Monthly Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:37
+#, php-format
+msgid "Yearly Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:39
+msgid "Blog Archives"
+msgstr ""
+
+#: attachment.php:17
+#, php-format
+msgid "Return to %s"
+msgstr ""
+
+#. translators: %s - title of parent post
+#: attachment.php:19
+#, php-format
+msgid "<span class=\"meta-nav\">&larr;</span> %s"
+msgstr ""
+
+#: attachment.php:27
+#, php-format
+msgid "<span class=\"%1$s\">By</span> %2$s"
+msgstr ""
+
+#: attachment.php:31 functions.php:509
+#, php-format
+msgid "View all posts by %s"
+msgstr ""
+
+#: attachment.php:38
+#, php-format
+msgid "<span class=\"%1$s\">Published</span> %2$s"
+msgstr ""
+
+#: attachment.php:48
+#, php-format
+msgid "Full size is %s pixels"
+msgstr ""
+
+#: attachment.php:51
+msgid "Link to full-size image"
+msgstr ""
+
+#: attachment.php:58 attachment.php:105 loop.php:94 loop.php:117 loop.php:159
+#: onecolumn-page.php:27 page.php:32 single.php:53
+msgid "Edit"
+msgstr ""
+
+#: attachment.php:98 functions.php:299 loop.php:109 loop.php:137
+msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: attachment.php:99 loop.php:138 onecolumn-page.php:26 page.php:31
+#: single.php:31
+msgid "Pages:"
+msgstr ""
+
+#: author.php:27
+#, php-format
+msgid "Author Archives: %s"
+msgstr ""
+
+#: author.php:37 single.php:40
+#, php-format
+msgid "About %s"
+msgstr ""
+
+#: category.php:16
+#, php-format
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:18
+msgid ""
+"This post is password protected. Enter the password to view any comments."
+msgstr ""
+
+#: comments.php:35
+#, php-format
+msgid "One Response to %2$s"
+msgid_plural "%1$s Responses to %2$s"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:41 comments.php:60
+msgid "<span class=\"meta-nav\">&larr;</span> Older Comments"
+msgstr ""
+
+#: comments.php:42 comments.php:61
+msgid "Newer Comments <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: comments.php:72
+msgid "Comments are closed."
+msgstr ""
+
+#. #-#-#-#-#  twentyten.pot (Twenty Ten 1.0)  #-#-#-#-#
+#. Theme URI of the plugin/theme
+#: footer.php:33
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:34
+msgid "Semantic Personal Publishing Platform"
+msgstr ""
+
+#: footer.php:35
+#, php-format
+msgid "Proudly powered by %s."
+msgstr ""
+
+#: functions.php:97
+msgid "Primary Navigation"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:133
+msgid "Berries"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:139
+msgid "Cherry Blossoms"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:145
+msgid "Concave"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:151
+msgid "Fern"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:157
+msgid "Forest Floor"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:163
+msgid "Inkwell"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:169
+msgid "Path"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:175
+msgid "Sunset"
+msgstr ""
+
+#: functions.php:237
+#, php-format
+msgid "Search results for %s"
+msgstr ""
+
+#: functions.php:240 functions.php:257
+#, php-format
+msgid "Page %s"
+msgstr ""
+
+#: functions.php:366
+#, php-format
+msgid "%s <span class=\"says\">says:</span>"
+msgstr ""
+
+#: functions.php:369
+msgid "Your comment is awaiting moderation."
+msgstr ""
+
+#. translators: 1: date, 2: time
+#: functions.php:376
+#, php-format
+msgid "%1$s at %2$s"
+msgstr ""
+
+#: functions.php:376 functions.php:393
+msgid "(Edit)"
+msgstr ""
+
+#: functions.php:393
+msgid "Pingback:"
+msgstr ""
+
+#: functions.php:412
+msgid "Primary Widget Area"
+msgstr ""
+
+#: functions.php:414
+msgid "The primary widget area"
+msgstr ""
+
+#: functions.php:423
+msgid "Secondary Widget Area"
+msgstr ""
+
+#: functions.php:425
+msgid "The secondary widget area"
+msgstr ""
+
+#: functions.php:434
+msgid "First Footer Widget Area"
+msgstr ""
+
+#: functions.php:436
+msgid "The first footer widget area"
+msgstr ""
+
+#: functions.php:445
+msgid "Second Footer Widget Area"
+msgstr ""
+
+#: functions.php:447
+msgid "The second footer widget area"
+msgstr ""
+
+#: functions.php:456
+msgid "Third Footer Widget Area"
+msgstr ""
+
+#: functions.php:458
+msgid "The third footer widget area"
+msgstr ""
+
+#: functions.php:467
+msgid "Fourth Footer Widget Area"
+msgstr ""
+
+#: functions.php:469
+msgid "The fourth footer widget area"
+msgstr ""
+
+#: functions.php:500
+#, php-format
+msgid ""
+"<span class=\"%1$s\">Posted on</span> %2$s <span class=\"meta-sep\">by</"
+"span> %3$s"
+msgstr ""
+
+#: functions.php:526
+#, php-format
+msgid ""
+"This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" "
+"title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: functions.php:528
+#, php-format
+msgid ""
+"This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title="
+"\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: functions.php:530
+#, php-format
+msgid ""
+"Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark"
+"\">permalink</a>."
+msgstr ""
+
+#: header.php:71
+msgid "Skip to content"
+msgstr ""
+
+#: loop.php:25 loop.php:172
+msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
+msgstr ""
+
+#: loop.php:26 loop.php:173
+msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: loop.php:35
+msgid ""
+"Apologies, but no results were found for the requested archive. Perhaps "
+"searching will help find a related post."
+msgstr ""
+
+#: loop.php:60 loop.php:91
+msgctxt "gallery category slug"
+msgid "gallery"
+msgstr ""
+
+#: loop.php:62 loop.php:82 loop.php:125
+#, php-format
+msgid "Permalink to %s"
+msgstr ""
+
+#: loop.php:81
+#, php-format
+msgid "This gallery contains <a %1$s>%2$s photos</a>."
+msgstr ""
+
+#: loop.php:91
+msgid "View posts in the Gallery category"
+msgstr ""
+
+#: loop.php:91
+msgid "More Galleries"
+msgstr ""
+
+#: loop.php:93 loop.php:116 loop.php:158
+msgid "Leave a comment"
+msgstr ""
+
+#: loop.php:93 loop.php:116 loop.php:158
+msgid "1 Comment"
+msgstr ""
+
+#: loop.php:93 loop.php:116 loop.php:158
+msgid "% Comments"
+msgstr ""
+
+#: loop.php:100
+msgctxt "asides category slug"
+msgid "asides"
+msgstr ""
+
+#: loop.php:145
+#, php-format
+msgid "<span class=\"%1$s\">Posted in</span> %2$s"
+msgstr ""
+
+#: loop.php:154
+#, php-format
+msgid "<span class=\"%1$s\">Tagged</span> %2$s"
+msgstr ""
+
+#: search.php:16
+#, php-format
+msgid "Search Results for: %s"
+msgstr ""
+
+#: search.php:26
+msgid "Nothing Found"
+msgstr ""
+
+#: search.php:28
+msgid ""
+"Sorry, but nothing matched your search criteria. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: sidebar.php:27
+msgid "Archives"
+msgstr ""
+
+#: sidebar.php:34
+msgid "Meta"
+msgstr ""
+
+#: single.php:18 single.php:58
+msgctxt "Previous post link"
+msgid "&larr;"
+msgstr ""
+
+#: single.php:19 single.php:59
+msgctxt "Next post link"
+msgid "&rarr;"
+msgstr ""
+
+#: single.php:44
+#, php-format
+msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: tag.php:16
+#, php-format
+msgid "Tag Archives: %s"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Ten"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid "The 2010 default theme for WordPress."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "the WordPress team"
+msgstr ""
+
+#. Tags of the plugin/theme
+msgid ""
+"black, blue, white, two-columns, fixed-width, custom-header, custom-"
+"background, threaded-comments, sticky-post, translation-ready, microformats, "
+"rtl-language-support, editor-style"
+msgstr ""
diff --git a/wp-content/themes/twentyten/license.txt b/wp-content/themes/twentyten/license.txt
new file mode 100644 (file)
index 0000000..5fbe4a7
--- /dev/null
@@ -0,0 +1,281 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. 
+              51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php
new file mode 100644 (file)
index 0000000..84c167d
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+/**
+ * The loop that displays posts.
+ *
+ * The loop displays the posts and the post content.  See
+ * http://codex.wordpress.org/The_Loop to understand it and
+ * http://codex.wordpress.org/Template_Tags to understand
+ * the tags used in it.
+ *
+ * This can be overridden in child themes with loop.php or
+ * loop-template.php, where 'template' is the loop context
+ * requested by a template. For example, loop-index.php would
+ * be used if it exists and we ask for the loop with:
+ * <code>get_template_part( 'loop', 'index' );</code>
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+<?php /* Display navigation to next/previous pages when applicable */ ?>
+<?php if ( $wp_query->max_num_pages > 1 ) : ?>
+       <div id="nav-above" class="navigation">
+               <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
+               <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+       </div><!-- #nav-above -->
+<?php endif; ?>
+
+<?php /* If there are no posts to display, such as an empty archive page */ ?>
+<?php if ( ! have_posts() ) : ?>
+       <div id="post-0" class="post error404 not-found">
+               <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
+               <div class="entry-content">
+                       <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
+                       <?php get_search_form(); ?>
+               </div><!-- .entry-content -->
+       </div><!-- #post-0 -->
+<?php endif; ?>
+
+<?php
+       /* Start the Loop.
+        *
+        * In Twenty Ten we use the same loop in multiple contexts.
+        * It is broken into three main parts: when we're displaying
+        * posts that are in the gallery category, when we're displaying
+        * posts in the asides category, and finally all other posts.
+        *
+        * Additionally, we sometimes check for whether we are on an
+        * archive page, a search page, etc., allowing for small differences
+        * in the loop on each template without actually duplicating
+        * the rest of the loop that is shared.
+        *
+        * Without further ado, the loop:
+        */ ?>
+<?php while ( have_posts() ) : the_post(); ?>
+
+<?php /* How to display posts in the Gallery category. */ ?>
+
+       <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
+               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                       <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+
+                       <div class="entry-meta">
+                               <?php twentyten_posted_on(); ?>
+                       </div><!-- .entry-meta -->
+
+                       <div class="entry-content">
+<?php if ( post_password_required() ) : ?>
+                               <?php the_content(); ?>
+<?php else : ?>
+                               <div class="gallery-thumb">
+<?php
+       $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
+       $total_images = count( $images );
+       $image = array_shift( $images );
+       $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
+?>
+                                       <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
+                               </div><!-- .gallery-thumb -->
+                               <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
+                                               'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
+                                               $total_images
+                                       ); ?></em></p>
+
+                               <?php the_excerpt(); ?>
+<?php endif; ?>
+                       </div><!-- .entry-content -->
+
+                       <div class="entry-utility">
+                               <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
+                               <span class="meta-sep">|</span>
+                               <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+                       </div><!-- .entry-utility -->
+               </div><!-- #post-## -->
+
+<?php /* How to display posts in the asides category */ ?>
+
+       <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>
+               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+               <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
+                       <div class="entry-summary">
+                               <?php the_excerpt(); ?>
+                       </div><!-- .entry-summary -->
+               <?php else : ?>
+                       <div class="entry-content">
+                               <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+                       </div><!-- .entry-content -->
+               <?php endif; ?>
+
+                       <div class="entry-utility">
+                               <?php twentyten_posted_on(); ?>
+                               <span class="meta-sep">|</span>
+                               <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+                       </div><!-- .entry-utility -->
+               </div><!-- #post-## -->
+
+<?php /* How to display all other posts. */ ?>
+
+       <?php else : ?>
+               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                       <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+
+                       <div class="entry-meta">
+                               <?php twentyten_posted_on(); ?>
+                       </div><!-- .entry-meta -->
+
+       <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
+                       <div class="entry-summary">
+                               <?php the_excerpt(); ?>
+                       </div><!-- .entry-summary -->
+       <?php else : ?>
+                       <div class="entry-content">
+                               <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+                               <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+                       </div><!-- .entry-content -->
+       <?php endif; ?>
+
+                       <div class="entry-utility">
+                               <?php if ( count( get_the_category() ) ) : ?>
+                                       <span class="cat-links">
+                                               <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
+                                       </span>
+                                       <span class="meta-sep">|</span>
+                               <?php endif; ?>
+                               <?php
+                                       $tags_list = get_the_tag_list( '', ', ' );
+                                       if ( $tags_list ):
+                               ?>
+                                       <span class="tag-links">
+                                               <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
+                                       </span>
+                                       <span class="meta-sep">|</span>
+                               <?php endif; ?>
+                               <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+                       </div><!-- .entry-utility -->
+               </div><!-- #post-## -->
+
+               <?php comments_template( '', true ); ?>
+
+       <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
+
+<?php endwhile; // End the loop. Whew. ?>
+
+<?php /* Display navigation to next/previous pages when applicable */ ?>
+<?php if (  $wp_query->max_num_pages > 1 ) : ?>
+                               <div id="nav-below" class="navigation">
+                                       <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
+                                       <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+                               </div><!-- #nav-below -->
+<?php endif; ?>
diff --git a/wp-content/themes/twentyten/onecolumn-page.php b/wp-content/themes/twentyten/onecolumn-page.php
new file mode 100644 (file)
index 0000000..90b1abf
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Template Name: One column, no sidebar
+ *
+ * A custom page template without sidebar.
+ *
+ * The "Template Name:" bit above allows this to be selectable
+ * from a dropdown menu on the edit page screen.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container" class="one-column">
+                       <div id="content" role="main">
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+                               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                                       <h1 class="entry-title"><?php the_title(); ?></h1>
+                                       <div class="entry-content">
+                                               <?php the_content(); ?>
+                                               <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+                                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+                                       </div><!-- .entry-content -->
+                               </div><!-- #post-## -->
+
+                               <?php comments_template( '', true ); ?>
+
+<?php endwhile; ?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/page.php b/wp-content/themes/twentyten/page.php
new file mode 100644 (file)
index 0000000..540767c
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * The template for displaying all pages.
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the wordpress construct of pages
+ * and that other 'pages' on your wordpress site will use a
+ * different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+                               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                                       <?php if ( is_front_page() ) { ?>
+                                               <h2 class="entry-title"><?php the_title(); ?></h2>
+                                       <?php } else { ?>       
+                                               <h1 class="entry-title"><?php the_title(); ?></h1>
+                                       <?php } ?>                              
+
+                                       <div class="entry-content">
+                                               <?php the_content(); ?>
+                                               <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+                                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+                                       </div><!-- .entry-content -->
+                               </div><!-- #post-## -->
+
+                               <?php comments_template( '', true ); ?>
+
+<?php endwhile; ?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/rtl.css b/wp-content/themes/twentyten/rtl.css
new file mode 100644 (file)
index 0000000..4ae54e4
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+Theme Name: Twenty Ten
+*/
+
+
+/*
+RTL Basics
+*/
+
+
+body {
+       direction:rtl;
+       unicode-bidi:embed;
+}
+
+
+/*
+LAYOUT: Two-Column (Right)
+DESCRIPTION: Two-column fixed layout with one sidebar right of content
+*/
+
+#container {
+       float: right;
+       margin: 0 0 0 -240px;
+}
+#content {
+       margin: 0 20px 36px 280px;
+}
+#primary,
+#secondary {
+       float: left;
+}
+#secondary {
+       clear: left;
+}
+
+
+/* =Fonts
+-------------------------------------------------------------- */
+body,
+input,
+textarea,
+.page-title span,
+.pingback a.url,
+h3#comments-title,
+h3#reply-title,
+#access .menu,
+#access div.menu ul,
+#cancel-comment-reply-link,
+.form-allowed-tags,
+#site-info,
+#site-title,
+#wp-calendar,
+.comment-meta,
+.comment-body tr th,
+.comment-body thead th,
+.entry-content label,
+.entry-content tr th,
+.entry-content thead th,
+.entry-meta,
+.entry-title,
+.entry-utility,
+#respond label,
+.navigation,
+.page-title,
+.pingback p,
+.reply,
+.widget-title,
+input[type=submit] {
+       font-family: Arial, Tahoma, sans-serif;
+}
+
+/* =Structure
+-------------------------------------------------------------- */
+
+/* The main theme structure */
+#footer-widget-area .widget-area {
+       float: right;
+       margin-left: 20px;
+       margin-right: 0;
+}
+#footer-widget-area #fourth {
+       margin-left: 0;
+}
+#site-info {
+       float: right;
+}
+#site-generator {
+       float: left;
+}
+
+
+/* =Global Elements
+-------------------------------------------------------------- */
+
+/* Text elements */
+ul {
+       margin: 0 1.5em 18px 0;
+}
+blockquote {
+       font-style: normal;
+}
+
+/* Text meant only for screen readers */
+.screen-reader-text {
+       left: auto;
+       text-indent:-9000px;
+       overflow:hidden;
+}
+
+
+/* =Header
+-------------------------------------------------------------- */
+
+#site-title {
+       float: right;
+}
+#site-description {
+       clear: left;
+       float: left;
+       font-style: normal;
+}
+
+/* =Menu
+-------------------------------------------------------------- */
+
+#access {
+       float:right;
+}
+
+#access .menu-header,
+div.menu {
+    margin-right: 12px;
+    margin-left: 0;
+}
+
+#access .menu-header li,
+div.menu li{
+       float:right;
+}
+
+#access ul ul {
+       left:auto;
+       right:0;
+       float:right;
+}
+#access ul ul ul {
+       left:auto;
+       right:100%;
+}
+
+/* =Content
+-------------------------------------------------------------- */
+
+#content table {
+       text-align: right;
+       margin: 0 0 24px -1px;
+}
+.page-title span {
+       font-style:normal;
+}
+.entry-title,
+.entry-meta {
+       clear: right;
+       float: right;
+       margin-left: 68px;
+       margin-right: 0;
+}
+
+.entry-content input.file,
+.entry-content input.button {
+       margin-left: 24px;
+       margin-right:0;
+}
+.entry-content blockquote.left {
+       float: right;
+       margin-right: 0;
+       margin-left: 24px;
+       text-align: left;
+}
+.entry-content blockquote.right {
+       float: left;
+       margin-right: 24px;
+       margin-left: 0;
+       text-align: right;
+}
+#entry-author-info #author-avatar {
+       float: right;
+       margin: 0 0 0 -104px;
+}
+#entry-author-info #author-description {
+       float: right;
+       margin: 0 104px 0 0;
+}
+
+/* Gallery listing
+-------------------------------------------------------------- */
+
+.category-gallery .gallery-thumb {
+       float: right;
+       margin-left:20px;
+       margin-right:0;
+}
+
+
+/* Images
+-------------------------------------------------------------- */
+
+#content .gallery .gallery-caption {
+       margin-right: 0;
+}
+
+#content .gallery .gallery-item {
+       float: right;
+}
+
+/* =Navigation
+-------------------------------------------------------------- */
+.nav-previous {
+       float: right;
+}
+.nav-next {
+       float: left;
+       text-align:left;
+}
+
+/* =Comments
+-------------------------------------------------------------- */
+
+.commentlist li.comment {
+       padding: 0 56px 0 0;
+}
+.commentlist .avatar {
+       right: 0;
+       left: auto;
+}
+.comment-author .says, #comments .pingback .url  {
+       font-style: normal;
+}
+
+/* Comments form */
+.children #respond {
+       margin: 0 0 0 48px;
+}
+
+/* =Widget Areas
+-------------------------------------------------------------- */
+
+.widget-area ul {
+       margin-right: 0;
+}
+.widget-area ul ul {
+       margin-right: 1.3em;
+       margin-left: 0;
+}
+#wp-calendar caption {
+       text-align: right;
+}
+#wp-calendar tfoot #next {
+       text-align: left;
+}
+
+/* Main sidebars */
+#main .widget-area ul {
+       margin-right: 0;
+       padding: 0 0 0 20px;
+}
+#main .widget-area ul ul {
+       margin-right: 1.3em;
+       margin-left: 0;
+}
+
+/* =Footer
+-------------------------------------------------------------- */
+#site-generator {
+       font-style:normal;
+}
+#site-generator a {
+       background-position: right center;
+       padding-right: 20px;
+       padding-left: 0;
+}
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/screenshot.png b/wp-content/themes/twentyten/screenshot.png
new file mode 100644 (file)
index 0000000..256069f
Binary files /dev/null and b/wp-content/themes/twentyten/screenshot.png differ
diff --git a/wp-content/themes/twentyten/search.php b/wp-content/themes/twentyten/search.php
new file mode 100644 (file)
index 0000000..3b198bb
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * The template for displaying Search Results pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php if ( have_posts() ) : ?>
+                               <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyten' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
+                               <?php
+                               /* Run the loop for the search to output the results.
+                                * If you want to overload this in a child theme then include a file
+                                * called loop-search.php and that will be used instead.
+                                */
+                                get_template_part( 'loop', 'search' );
+                               ?>
+<?php else : ?>
+                               <div id="post-0" class="post no-results not-found">
+                                       <h2 class="entry-title"><?php _e( 'Nothing Found', 'twentyten' ); ?></h2>
+                                       <div class="entry-content">
+                                               <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?></p>
+                                               <?php get_search_form(); ?>
+                                       </div><!-- .entry-content -->
+                               </div><!-- #post-0 -->
+<?php endif; ?>
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/sidebar-footer.php b/wp-content/themes/twentyten/sidebar-footer.php
new file mode 100644 (file)
index 0000000..0e9f702
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The Footer widget areas.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+<?php
+       /* The footer widget area is triggered if any of the areas
+        * have widgets. So let's check that first.
+        *
+        * If none of the sidebars have widgets, then let's bail early.
+        */
+       if (   ! is_active_sidebar( 'first-footer-widget-area'  )
+               && ! is_active_sidebar( 'second-footer-widget-area' )
+               && ! is_active_sidebar( 'third-footer-widget-area'  )
+               && ! is_active_sidebar( 'fourth-footer-widget-area' )
+       )
+               return;
+       // If we get this far, we have widgets. Let do this.
+?>
+
+                       <div id="footer-widget-area" role="complementary">
+
+<?php if ( is_active_sidebar( 'first-footer-widget-area' ) ) : ?>
+                               <div id="first" class="widget-area">
+                                       <ul class="xoxo">
+                                               <?php dynamic_sidebar( 'first-footer-widget-area' ); ?>
+                                       </ul>
+                               </div><!-- #first .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'second-footer-widget-area' ) ) : ?>
+                               <div id="second" class="widget-area">
+                                       <ul class="xoxo">
+                                               <?php dynamic_sidebar( 'second-footer-widget-area' ); ?>
+                                       </ul>
+                               </div><!-- #second .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'third-footer-widget-area' ) ) : ?>
+                               <div id="third" class="widget-area">
+                                       <ul class="xoxo">
+                                               <?php dynamic_sidebar( 'third-footer-widget-area' ); ?>
+                                       </ul>
+                               </div><!-- #third .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'fourth-footer-widget-area' ) ) : ?>
+                               <div id="fourth" class="widget-area">
+                                       <ul class="xoxo">
+                                               <?php dynamic_sidebar( 'fourth-footer-widget-area' ); ?>
+                                       </ul>
+                               </div><!-- #fourth .widget-area -->
+<?php endif; ?>
+
+                       </div><!-- #footer-widget-area -->
diff --git a/wp-content/themes/twentyten/sidebar.php b/wp-content/themes/twentyten/sidebar.php
new file mode 100644 (file)
index 0000000..7e2565b
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+/**
+ * The Sidebar containing the primary and secondary widget areas.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+               <div id="primary" class="widget-area" role="complementary">
+                       <ul class="xoxo">
+
+<?php
+       /* When we call the dynamic_sidebar() function, it'll spit out
+        * the widgets for that widget area. If it instead returns false,
+        * then the sidebar simply doesn't exist, so we'll hard-code in
+        * some default sidebar stuff just in case.
+        */
+       if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
+       
+                       <li id="search" class="widget-container widget_search">
+                               <?php get_search_form(); ?>
+                       </li>
+
+                       <li id="archives" class="widget-container">
+                               <h3 class="widget-title"><?php _e( 'Archives', 'twentyten' ); ?></h3>
+                               <ul>
+                                       <?php wp_get_archives( 'type=monthly' ); ?>
+                               </ul>
+                       </li>
+
+                       <li id="meta" class="widget-container">
+                               <h3 class="widget-title"><?php _e( 'Meta', 'twentyten' ); ?></h3>
+                               <ul>
+                                       <?php wp_register(); ?>
+                                       <li><?php wp_loginout(); ?></li>
+                                       <?php wp_meta(); ?>
+                               </ul>
+                       </li>
+
+               <?php endif; // end primary widget area ?>
+                       </ul>
+               </div><!-- #primary .widget-area -->
+
+<?php
+       // A second sidebar for widgets, just because.
+       if ( is_active_sidebar( 'secondary-widget-area' ) ) : ?>
+
+               <div id="secondary" class="widget-area" role="complementary">
+                       <ul class="xoxo">
+                               <?php dynamic_sidebar( 'secondary-widget-area' ); ?>
+                       </ul>
+               </div><!-- #secondary .widget-area -->
+
+<?php endif; ?>
diff --git a/wp-content/themes/twentyten/single.php b/wp-content/themes/twentyten/single.php
new file mode 100644 (file)
index 0000000..f97fd46
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * The Template for displaying all single posts.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+                               <div id="nav-above" class="navigation">
+                                       <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
+                                       <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
+                               </div><!-- #nav-above -->
+
+                               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+                                       <h1 class="entry-title"><?php the_title(); ?></h1>
+
+                                       <div class="entry-meta">
+                                               <?php twentyten_posted_on(); ?>
+                                       </div><!-- .entry-meta -->
+
+                                       <div class="entry-content">
+                                               <?php the_content(); ?>
+                                               <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+                                       </div><!-- .entry-content -->
+
+<?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries  ?>
+                                       <div id="entry-author-info">
+                                               <div id="author-avatar">
+                                                       <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); ?>
+                                               </div><!-- #author-avatar -->
+                                               <div id="author-description">
+                                                       <h2><?php printf( esc_attr__( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
+                                                       <?php the_author_meta( 'description' ); ?>
+                                                       <div id="author-link">
+                                                               <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
+                                                                       <?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyten' ), get_the_author() ); ?>
+                                                               </a>
+                                                       </div><!-- #author-link -->
+                                               </div><!-- #author-description -->
+                                       </div><!-- #entry-author-info -->
+<?php endif; ?>
+
+                                       <div class="entry-utility">
+                                               <?php twentyten_posted_in(); ?>
+                                               <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+                                       </div><!-- .entry-utility -->
+                               </div><!-- #post-## -->
+
+                               <div id="nav-below" class="navigation">
+                                       <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
+                                       <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
+                               </div><!-- #nav-below -->
+
+                               <?php comments_template( '', true ); ?>
+
+<?php endwhile; // end of the loop. ?>
+
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
diff --git a/wp-content/themes/twentyten/style.css b/wp-content/themes/twentyten/style.css
new file mode 100644 (file)
index 0000000..71a129e
--- /dev/null
@@ -0,0 +1,1346 @@
+/*
+Theme Name: Twenty Ten
+Theme URI: http://wordpress.org/
+Description: The 2010 default theme for WordPress.
+Author: the WordPress team
+Version: 1.0
+Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style
+*/
+
+
+/* Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html
+-------------------------------------------------------------- */
+
+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;
+       vertical-align: baseline;
+       background: transparent;
+}
+body {
+       line-height: 1;
+}
+h1, h2, h3, h4, h5, h6 {
+       font-weight: normal;
+       clear: both;
+}
+ol, ul {
+       list-style: none;
+}
+blockquote {
+       quotes: none;
+}
+blockquote:before, blockquote:after {
+       content: '';
+       content: none;
+}
+del {
+       text-decoration: line-through;
+}
+/* tables still need 'cellspacing="0"' in the markup */
+table {
+       border-collapse: collapse;
+       border-spacing: 0;
+}
+a img { border: none; }
+
+
+
+/*
+LAYOUT: Two columns
+DESCRIPTION: Two-column fixed layout with one sidebar right of content
+*/
+
+#container {
+       float: left;
+       margin: 0 -240px 0 0;
+       width: 100%;
+}
+#content {
+       margin: 0 280px 0 20px;
+}
+#primary,
+#secondary {
+       float: right;
+       overflow: hidden;
+       width: 220px;
+}
+#secondary {
+       clear: right;
+}
+#footer {
+       clear: both;
+       width: 100%;
+}
+
+/*
+LAYOUT: One column, no sidebar
+DESCRIPTION: One centered column with no sidebar
+*/
+
+.one-column #content {
+       margin: 0 auto;
+       width: 640px;
+}
+
+/*
+LAYOUT: Full width, no sidebar
+DESCRIPTION: Full width content with no sidebar; used for attachment pages
+*/
+
+.single-attachment #content {
+       margin: 0 auto;
+       width: 900px;
+}
+
+
+/* =Fonts
+-------------------------------------------------------------- */
+body,
+input,
+textarea,
+.page-title span,
+.pingback a.url {
+       font-family: Georgia, "Bitstream Charter", serif;
+}
+
+h3#comments-title,
+h3#reply-title,
+#access .menu,
+#access div.menu ul,
+#cancel-comment-reply-link,
+.form-allowed-tags,
+#site-info,
+#site-title,
+#wp-calendar,
+.comment-meta,
+.comment-body tr th,
+.comment-body thead th,
+.entry-content label,
+.entry-content tr th,
+.entry-content thead th,
+.entry-meta,
+.entry-title,
+.entry-utility,
+#respond label,
+.navigation,
+.page-title,
+.pingback p,
+.reply,
+.widget-title,
+.wp-caption-text,
+input[type=submit]
+{
+       font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
+}
+pre {
+       font-family: "Courier 10 Pitch", Courier, monospace;
+}
+code {
+       font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
+}
+
+
+
+/* =Structure
+-------------------------------------------------------------- */
+
+/* The main theme structure */
+#access .menu-header,
+div.menu,
+#colophon,
+#branding,
+#main,
+#wrapper {
+       margin: 0 auto;
+       width: 940px;
+}
+#wrapper {
+       margin-top: 20px;
+       background: #fff;
+       padding: 0 20px;
+}
+
+/* Structure the footer area */
+#footer-widget-area {
+       overflow: hidden;
+}
+#footer-widget-area .widget-area {
+       float: left;
+       margin-right: 20px;
+       width: 220px;
+}
+#footer-widget-area #fourth {
+       margin-right: 0;
+}
+#site-info {
+       float: left;
+       width: 700px;
+       font-weight: bold;
+       font-size: 14px;
+}
+#site-generator {
+       float: right;
+       width: 220px;
+}
+
+
+
+/* =Global Elements
+-------------------------------------------------------------- */
+
+/* Main global 'theme' and typographic styles  */
+body {
+       background: #f1f1f1;
+}
+
+body,
+input,
+textarea {
+       color: #666;
+       font-size: 12px;
+       line-height: 18px;
+}
+hr {
+       background-color: #E7E7E7;
+       border:0;
+       height: 1px;
+       margin-bottom: 18px;
+       clear:both;
+}
+
+/* Text elements */
+p {
+       margin-bottom: 18px;
+}
+ul {
+       list-style: square;
+       margin: 0 0 18px 1.5em;
+}
+ol {
+       list-style: decimal;
+       margin: 0 0 18px 1.5em;
+}
+ol ol {
+       list-style:upper-alpha;
+}
+ol ol ol {
+       list-style:lower-roman;
+}
+ol ol ol ol {
+       list-style:lower-alpha;
+}
+ul ul,
+ol ol,
+ul ol,
+ol ul {
+       margin-bottom:0;
+}
+dl {
+       margin:0 0 24px 0;
+}
+dt {
+       font-weight: bold;
+}
+dd {
+       margin-bottom: 18px;
+}
+strong {
+       font-weight: bold;
+}
+cite,
+em,
+i {
+       font-style: italic;
+}
+big {
+       font-size: 131.25%;
+}
+ins {
+       background: #ffc;
+       text-decoration: none;
+}
+blockquote {
+       font-style: italic;
+       padding: 0 3em;
+}
+blockquote cite,
+blockquote em,
+blockquote i {
+       font-style: normal;
+}
+pre {
+       background: #f7f7f7;
+       color: #222;
+       line-height: 18px;
+       margin-bottom: 18px;
+       padding: 1.5em;
+}
+abbr,
+acronym {
+       border-bottom: 1px dotted #666;
+       cursor: help;
+}
+
+sup,
+sub {
+       height: 0;
+       line-height: 1;
+       vertical-align: baseline;
+       position: relative;
+}
+sup {
+       bottom: 1ex;
+}
+sub {
+       top: .5ex;
+}
+input[type="text"],
+textarea {
+       padding: 2px;
+       background: #f9f9f9;
+       border: 1px solid #ccc;
+       box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1);
+       -moz-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1);
+       -webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1);
+}
+a:link {
+       color:#0066CC;
+}
+a:visited {
+       color:#743399;
+}
+a:active,
+a:hover {
+       color: #FF4B33;
+}
+
+/* Text meant only for screen readers */
+.screen-reader-text {
+       position: absolute;
+       left: -9000px;
+}
+
+
+
+/* =Header
+-------------------------------------------------------------- */
+
+#header {
+       padding: 30px 0 0 0;
+}
+#site-title {
+       float: left;
+       margin: 0 0 18px 0;
+       width: 700px;
+       font-size: 30px;
+       line-height: 36px;
+}
+#site-title a {
+       color: #000;
+       font-weight: bold;
+       text-decoration: none;
+}
+#site-description {
+       clear: right;
+       float: right;
+       font-style: italic;
+       margin: 14px 0 18px 0;
+       width: 220px;
+}
+
+/* This is the custom header image */
+#branding img {
+       clear: both;
+       border-top: 4px solid #000;
+       display: block;
+       border-bottom: 1px solid #000;
+}
+
+
+
+/* =Menu
+-------------------------------------------------------------- */
+
+#access {
+       background: #000;
+       margin: 0 auto;
+       width: 940px;
+       display:block;
+       float:left;
+}
+#access .menu-header,
+div.menu {
+       font-size: 13px;
+       margin-left: 12px;
+}
+#access .menu-header ul,
+div.menu ul {
+       list-style: none;
+       margin: 0;
+}
+#access .menu-header li,
+div.menu li {
+       float:left;
+       position: relative;
+}
+#access a {
+       display:block;
+       text-decoration:none;
+       color:#aaa;
+       padding:0 10px;
+       line-height:38px;
+}
+#access ul ul {
+       display:none;
+       position:absolute;
+       top:38px;
+       left:0;
+       float:left;
+       box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
+       -moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
+       -webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
+       width: 180px;
+       z-index: 99999;
+}
+#access ul ul li {
+       min-width: 180px;       
+}
+#access ul ul ul {
+       left:100%;
+       top:0;
+}
+#access ul ul a {
+       background:#333;
+       height:auto;
+       line-height:1em;
+       padding:10px;
+       width: 160px;
+}
+#access li:hover > a,
+#access ul ul :hover > a {
+       color:#fff;
+       background:#333;
+}
+#access ul li:hover > ul {
+       display:block;
+}
+#access ul li.current_page_item > a,
+#access ul li.current-menu-ancestor > a,
+#access ul li.current-menu-item > a,
+#access ul li.current-menu-parent > a {
+       color: #fff;
+}
+
+* html #access ul li.current_page_item a,
+* html #access ul li.current-menu-ancestor a,
+* html #access ul li.current-menu-item a,
+* html #access ul li.current-menu-parent a,
+* html #access ul li a:hover {
+       color:#fff;
+}
+
+/* =Content
+-------------------------------------------------------------- */
+
+#main {
+       overflow: hidden;
+       padding: 40px 0 0 0;
+}
+#content {
+       margin-bottom: 36px;
+}
+#content,
+#content input,
+#content textarea {
+       color: #333;
+       font-size: 16px;
+       line-height: 24px;
+}
+#content p,
+#content ul,
+#content ol,
+#content dd,
+#content pre,
+#content hr {
+       margin-bottom:24px;
+}
+#content ul ul,
+#content ol ol,
+#content ul ol,
+#content ol ul {
+       margin-bottom:0;
+}
+#content pre,
+#content kbd,
+#content tt,
+#content var {
+       font-size: 15px;
+       line-height: 21px;
+}
+#content code {
+       font-size: 13px;
+}
+#content dt,
+#content th {
+       color: #000;
+}
+#content h1,
+#content h2,
+#content h3,
+#content h4,
+#content h5,
+#content h6 {
+       color: #000;
+       margin: 0 0 20px 0;
+       line-height: 1.5em;
+}
+#content table {
+       border: 1px solid #e7e7e7;
+       text-align: left;
+       margin: 0 -1px 24px 0;
+       width: 100%;
+}
+#content tr th,
+#content thead th {
+       color: #888;
+       font-size: 12px;
+       font-weight: bold;
+       line-height: 18px;
+       padding: 9px 24px;
+}
+#content tr td {
+       border-top: 1px solid #e7e7e7;
+       padding: 6px 24px;
+}
+#content tr.odd td {
+       background: #F2F7FC;
+}
+.hentry {
+       margin: 0 0 48px 0;
+}
+.home .sticky {
+       background: #F2F7FC;
+       border-top: 4px solid #000;
+       padding: 18px 20px;
+       margin-left: -20px;
+       margin-right: -20px;
+}
+.single .hentry {
+       margin: 0 0 36px 0;
+}
+.page-title {
+       color: #000;
+       font-size: 14px;
+       font-weight: bold;
+       margin: 0 0 36px 0;
+}
+.page-title span {
+       color: #333;
+       font-size: 16px;
+       font-style: italic;
+       font-weight: normal;
+}
+.page-title a:link,
+.page-title a:visited {
+       color:#888;
+       text-decoration: none;
+}
+.page-title a:active,
+.page-title a:hover {
+       color: #FF4B33;
+}
+#content .entry-title {
+       color: #000;
+       font-size: 21px;
+       line-height: 1.3em;
+       font-weight: bold;
+       margin-bottom: 0;
+}
+.entry-title a:link,
+.entry-title a:visited {
+       color:#000;
+       text-decoration: none;
+}
+.entry-title a:active,
+.entry-title a:hover {
+       color: #FF4B33;
+}
+.entry-meta {
+       color: #888;
+       font-size: 12px;
+}
+.entry-meta abbr,
+.entry-utility abbr {
+       border: none;
+}
+.entry-meta abbr:hover,
+.entry-utility abbr:hover {
+       border-bottom: 1px dotted #666;
+}
+.entry-content,
+.entry-summary {
+       clear: both;
+       padding: 12px 0 0 0;
+}
+#content .entry-summary p:last-child {
+       margin-bottom: 12px;
+}
+.entry-content fieldset {
+       border: 1px solid #E7E7E7;
+       margin: 0 0 24px 0;
+       padding: 24px;
+}
+.entry-content fieldset legend {
+       background: #fff;
+       color: #000;
+       font-weight: bold;
+       padding: 0 24px;
+}
+.entry-content input {
+       margin: 0 0 24px 0;
+}
+.entry-content input.file,
+.entry-content input.button {
+       margin-right: 24px;
+}
+.entry-content label {
+       color: #888;
+       font-size: 12px;
+}
+.entry-content select {
+       margin: 0 0 24px 0;
+}
+.entry-content sup,
+.entry-content sub {
+       font-size: 10px;
+}
+.entry-content blockquote.left {
+       float: left;
+       margin-left: 0;
+       margin-right: 24px;
+       text-align: right;
+       width: 33%;
+}
+.entry-content blockquote.right {
+       float: right;
+       margin-left: 24px;
+       margin-right: 0;
+       text-align: left;
+       width: 33%;
+}
+.page-link {
+       color: #000;
+       font-weight:bold;
+       margin:0 0 22px 0;
+       word-spacing:0.5em;
+}
+.page-link a:link,
+.page-link a:visited {
+       background: #f1f1f1;
+       color:#333;
+       font-weight:normal;
+       padding:0.5em 0.75em;
+       text-decoration:none;
+}
+.home .sticky .page-link a {
+       background: #D9E8F7;
+}
+.page-link a:active,
+.page-link a:hover {
+       color: #FF4B33;
+}
+.page .edit-link {
+       clear: both;
+       display: block;
+}
+#entry-author-info {
+       background: #F2F7FC;
+       border-top: 4px solid #000;
+       padding: 18px 20px;
+       margin: 24px 0;
+       overflow: hidden;
+       clear: both;
+       font-size: 14px;
+       line-height: 20px;
+}
+#entry-author-info #author-avatar {
+       background: #fff;
+       border: 1px solid #e7e7e7;
+       float: left;
+       margin: 0 -104px 0 0;
+       padding: 11px;
+       height: 60px;
+}
+#entry-author-info #author-description {
+       float: left;
+       margin: 0 0 0 104px;
+}
+#entry-author-info h2 {
+       color: #000;
+       font-weight: bold;
+       font-size: 100%;
+       margin-bottom: 0;
+}
+.entry-utility {
+       color: #888;
+       font-size: 12px;
+       line-height: 18px;
+       clear: both;
+}
+.entry-meta a,
+.entry-utility a {
+       color: #888;
+}
+.entry-meta a:hover,
+.entry-utility a:hover {
+       color: #FF4B33;
+}
+#content .video-player {
+       padding: 0;
+}
+
+
+
+/* Asides
+-------------------------------------------------------------- */
+
+.home #content .category-asides p {
+       font-size: 14px;
+       line-height: 20px;
+       margin-bottom: 10px;
+       margin-top:0;
+}
+.home .hentry.category-asides {
+       padding: 0;
+}
+.home #content .category-asides .entry-content {
+       padding-top: 0;
+}
+
+
+
+
+/* Gallery listing
+-------------------------------------------------------------- */
+
+.category-gallery {
+       margin-bottom: 48px;
+}
+.category-gallery h2 {
+       margin-top: 10px;
+}
+.category-gallery .entry-meta {
+}
+.category-gallery .size-thumbnail img {
+       border: 10px solid #f1f1f1;
+       margin-bottom: 0;
+}
+.category-gallery .gallery-thumb {
+       float: left;
+       margin-right:20px;
+       margin-top: -4px;
+}
+.home #content .category-gallery .entry-content p {
+       display: inline;
+}
+.home #content .category-gallery .entry-utility {
+       padding-top:4px;
+}
+
+
+/* Attachment pages
+-------------------------------------------------------------- */
+
+.entry-content .attachment img {
+       margin-bottom: 0;
+}
+.attachment .entry-content .entry-caption {
+       font-size: 140%;
+       margin-top: 24px;
+}
+.attachment .entry-content .nav-previous a:before {
+       content: '\2190\00a0';
+}
+.attachment .entry-content .nav-next a:after {
+       content: '\00a0\2192';
+}
+
+
+
+/* Images
+-------------------------------------------------------------- */
+
+#content img {
+       margin: 0;
+       max-width: 640px;
+}
+#content .attachment img {
+       max-width: 900px;
+}
+#content .alignleft,
+#content img.alignleft {
+       display: inline;
+       float: left;
+       margin-right: 24px;
+       margin-top: 4px;
+}
+#content .alignright,
+#content img.alignright {
+       display: inline;
+       float: right;
+       margin-left: 24px;
+       margin-top: 4px;
+}
+#content .aligncenter,
+#content img.aligncenter {
+       clear: both;
+       display: block;
+       margin-left: auto;
+       margin-right: auto;
+}
+#content img.alignleft, 
+#content img.alignright, 
+#content img.aligncenter {
+       margin-bottom: 12px;
+}
+#content .wp-caption {
+       background: #f1f1f1;
+       line-height: 18px;
+       text-align: center;
+       margin-bottom: 20px;
+       padding: 4px;
+}
+#content .wp-caption img {
+       margin: 5px 5px 0;
+}
+#content .wp-caption p.wp-caption-text {
+       margin: 5px;
+       color: #888;
+       font-size: 12px;
+}
+#content .wp-smiley {
+       margin:0;
+}
+#content .gallery {
+       margin: auto;
+}
+#content .gallery .gallery-item {
+       float: left;
+       margin-top: 0;
+       text-align: center;
+       width: 33%;
+}
+#content .gallery img {
+       border: 2px solid #cfcfcf;
+}
+#content .gallery .gallery-caption {
+       color: #888;
+       font-size: 12px;
+       margin: 0 0 12px;
+}
+#content .gallery dl {
+       margin: 0;
+}
+#content .gallery img {
+       border: 10px solid #f1f1f1;
+}
+#content .gallery br+br {
+       display: none;
+}
+
+
+
+/* =Navigation
+-------------------------------------------------------------- */
+
+.navigation {
+       font-size:  12px;
+       line-height: 18px;
+       overflow: hidden;
+       color: #888;
+}
+.navigation a:link,
+.navigation a:visited {
+       color: #888;
+       text-decoration: none;
+}
+.navigation a:active,
+.navigation a:hover {
+       color: #FF4B33;
+}
+.nav-previous {
+       float: left;
+       width: 50%;
+}
+.nav-next {
+       float: right;
+       width: 50%;
+       text-align:right;
+}
+#nav-above {
+       margin: 0 0 18px 0;
+}
+#nav-above {
+       display: none;
+}
+.paged #nav-above,
+.single #nav-above {
+       display: block;
+}
+#nav-below {
+       margin: -18px 0 0 0;
+}
+
+
+
+/* =Comments
+-------------------------------------------------------------- */
+#comments {
+       clear: both;
+}
+#comments .navigation {
+       padding: 0 0 18px 0;
+}
+h3#comments-title,
+h3#reply-title {
+       color: #000;
+       font-weight: bold;
+       font-size: 20px;
+       margin-bottom: 0;
+}
+h3#comments-title {
+       padding: 24px 0;
+}
+.commentlist {
+       list-style: none;
+       margin: 0;
+}
+.commentlist li.comment {
+       border-bottom: 1px solid #e7e7e7;
+       line-height: 24px;
+       margin: 0 0 24px 0;
+       padding: 0 0 0 56px;
+       position: relative;
+}
+.commentlist li:last-child {
+       border-bottom:none;
+       margin-bottom:0;
+}
+#comments .comment-body ul,
+#comments .comment-body ol {
+       margin-bottom: 18px;
+}
+#comments .comment-body p:last-child {
+       margin-bottom: 6px;
+}
+#comments .comment-body blockquote p:last-child {
+       margin-bottom: 24px;
+}
+.commentlist ol {
+       list-style: decimal;
+}
+.commentlist .avatar {
+       position: absolute;
+       top: 4px;
+       left: 0;
+}
+.comment-author {
+}
+.comment-author cite {
+       color: #000;
+       font-style: normal;
+       font-weight: bold;
+}
+.comment-author .says {
+       font-style: italic;
+}
+.comment-meta {
+       font-size: 12px;
+       margin: 0 0 18px 0;
+}
+.comment-meta a:link,
+.comment-meta a:visited {
+       color: #888;
+       text-decoration: none;
+}
+.comment-meta a:active,
+.comment-meta a:hover {
+       color: #FF4B33;
+}
+.commentlist .even {
+}
+.commentlist .bypostauthor {
+}
+.reply {
+       font-size: 12px;
+       padding: 0 0 24px 0;
+}
+.reply a,
+a.comment-edit-link {
+       color: #888;
+}
+.reply a:hover,
+a.comment-edit-link:hover {
+       color: #FF4B33;
+}
+.commentlist .children {
+       list-style: none;
+       margin: 0;
+}
+.commentlist .children li {
+       border: none;
+       margin: 0;
+}
+.nopassword,
+.nocomments {
+       display: none;
+}
+#comments .pingback {
+       margin-bottom: 18px;
+       padding-bottom: 18px;
+       border-bottom: 1px solid #e7e7e7;
+}
+.commentlist li.comment+li.pingback {
+       margin-top: -6px;
+}
+#comments .pingback p {
+       color: #888;
+       font-size: 12px;
+       line-height: 18px;
+       display:block;
+       margin: 0;
+}
+#comments .pingback .url {
+       font-style: italic;
+       font-size: 13px;
+}
+
+
+
+/* Comments form */
+input[type=submit] {
+       color: #333;
+}
+#respond {
+       margin: 24px 0;
+       border-top: 1px solid #e7e7e7;
+       overflow: hidden;
+       position: relative;
+}
+#respond p {
+       margin: 0;
+}
+#respond .comment-notes {
+       margin-bottom: 1em;
+}
+.form-allowed-tags {
+       line-height: 1em;
+}
+.children #respond {
+       margin: 0 48px 0 0;
+}
+h3#reply-title {
+       margin: 18px 0;
+}
+#comments-list #respond {
+       margin: 0 0 18px 0;
+}
+#comments-list ul #respond {
+       margin: 0;
+}
+#cancel-comment-reply-link {
+       font-size: 12px;
+       line-height: 18px;
+       font-weight: normal;
+}
+#respond .required {
+       color:#FF4B33;
+       font-weight:bold;
+}
+#respond label {
+       color: #888;
+       font-size: 12px;
+}
+#respond input {
+       margin:0 0 9px;
+       width:98%;
+}
+#respond textarea {
+       width:98%;
+}
+#respond .form-allowed-tags {
+       color: #888;
+       font-size: 12px;
+       line-height: 18px;
+}
+#respond .form-allowed-tags code {
+       font-size: 11px;
+}
+#respond .form-submit {
+       margin: 12px 0;
+}
+#respond .form-submit input {
+       width: auto;
+       font-size: 14px;
+}
+
+
+/* =Widget Areas
+-------------------------------------------------------------- */
+
+.widget-area ul {
+       list-style: none;
+       margin-left: 0;
+}
+.widget-area ul ul {
+       list-style: square;
+       margin-left: 1.3em;
+}
+.widget_search #s { /* This keeps the search inputs in line */
+       width: 60%;
+}
+.widget_search label {
+       display:none;
+}
+.widget-container {
+       margin: 0 0 18px 0;
+}
+.widget-title {
+       color: #222;
+       font-weight: bold;
+}
+.widget-area a:link,
+.widget-area a:visited {
+       text-decoration: none;
+}
+.widget-area a:active,
+.widget-area a:hover {
+       text-decoration: underline;
+}
+.widget-area .entry-meta {
+       font-size: 11px;
+}
+#wp_tag_cloud div {
+       line-height: 1.6em;
+}
+#wp-calendar {
+       width:100%;
+}
+#wp-calendar caption {
+       font-weight: bold;
+       color: #222;
+       text-align: left;
+       font-size:14px;
+       padding-bottom: 4px;
+}
+#wp-calendar thead {
+       font-size:11px;
+}
+#wp-calendar thead th {
+}
+#wp-calendar tbody {
+       color: #aaa;
+}
+#wp-calendar tbody td {
+       padding: 3px 0 2px;
+       background: #f5f5f5;
+       border:1px solid #fff;
+       text-align: center;
+}
+#wp-calendar tbody .pad {
+       background: none;
+}
+#wp-calendar tfoot #next {
+       text-align: right;
+}
+.widget_rss a.rsswidget {
+       color: #000;
+}
+.widget_rss a.rsswidget:hover {
+       color: #FF4B33;
+}
+.widget_rss .widget-title img {
+       height: 11px;
+       width: 11px;
+}
+
+/* Main sidebars */
+#main .widget-area ul {
+       margin-left: 0;
+       padding: 0 20px 0 0;
+}
+#main .widget-area ul ul {
+       border: none;
+       margin-left: 1.3em;
+       padding: 0;
+}
+#primary {
+}
+#secondary {
+}
+
+/* Footer widget areas */
+#footer-widget-area {
+}
+
+
+
+/* =Footer
+-------------------------------------------------------------- */
+
+#footer {
+       margin-bottom: 20px;
+}
+#colophon {
+       border-top: 4px solid #000;
+       margin-top: -4px;
+       padding: 18px 0;
+       overflow: hidden;
+}
+#site-info {
+       font-weight: bold;
+}
+#site-info a {
+       color: #000;
+       text-decoration: none;
+}
+#site-generator {
+       position: relative;
+       font-style: italic;
+}
+#site-generator a {
+       color: #666;
+       display:inline-block;
+       text-decoration: none;
+       background: url(images/wordpress.png) center left no-repeat;
+       padding-left: 20px;
+       line-height: 16px;
+}
+#site-generator a:hover {
+       text-decoration: underline;
+}
+img#wpstats {
+       display:block;
+       margin: 0 auto 10px;
+}
+
+
+
+/* Mobile Safari ( iPad, iPhone and iPod Touch )
+-------------------------------------------------------------- */
+
+pre {
+       -webkit-text-size-adjust: 140%;
+}
+code {
+       -webkit-text-size-adjust: 160%;
+}
+#access,
+.entry-meta,
+.entry-utility,
+.navigation,
+.widget-area {
+       -webkit-text-size-adjust: 120%;
+}
+#site-description {
+       -webkit-text-size-adjust: none;
+}
+
+
+
+/* =Print Style
+-------------------------------------------------------------- */
+
+@media print {
+       body {
+               background:none !important;
+       }
+       #wrapper {
+               float: none !important;
+               clear: both !important;
+               display: block !important;
+               position: relative !important;
+       }
+       #header {
+               border-bottom: 2pt solid #000;
+               padding-bottom: 18pt;
+       }
+       #colophon {
+               border-top: 2pt solid #000;
+       }
+       #site-title,
+       #site-description {
+               float: none;
+               margin: 0;
+               padding:0;
+               line-height: 1.4em;
+       }
+       #site-title {
+               font-size: 13pt;
+       }
+       .entry-content {
+               font-size: 14pt;
+               line-height: 1.6em;
+       }
+       .entry-title {
+               font-size: 21pt;
+       }
+       #access,
+       #branding img,
+       #respond,
+       .comment-edit-link,
+       .edit-link,
+       .navigation,
+       .page-link,
+       .widget-area {
+               display: none !important;
+       }
+       #container,
+       #header,
+       #footer {
+               width: 100%;
+               margin: 0;
+       }
+       #content,
+       .one-column #content {
+               width: 100%;
+               margin: 24pt 0 0;
+       }
+       .wp-caption p {
+               font-size: 11pt;
+       }
+       #site-info,
+       #site-generator {
+               float: none;
+               width: auto;
+       }
+       #colophon {
+               width: auto;
+       }
+       img#wpstats {
+               display:none
+       }
+       #site-generator a {
+               padding: 0;
+       margin: 0;
+       }
+       #entry-author-info {
+               border: 1px solid #e7e7e7;
+       }
+       #main {
+               display:inline;
+       }
+       .home .sticky {
+               border: none;
+       }
+}
diff --git a/wp-content/themes/twentyten/tag.php b/wp-content/themes/twentyten/tag.php
new file mode 100644 (file)
index 0000000..2c0cb87
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+ * The template for displaying Tag Archive pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+               <div id="container">
+                       <div id="content" role="main">
+
+                               <h1 class="page-title"><?php
+                                       printf( __( 'Tag Archives: %s', 'twentyten' ), '<span>' . single_tag_title( '', false ) . '</span>' );
+                               ?></h1>
+
+<?php
+/* Run the loop for the tag archive to output the posts
+ * If you want to overload this in a child theme then include a file
+ * called loop-tag.php and that will be used instead.
+ */
+ get_template_part( 'loop', 'tag' );
+?>
+                       </div><!-- #content -->
+               </div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
index 4f3335b4a977cacd6030cb03ae102f6536342557..19427c5c427c6791623a64399023dc76bc24d235 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * WordPress Cron Implementation for hosts, which do not offer CRON or for which
- * the user has not setup a CRON job pointing to this file.
+ * the user has not set up a CRON job pointing to this file.
  *
  * The HTTP request to this file will not slow down the visitor who happens to
  * visit when the cron job is needed to run.
@@ -22,7 +22,7 @@ if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
 define('DOING_CRON', true);
 
 if ( !defined('ABSPATH') ) {
-       /** Setup WordPress environment */
+       /** Set up WordPress environment */
        require_once('./wp-load.php');
 }
 
index 78daa6d226fb042f92607279ef1741f315378156..24cd8d6721ea47c8fa395204e8b622a14858fba1 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 /**
- * Redirects to the RSS2 feed
+ * Redirects to the default feed
  * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
 require( './wp-load.php' );
-wp_redirect( get_bloginfo( 'rss2_url' ), 301 );
+wp_redirect( get_bloginfo( get_default_feed() . '_url' ), 301 );
 
 ?>
\ No newline at end of file
index 06d1c6c76407da8f0253136c47d1bd858bce1eea..3ba7b4c7ea8336d6f660334a01d868a8c2f54b88 100644 (file)
@@ -6,10 +6,8 @@
  * The original PHP version of this code was written by Geoffrey T. Dairiki
  * <dairiki@dairiki.org>, and is used/adapted with his permission.
  *
- * $Horde: framework/Text_Diff/Diff.php,v 1.26 2008/01/04 10:07:49 jan Exp $
- *
  * Copyright 2004 Geoffrey T. Dairiki <dairiki@dairiki.org>
- * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
@@ -65,6 +63,44 @@ class Text_Diff {
         return $this->_edits;
     }
 
+    /**
+     * returns the number of new (added) lines in a given diff.
+     *
+     * @since Text_Diff 1.1.0
+     *
+     * @return integer The number of new lines
+     */
+    function countAddedLines()
+    {
+        $count = 0;
+        foreach ($this->_edits as $edit) {
+            if (is_a($edit, 'Text_Diff_Op_add') ||
+                is_a($edit, 'Text_Diff_Op_change')) {
+                $count += $edit->nfinal();
+            }
+        }
+        return $count;
+    }
+
+    /**
+     * Returns the number of deleted (removed) lines in a given diff.
+     *
+     * @since Text_Diff 1.1.0
+     *
+     * @return integer The number of deleted lines
+     */
+    function countDeletedLines()
+    {
+        $count = 0;
+        foreach ($this->_edits as $edit) {
+            if (is_a($edit, 'Text_Diff_Op_delete') ||
+                is_a($edit, 'Text_Diff_Op_change')) {
+                $count += $edit->norig();
+            }
+        }
+        return $count;
+    }
+
     /**
      * Computes a reversed diff.
      *
index aa5bca5b04384d6a6bfaf3e4300f59a0f60f0dcb..93eaef220d8695b21e747966af71eaae521a9821 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 /**
- * $Horde: framework/Text_Diff/Diff/Engine/native.php,v 1.10 2008/01/04 10:27:53 jan Exp $
+ * Class used internally by Text_Diff to actually compute the diffs.
  *
- * Class used internally by Text_Diff to actually compute the diffs. This
- * class is implemented using native PHP code.
+ * This class is implemented using native PHP code.
  *
  * The algorithm used here is mostly lifted from the perl module
  * Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
@@ -19,7 +18,7 @@
  * Geoffrey T. Dairiki <dairiki@dairiki.org>. The original PHP version of this
  * code was written by him, and is used/adapted with his permission.
  *
- * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
index 7e9629f506d8e5781f993bdd509a17e97c3bcf8a..faf387032d791c708bf665653c9686260bdff2ad 100644 (file)
@@ -5,9 +5,7 @@
  * This class uses the Unix `diff` program via shell_exec to compute the
  * differences between the two input arrays.
  *
- * $Horde: framework/Text_Diff/Diff/Engine/shell.php,v 1.8 2008/01/04 10:07:50 jan Exp $
- *
- * Copyright 2007-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2007-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
index 1a0bd3f37f8da0d89c5b69426169243cc8165b25..59eb8adb45e740cf71b46c00409122f6c5a4d479 100644 (file)
  * echo $renderer->render($diff);
  * </code>
  *
- * $Horde: framework/Text_Diff/Diff/Engine/string.php,v 1.7 2008/01/04 10:07:50 jan Exp $
- *
  * Copyright 2005 Ã–rjan Persson <o@42mm.org>
- * Copyright 2005-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2005-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
@@ -39,6 +37,19 @@ class Text_Diff_Engine_string {
      */
     function diff($diff, $mode = 'autodetect')
     {
+        // Detect line breaks.
+        $lnbr = "\n";
+        if (strpos($diff, "\r\n") !== false) {
+            $lnbr = "\r\n";
+        } elseif (strpos($diff, "\r") !== false) {
+            $lnbr = "\r";
+        }
+
+        // Make sure we have a line break at the EOF.
+        if (substr($diff, -strlen($lnbr)) != $lnbr) {
+            $diff .= $lnbr;
+        }
+
         if ($mode != 'autodetect' && $mode != 'context' && $mode != 'unified') {
             return PEAR::raiseError('Type of diff is unsupported');
         }
@@ -48,17 +59,20 @@ class Text_Diff_Engine_string {
             $unified = strpos($diff, '---');
             if ($context === $unified) {
                 return PEAR::raiseError('Type of diff could not be detected');
-            } elseif ($context === false || $context === false) {
+            } elseif ($context === false || $unified === false) {
                 $mode = $context !== false ? 'context' : 'unified';
             } else {
                 $mode = $context < $unified ? 'context' : 'unified';
             }
         }
 
-        // split by new line and remove the diff header
-        $diff = explode("\n", $diff);
-        array_shift($diff);
-        array_shift($diff);
+        // Split by new line and remove the diff header, if there is one.
+        $diff = explode($lnbr, $diff);
+        if (($mode == 'context' && strpos($diff[0], '***') === 0) ||
+            ($mode == 'unified' && strpos($diff[0], '---') === 0)) {
+            array_shift($diff);
+            array_shift($diff);
+        }
 
         if ($mode == 'context') {
             return $this->parseContextDiff($diff);
index a39a4be1765f82e8db73aebeb2d3d4a4b57f1447..b9f17360456f381d977128ca10fa718ed0a656e0 100644 (file)
@@ -5,9 +5,7 @@
  * This class uses the xdiff PECL package (http://pecl.php.net/package/xdiff)
  * to compute the differences between the two input arrays.
  *
- * $Horde: framework/Text_Diff/Diff/Engine/xdiff.php,v 1.6 2008/01/04 10:07:50 jan Exp $
- *
- * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
@@ -42,6 +40,9 @@ class Text_Diff_Engine_xdiff {
          * valid, albeit a little less descriptive and efficient. */
         $edits = array();
         foreach ($diff as $line) {
+            if (!strlen($line)) {
+                continue;
+            }
             switch ($line[0]) {
             case ' ':
                 $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1)));
index 5d226b4e2163ec4e788e7acd838c8f4fd3221e58..922f4c09cc061b8e004e174681062bdb3e7072aa 100644 (file)
@@ -5,9 +5,7 @@
  * This class renders the diff in classic diff format. It is intended that
  * this class be customized via inheritance, to obtain fancier outputs.
  *
- * $Horde: framework/Text_Diff/Diff/Renderer.php,v 1.21 2008/01/04 10:07:50 jan Exp $
- *
- * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
index 1493eaa04e6b45f0cdd9454c88507186b15d6c13..392bd57cff5d4fea019ab4562f0d3a350959c531 100644 (file)
@@ -2,9 +2,7 @@
 /**
  * "Inline" diff renderer.
  *
- * $Horde: framework/Text_Diff/Diff/Renderer/inline.php,v 1.21 2008/01/04 10:07:51 jan Exp $
- *
- * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you did
  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
@@ -30,42 +28,65 @@ class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
 
     /**
      * Number of leading context "lines" to preserve.
+     *
+     * @var integer
      */
     var $_leading_context_lines = 10000;
 
     /**
      * Number of trailing context "lines" to preserve.
+     *
+     * @var integer
      */
     var $_trailing_context_lines = 10000;
 
     /**
      * Prefix for inserted text.
+     *
+     * @var string
      */
     var $_ins_prefix = '<ins>';
 
     /**
      * Suffix for inserted text.
+     *
+     * @var string
      */
     var $_ins_suffix = '</ins>';
 
     /**
      * Prefix for deleted text.
+     *
+     * @var string
      */
     var $_del_prefix = '<del>';
 
     /**
      * Suffix for deleted text.
+     *
+     * @var string
      */
     var $_del_suffix = '</del>';
 
     /**
      * Header for each change block.
+     *
+     * @var string
      */
     var $_block_header = '';
 
+    /**
+     * Whether to split down to character-level.
+     *
+     * @var boolean
+     */
+    var $_split_characters = false;
+
     /**
      * What are we currently splitting on? Used to recurse to show word-level
-     * changes.
+     * or character-level changes.
+     *
+     * @var string
      */
     var $_split_level = 'lines';
 
@@ -85,10 +106,10 @@ class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
             array_walk($lines, array(&$this, '_encode'));
         }
 
-        if ($this->_split_level == 'words') {
-            return implode('', $lines);
-        } else {
+        if ($this->_split_level == 'lines') {
             return implode("\n", $lines) . "\n";
+        } else {
+            return implode('', $lines);
         }
     }
 
@@ -110,8 +131,13 @@ class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
 
     function _changed($orig, $final)
     {
-        /* If we've already split on words, don't try to do so again - just
-         * display. */
+        /* If we've already split on characters, just display. */
+        if ($this->_split_level == 'characters') {
+            return $this->_deleted($orig)
+                . $this->_added($final);
+        }
+
+        /* If we've already split on words, just display. */
         if ($this->_split_level == 'words') {
             $prefix = '';
             while ($orig[0] !== false && $final[0] !== false &&
@@ -130,15 +156,23 @@ class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
         /* Non-printing newline marker. */
         $nl = "\0";
 
-        /* We want to split on word boundaries, but we need to
-         * preserve whitespace as well. Therefore we split on words,
-         * but include all blocks of whitespace in the wordlist. */
-        $diff = new Text_Diff($this->_splitOnWords($text1, $nl),
-                              $this->_splitOnWords($text2, $nl));
+        if ($this->_split_characters) {
+            $diff = new Text_Diff('native',
+                                  array(preg_split('//', $text1),
+                                        preg_split('//', $text2)));
+        } else {
+            /* We want to split on word boundaries, but we need to preserve
+             * whitespace as well. Therefore we split on words, but include
+             * all blocks of whitespace in the wordlist. */
+            $diff = new Text_Diff('native',
+                                  array($this->_splitOnWords($text1, $nl),
+                                        $this->_splitOnWords($text2, $nl)));
+        }
 
         /* Get the diff in inline format. */
-        $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(),
-                                                              array('split_level' => 'words')));
+        $renderer = new Text_Diff_Renderer_inline
+            (array_merge($this->getParams(),
+                         array('split_level' => $this->_split_characters ? 'characters' : 'words')));
 
         /* Run the diff and get the output. */
         return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
index 51ff8a97ae50069832743d2a6d87b3ca268ca1cf..bc44349f8ec6d5aa6399d4265e4a96aa21ea517d 100644 (file)
  */
 function get_the_author($deprecated = '') {
        global $authordata;
+
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.1' );
+
        return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null);
 }
 
@@ -41,10 +45,14 @@ function get_the_author($deprecated = '') {
  * @link http://codex.wordpress.org/Template_Tags/the_author
  *
  * @param string $deprecated Deprecated.
- * @param string $deprecated_echo Echo the string or return it.
+ * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
  * @return string The author's display name, from get_the_author().
  */
-function the_author($deprecated = '', $deprecated_echo = true) {
+function the_author( $deprecated = '', $deprecated_echo = true ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.1' );
+       if ( $deprecated_echo !== true )
+               _deprecated_argument( __FUNCTION__, '1.5', __('Use <code>get_the_author()</code> instead if you do not want the value echoed.') );
        if ( $deprecated_echo )
                echo get_the_author();
        return get_the_author();
@@ -119,6 +127,23 @@ function the_author_meta($field = '', $user_id = false) {
        echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id), $user_id);
 }
 
+/**
+ * Retrieve either author's link or author's name.
+ *
+ * If the author has a home page set, return an HTML link, otherwise just return the
+ * author's name.
+ *
+ * @uses get_the_author_meta()
+ * @uses get_the_author()
+ */
+function get_the_author_link() {
+       if ( get_the_author_meta('url') ) {
+               return '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s&#8217;s website"), get_the_author()) ) . '" rel="external">' . get_the_author() . '</a>';
+       } else {
+               return get_the_author();
+       }
+}
+
 /**
  * Display either author's link or author's name.
  *
@@ -127,15 +152,10 @@ function the_author_meta($field = '', $user_id = false) {
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_link
  * @since 2.1
- * @uses get_the_author_meta()
- * @uses the_author()
+ * @uses get_the_author_link()
  */
 function the_author_link() {
-       if ( get_the_author_meta('url') ) {
-               echo '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s&#8217;s website"), get_the_author()) ) . '" rel="external">' . get_the_author() . '</a>';
-       } else {
-               the_author();
-       }
+       echo get_the_author_link();
 }
 
 /**
@@ -143,12 +163,12 @@ function the_author_link() {
  *
  * @since 1.5
  * @uses $post The current post in the Loop's DB object.
- * @uses get_usernumposts()
+ * @uses count_user_posts()
  * @return int The number of posts by the author.
  */
 function get_the_author_posts() {
        global $post;
-       return get_usernumposts($post->post_author);
+       return count_user_posts($post->post_author);
 }
 
 /**
@@ -156,7 +176,7 @@ function get_the_author_posts() {
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_posts
  * @since 0.71
- * @uses get_the_author_posts() Echos returned value from function.
+ * @uses get_the_author_posts() Echoes returned value from function.
  */
 function the_author_posts() {
        echo get_the_author_posts();
@@ -177,6 +197,9 @@ function the_author_posts() {
  * @param string $deprecated Deprecated.
  */
 function the_author_posts_link($deprecated = '') {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.1' );
+
        global $authordata;
        $link = sprintf(
                '<a href="%1$s" title="%2$s">%3$s</a>',
@@ -200,7 +223,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
        $link = $wp_rewrite->get_author_permastruct();
 
        if ( empty($link) ) {
-               $file = get_option('home') . '/';
+               $file = home_url() . '/';
                $link = $file . '?author=' . $auth_ID;
        } else {
                if ( '' == $author_nicename ) {
@@ -209,7 +232,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
                                $author_nicename = $user->user_nicename;
                }
                $link = str_replace('%author%', $author_nicename, $link);
-               $link = get_option('home') . trailingslashit($link);
+               $link = home_url() . trailingslashit($link);
        }
 
        $link = apply_filters('author_link', $link, $author_id, $author_nicename);
@@ -258,12 +281,20 @@ function wp_list_authors($args = '') {
        $return = '';
 
        /** @todo Move select to get_authors(). */
-       $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
+       $users = get_users_of_blog();
+       $author_ids = array();
+       foreach ( (array) $users as $user )
+               $author_ids[] = $user->user_id;
+       if ( count($author_ids) > 0  ) {
+               $author_ids = implode(',', $author_ids );
+               $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
+       } else {
+               $authors = array();
+       }
 
        $author_count = array();
-       foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row) {
+       foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )
                $author_count[$row->post_author] = $row->count;
-       }
 
        foreach ( (array) $authors as $author ) {
 
@@ -326,10 +357,8 @@ function wp_list_authors($args = '') {
 
                }
 
-               if ( !($posts == 0 && $hide_empty) && 'list' == $style )
-                       $return .= $link . '</li>';
-               else if ( ! $hide_empty )
-                       $return .= $link . ', ';
+               if ( $posts || ! $hide_empty )
+                       $return .= $link . ( ( 'list' == $style ) ? '</li>' : ', ' );
        }
 
        $return = trim($return, ', ');
index cf24da6c9b373ce8ae4bb283a187363860f3f5e2..7c5949cc21748b20179d4c6330092aae2e362c3e 100644 (file)
@@ -153,6 +153,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
  *             formatted bookmarks.
  * 'categorize' - Default is 1 (integer). Whether to show links listed by
  *             category (default) or show links in one column.
+ * 'show_description' - Default is 0 (integer). Whether to show the description
+ *             of the bookmark.
  *
  * These options define how the Category name will appear before the category
  * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will
index c406fcaf5003dd16e5d9bc725963381c15ac6b29..641ae3b4935d2c9f25972ee34eb8b6f66ed393d8 100644 (file)
@@ -33,7 +33,7 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
                        $_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') );
+                       $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) );
                        wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
                }
        }
@@ -79,21 +79,6 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
        return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
 }
 
-/**
- * Retrieve bookmark data based on ID.
- *
- * @since 2.0.0
- * @deprecated Use get_bookmark()
- * @see get_bookmark()
- *
- * @param int $bookmark_id ID of link
- * @param string $output Either OBJECT, ARRAY_N, or ARRAY_A
- * @return object|array
- */
-function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
-       return get_bookmark($bookmark_id, $output, $filter);
-}
-
 /**
  * Retrieves the list of bookmarks
  *
@@ -236,7 +221,10 @@ function get_bookmarks($args = '') {
                        $orderby = 'rand()';
                        break;
                default:
-                       $orderby = "link_" . $orderby;
+                       $orderparams = array();
+                       foreach ( explode(',', $orderby) as $ordparam )
+                               $orderparams[] = 'link_' . trim($ordparam);
+                       $orderby = implode(',', $orderparams);
        }
 
        if ( 'link_id' == $orderby )
@@ -321,18 +309,25 @@ function sanitize_bookmark($bookmark, $context = 'display') {
  * @return mixed The filtered value
  */
 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
-       $int_fields = array('link_id', 'link_rating');
-       if ( in_array($field, $int_fields) )
+       switch ( $field ) {
+       case 'link_id' : // ints
+       case 'link_rating' :
                $value = (int) $value;
-
-       $yesno = array('link_visible');
-       if ( in_array($field, $yesno) )
+               break;
+       case 'link_category' : // array( ints )
+               $value = array_map('absint', (array) $value);
+               // We return here so that the categories aren't filtered.
+               // The 'link_category' filter is for the name of a link category, not an array of a link's link categories
+               return $value;
+               break;
+       case 'link_visible' : // bool stored as Y|N
                $value = preg_replace('/[^YNyn]/', '', $value);
-
-       if ( 'link_target' == $field ) {
+               break;
+       case 'link_target' : // "enum"
                $targets = array('_top', '_blank');
                if ( ! in_array($value, $targets) )
                        $value = '';
+               break;
        }
 
        if ( 'raw' == $context )
@@ -352,12 +347,12 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
        } else {
                // Use display filters by default.
                $value = apply_filters($field, $value, $bookmark_id, $context);
-       }
 
-       if ( 'attribute' == $context )
-               $value = esc_attr($value);
-       else if ( 'js' == $context )
-               $value = esc_js($value);
+               if ( 'attribute' == $context )
+                       $value = esc_attr($value);
+               else if ( 'js' == $context )
+                       $value = esc_js($value);
+       }
 
        return $value;
 }
index 5eef60b13cc2f57b22cc03f3e4b00ee44f6a8627..6243866288a75e022bd0c83c18871f6fb61250a7 100644 (file)
@@ -149,8 +149,9 @@ function wp_cache_set($key, $data, $flag = '', $expire = 0) {
  * @param string|array $groups A group or an array of groups to add
  */
 function wp_cache_add_global_groups( $groups ) {
-       // Default cache doesn't persist so nothing to do here.
-       return;
+       global $wp_object_cache;
+
+       return $wp_object_cache->add_global_groups($groups);
 }
 
 /**
@@ -165,6 +166,20 @@ function wp_cache_add_non_persistent_groups( $groups ) {
        return;
 }
 
+/**
+ * Reset internal cache keys and structures.  If the cache backend uses global blog or site IDs as part of its cache keys,
+ * this function instructs the backend to reset those keys and perform any cleanup since blog or site IDs have changed since cache init.
+ *
+ * @since 2.6.0
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_reset() {
+       global $wp_object_cache;
+
+       return $wp_object_cache->reset();
+}
+
 /**
  * WordPress Object Cache
  *
@@ -199,7 +214,7 @@ class WP_Object_Cache {
         * @access private
         * @since 2.0.0
         */
-       var $non_existant_objects = array ();
+       var $non_existent_objects = array ();
 
        /**
         * The amount of times the cache data was already stored in the cache.
@@ -219,6 +234,15 @@ class WP_Object_Cache {
         */
        var $cache_misses = 0;
 
+       /**
+        * List of global groups
+        *
+        * @var array
+        * @access protected
+        * @since 3.0.0
+        */
+       var $global_groups = array();
+
        /**
         * Adds data to the cache if it doesn't already exist.
         *
@@ -234,16 +258,30 @@ class WP_Object_Cache {
         * @param int $expire When to expire the cache contents
         * @return bool False if cache ID and group already exists, true on success
         */
-       function add($id, $data, $group = 'default', $expire = '') {
-               if (empty ($group))
+       function add( $id, $data, $group = 'default', $expire = '' ) {
+               if ( empty ($group) )
                        $group = 'default';
 
-               if (false !== $this->get($id, $group, false))
+               if (false !== $this->get($id, $group))
                        return false;
 
                return $this->set($id, $data, $group, $expire);
        }
 
+       /**
+        * Sets the list of global groups.
+        *
+        * @since 3.0.0
+        *
+        * @param array $groups List of groups that are global.
+        */
+       function add_global_groups( $groups ) {
+               $groups = (array) $groups;
+
+               $this->global_groups = array_merge($this->global_groups, $groups);
+               $this->global_groups = array_unique($this->global_groups);
+       }
+
        /**
         * Remove the contents of the cache ID in the group
         *
@@ -252,7 +290,7 @@ class WP_Object_Cache {
         * by default.
         *
         * On success the group and the id will be added to the
-        * $non_existant_objects property in the class.
+        * $non_existent_objects property in the class.
         *
         * @since 2.0.0
         *
@@ -266,11 +304,11 @@ class WP_Object_Cache {
                if (empty ($group))
                        $group = 'default';
 
-               if (!$force && false === $this->get($id, $group, false))
+               if (!$force && false === $this->get($id, $group))
                        return false;
 
                unset ($this->cache[$group][$id]);
-               $this->non_existant_objects[$group][$id] = true;
+               $this->non_existent_objects[$group][$id] = true;
                return true;
        }
 
@@ -294,11 +332,11 @@ class WP_Object_Cache {
         * ID in the cache group. If the cache is hit (success) then the contents
         * are returned.
         *
-        * On failure, the $non_existant_objects property is checked and if the
+        * On failure, the $non_existent_objects property is checked and if the
         * cache group and ID exist in there the cache misses will not be
-        * incremented. If not in the nonexistant objects property, then the cache
+        * incremented. If not in the nonexistent objects property, then the cache
         * misses will be incremented and the cache group and ID will be added to
-        * the nonexistant objects.
+        * the nonexistent objects.
         *
         * @since 2.0.0
         *
@@ -308,10 +346,10 @@ class WP_Object_Cache {
         *              contents on success
         */
        function get($id, $group = 'default') {
-               if (empty ($group))
+               if ( empty ($group) )
                        $group = 'default';
 
-               if (isset ($this->cache[$group][$id])) {
+               if ( isset ($this->cache[$group][$id]) ) {
                        $this->cache_hits += 1;
                        if ( is_object($this->cache[$group][$id]) )
                                return wp_clone($this->cache[$group][$id]);
@@ -319,10 +357,10 @@ class WP_Object_Cache {
                                return $this->cache[$group][$id];
                }
 
-               if ( isset ($this->non_existant_objects[$group][$id]) )
+               if ( isset ($this->non_existent_objects[$group][$id]) )
                        return false;
 
-               $this->non_existant_objects[$group][$id] = true;
+               $this->non_existent_objects[$group][$id] = true;
                $this->cache_misses += 1;
                return false;
        }
@@ -343,12 +381,25 @@ class WP_Object_Cache {
                if (empty ($group))
                        $group = 'default';
 
-               if (false === $this->get($id, $group, false))
+               if ( false === $this->get($id, $group) )
                        return false;
 
                return $this->set($id, $data, $group, $expire);
        }
 
+       /**
+        * Reset keys
+        *
+        * @since 3.0.0
+        */
+       function reset() {
+               // Clear out non-global caches since the blog ID has changed.
+               foreach ( array_keys($this->cache) as $group ) {
+                       if ( !in_array($group, $this->global_groups) )
+                               unset($this->cache[$group]);
+               }
+       }
+
        /**
         * Sets the data contents into the cache
         *
@@ -370,10 +421,10 @@ class WP_Object_Cache {
         * @return bool Always returns true
         */
        function set($id, $data, $group = 'default', $expire = '') {
-               if (empty ($group))
+               if ( empty ($group) )
                        $group = 'default';
 
-               if (NULL === $data)
+               if ( NULL === $data )
                        $data = '';
 
                if ( is_object($data) )
@@ -381,14 +432,14 @@ class WP_Object_Cache {
 
                $this->cache[$group][$id] = $data;
 
-               if(isset($this->non_existant_objects[$group][$id]))
-                       unset ($this->non_existant_objects[$group][$id]);
+               if ( isset($this->non_existent_objects[$group][$id]) )
+                       unset ($this->non_existent_objects[$group][$id]);
 
                return true;
        }
 
        /**
-        * Echos the stats of the caching.
+        * Echoes the stats of the caching.
         *
         * Gives the cache hits, and cache misses. Also prints every cached group,
         * key and the data.
index 010e1c5e8bd063d4a927824e78051a92f6f0c5cc..1cbf7d27b254cc4479603c798c26f2a9f63850ea 100644 (file)
@@ -5,8 +5,6 @@
  * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference"
  * by Mark Jaquith
  *
- * @author Scott Yang
- * @author Mark Jaquith
  * @package WordPress
  * @since 2.3.0
  */
@@ -44,7 +42,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 
        if ( !$requested_url ) {
                // build the URL in the address bar
-               $requested_url  = ( !empty($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+               $requested_url  = is_ssl() ? 'https://' : 'http://';
                $requested_url .= $_SERVER['HTTP_HOST'];
                $requested_url .= $_SERVER['REQUEST_URI'];
        }
@@ -63,8 +61,10 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
        $redirect_url = false;
 
        // Notice fixing
-       if ( !isset($redirect['path']) )  $redirect['path'] = '';
-       if ( !isset($redirect['query']) ) $redirect['query'] = '';
+       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')) ) {
 
@@ -75,13 +75,26 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                                $id = $vars->post_parent;
 
                        if ( $redirect_url = get_permalink($id) )
-                               $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id'), $redirect['query']);
+                               $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']);
                }
        }
 
        // These tests give us a WP-generated permalink
        if ( is_404() ) {
-               $redirect_url = redirect_guess_404_permalink();
+
+               // Redirect ?page_id, ?p=, ?attachment_id= to their respective url's
+               $id = max( get_query_var('p'), get_query_var('page_id'), get_query_var('attachment_id') );
+               if ( $id && $redirect_post = get_post($id) ) {
+                       $post_type_obj = get_post_type_object($redirect_post->post_type);
+                       if ( $post_type_obj->public ) {
+                               $redirect_url = get_permalink($redirect_post);
+                               $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']);
+                       }
+               }
+
+               if ( ! $redirect_url )
+                       $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_attachment() && !empty($_GET['attachment_id']) && ! $redirect_url ) {
@@ -89,7 +102,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                                $redirect['query'] = remove_query_arg('attachment_id', $redirect['query']);
                } elseif ( is_single() && !empty($_GET['p']) && ! $redirect_url ) {
                        if ( $redirect_url = get_permalink(get_query_var('p')) )
-                               $redirect['query'] = remove_query_arg('p', $redirect['query']);
+                               $redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']);
                        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'] );
@@ -100,6 +113,11 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                } 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']);
+               } elseif ( is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front')  && ! $redirect_url ) {
+                       $redirect_url = home_url('/');
+               } elseif ( is_home() && !empty($_GET['page_id']) && 'page' == get_option('show_on_front') && get_query_var('page_id') == get_option('page_for_posts')  && ! $redirect_url ) {
+                       if ( $redirect_url = get_permalink(get_option('page_for_posts')) )
+                               $redirect['query'] = remove_query_arg('page_id', $redirect['query']);
                } elseif ( !empty($_GET['m']) && ( is_year() || is_month() || is_day() ) ) {
                        $m = get_query_var('m');
                        switch ( strlen($m) ) {
@@ -125,23 +143,57 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                } elseif ( is_year() && !empty($_GET['year']) ) {
                        if ( $redirect_url = get_year_link(get_query_var('year')) )
                                $redirect['query'] = remove_query_arg('year', $redirect['query']);
-               } 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']);
                } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
                        $author = get_userdata(get_query_var('author'));
                        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['query']);
+               } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories)
+
+                       $term_count = 0;
+                       foreach ( array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in',
+                       'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and') as $key )
+                               $term_count += count($wp_query->query_vars[$key]);
+
+                       $obj = $wp_query->get_queried_object();
+
+                       if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) {
+
+                               if ( is_category() ) {
+                                       $redirect['query'] = remove_query_arg( array( 'category_name', 'category', 'cat'), $redirect['query']);
+                               } elseif ( is_tag() ) {
+                                       $redirect['query'] = remove_query_arg( array( 'tag', 'tag_id'), $redirect['query']);
+                               } elseif ( is_tax() ) { // Custom taxonomies will have a custom query var, remove those too:
+                                       $tax = get_taxonomy( $obj->taxonomy );
+                                       if ( false !== $tax->query_var)
+                                               $redirect['query'] = remove_query_arg($tax->query_var, $redirect['query']);
+                                       else
+                                               $redirect['query'] = remove_query_arg( array( 'term', 'taxonomy'), $redirect['query']);
+                               }
+
+                               $tax_url = parse_url($tax_url);
+                               if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
+                                       parse_str($tax_url['query'], $query_vars);
+                                       $redirect['query'] = add_query_arg($query_vars, $redirect['query']);
+                               } else { // Taxonomy is accessable via a "pretty-URL"
+                                       $redirect['path'] = $tax_url['path'];
+                               }
+
+                       }
+               } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
+                       $category = get_term_by('slug', get_query_var('category_name'), 'category');
+                       $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids'));
+                       if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) )
+                               $redirect_url = get_permalink($wp_query->get_queried_object_id());
                }
 
-       // paging and feeds
+               // 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'] ) ) {
+                       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('#/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
                        }
@@ -151,7 +203,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                                $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' );
+                               $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
                                $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
                        }
 
@@ -162,7 +214,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                                        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');
+                                               $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
                                        }
                                } elseif ( $paged > 1 ) {
                                        $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
@@ -198,7 +250,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                $redirect = @parse_url($redirect_url);
 
        // www.example.com vs example.com
-       $user_home = @parse_url(get_option('home'));
+       $user_home = @parse_url(home_url());
        if ( !empty($user_home['host']) )
                $redirect['host'] = $user_home['host'];
        if ( empty($user_home['path']) )
@@ -250,6 +302,10 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                $redirect['path'] = trailingslashit($redirect['path']);
        }
 
+       // Strip multiple slashes out of the URL
+       if ( strpos($redirect['path'], '//') > -1 )
+               $redirect['path'] = preg_replace('|/+|', '/', $redirect['path']);
+
        // Always trailing slash the Front Page URL
        if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) )
                $redirect['path'] = trailingslashit($redirect['path']);
@@ -285,7 +341,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                        $redirect_url .= '?' . $redirect['query'];
        }
 
-       if ( $redirect_url == $requested_url )
+       if ( !$redirect_url || $redirect_url == $requested_url )
                return false;
 
        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
@@ -326,7 +382,9 @@ function redirect_guess_404_permalink() {
 
        $where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%');
 
-       // if any of year, monthnum, or day are set, use them to refine the query
+       // if any of post_type, year, monthnum, or day are set, use them to refine the query
+       if ( get_query_var('post_type') )
+               $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
        if ( get_query_var('year') )
                $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year'));
        if ( get_query_var('monthnum') )
index 4a5ccec036eeae4e5e2a792e2c51a2683146a9a5..6ab08e3713f8eaf650ee75b3d77601b34a287d8a 100644 (file)
@@ -85,7 +85,7 @@ class WP_Roles {
        }
 
        /**
-        * Setup the object properties.
+        * Set up 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
@@ -97,8 +97,7 @@ class WP_Roles {
         * @global array $wp_user_roles Used to set the 'roles' property value.
         */
        function _init () {
-               global $wpdb;
-               global $wp_user_roles;
+               global $wpdb, $wp_user_roles;
                $this->role_key = $wpdb->prefix . 'user_roles';
                if ( ! empty( $wp_user_roles ) ) {
                        $this->roles = $wp_user_roles;
@@ -125,7 +124,7 @@ class WP_Roles {
         *
         * The capabilities are defined in the following format `array( 'read' => true );`
         * To explicitly deny a role a capability you set the value for that capability to false.
-        * 
+        *
         * @since 2.0.0
         * @access public
         *
@@ -270,10 +269,10 @@ class WP_Role {
        var $capabilities;
 
        /**
-        * PHP4 Constructor - Setup object properties.
+        * PHP4 Constructor - Set up 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.
+        * and the value a boolean of whether it is granted to the role.
         *
         * @since 2.0.0
         * @access public
@@ -501,7 +500,7 @@ class WP_User {
        }
 
        /**
-        * Setup capability object properties.
+        * Set up 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
@@ -509,11 +508,16 @@ class WP_User {
         * used.
         *
         * @since 2.1.0
+        *
+        * @param string $cap_key Optional capability key
         * @access protected
         */
-       function _init_caps() {
+       function _init_caps( $cap_key = '' ) {
                global $wpdb;
-               $this->cap_key = $wpdb->prefix . 'capabilities';
+               if ( empty($cap_key) )
+                       $this->cap_key = $wpdb->prefix . 'capabilities';
+               else
+                       $this->cap_key = $cap_key;
                $this->caps = &$this->{$this->cap_key};
                if ( ! is_array( $this->caps ) )
                        $this->caps = array();
@@ -545,8 +549,8 @@ class WP_User {
                //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( (array) $this->allcaps, (array) $role->capabilities );
+                       $the_role =& $wp_roles->get_role( $role );
+                       $this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities );
                }
                $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps );
        }
@@ -563,7 +567,7 @@ class WP_User {
         */
        function add_role( $role ) {
                $this->caps[$role] = true;
-               update_usermeta( $this->ID, $this->cap_key, $this->caps );
+               update_user_meta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
                $this->update_user_level_from_caps();
        }
@@ -577,11 +581,12 @@ class WP_User {
         * @param string $role Role name.
         */
        function remove_role( $role ) {
-               if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) )
+               if ( !in_array($role, $this->roles) )
                        return;
                unset( $this->caps[$role] );
-               update_usermeta( $this->ID, $this->cap_key, $this->caps );
+               update_user_meta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
+               $this->update_user_level_from_caps();
        }
 
        /**
@@ -605,7 +610,7 @@ class WP_User {
                } else {
                        $this->roles = false;
                }
-               update_usermeta( $this->ID, $this->cap_key, $this->caps );
+               update_user_meta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
                $this->update_user_level_from_caps();
                do_action( 'set_user_role', $this->ID, $role );
@@ -652,7 +657,7 @@ class WP_User {
        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 );
+               update_user_meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level );
        }
 
        /**
@@ -666,7 +671,7 @@ class WP_User {
         */
        function add_cap( $cap, $grant = true ) {
                $this->caps[$cap] = $grant;
-               update_usermeta( $this->ID, $this->cap_key, $this->caps );
+               update_user_meta( $this->ID, $this->cap_key, $this->caps );
        }
 
        /**
@@ -678,9 +683,10 @@ class WP_User {
         * @param string $cap Capability name.
         */
        function remove_cap( $cap ) {
-               if ( empty( $this->caps[$cap] ) ) return;
+               if ( empty( $this->caps[$cap] ) )
+                       return;
                unset( $this->caps[$cap] );
-               update_usermeta( $this->ID, $this->cap_key, $this->caps );
+               update_user_meta( $this->ID, $this->cap_key, $this->caps );
        }
 
        /**
@@ -692,8 +698,8 @@ class WP_User {
        function remove_all_caps() {
                global $wpdb;
                $this->caps = array();
-               update_usermeta( $this->ID, $this->cap_key, '' );
-               update_usermeta( $this->ID, $wpdb->prefix.'user_level', '' );
+               delete_user_meta( $this->ID, $this->cap_key );
+               delete_user_meta( $this->ID, $wpdb->prefix . 'user_level' );
                $this->get_role_caps();
        }
 
@@ -712,12 +718,22 @@ class WP_User {
         * @return bool True, if user has capability; false, if user does not have capability.
         */
        function has_cap( $cap ) {
-               if ( is_numeric( $cap ) )
+               if ( is_numeric( $cap ) ) {
+                       _deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
                        $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 );
+
+               // Multisite super admin has all caps by definition, Unless specifically denied.
+               if ( is_multisite() && is_super_admin() ) {
+                       if ( in_array('do_not_allow', $caps) )
+                               return false;
+                       return true;
+               }
+
                // Must have ALL requested caps
                $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
                foreach ( (array) $caps as $cap ) {
@@ -744,6 +760,21 @@ class WP_User {
                return 'level_' . $level;
        }
 
+       /**
+        * Set the blog to operate on. Defaults to the current blog.
+        *
+        * @since 3.0.0
+        *
+        * @param int $blog_id Optional Blog ID, defaults to current blog.
+        */
+       function for_blog( $blog_id = '' ) {
+               global $wpdb;
+               if ( ! empty( $blog_id ) )
+                       $cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
+               else
+                       $cap_key = '';
+               $this->_init_caps( $cap_key );
+       }
 }
 
 /**
@@ -751,8 +782,8 @@ class WP_User {
  *
  * 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'.
+ * be 'delete_user', 'edit_user', 'remove_user', 'promote_user', 'delete_post',
+ * 'delete_page', 'edit_post', 'edit_page', 'read_post', or 'read_page'.
  *
  * @since 2.0.0
  *
@@ -765,24 +796,38 @@ function map_meta_cap( $cap, $user_id ) {
        $caps = array();
 
        switch ( $cap ) {
+       case 'remove_user':
+               $caps[] = 'remove_users';
+               break;
        case 'delete_user':
                $caps[] = 'delete_users';
                break;
+       case 'promote_user':
+               $caps[] = 'promote_users';
+               break;
        case 'edit_user':
-               if ( !isset( $args[0] ) || $user_id != $args[0] ) {
-                       $caps[] = 'edit_users';
-               }
+               // Allow user to edit itself
+               if ( isset( $args[0] ) && $user_id == $args[0] )
+                       break;
+               // Fall through
+       case 'edit_users':
+               // If multisite these caps are allowed only for super admins.
+               if ( is_multisite() && !is_super_admin() )
+                       $caps[] = 'do_not_allow';
+               else
+                       $caps[] = 'edit_users'; // Explicit due to primitive fall through
                break;
        case 'delete_post':
                $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                $post = get_post( $args[0] );
-               if ( 'page' == $post->post_type ) {
-                       $args = array_merge( array( 'delete_page', $user_id ), $args );
+               $post_type = get_post_type_object( $post->post_type );
+               if ( $post_type && 'post' != $post_type->capability_type ) {
+                       $args = array_merge( array( $post_type->cap->delete_post, $user_id ), $args );
                        return call_user_func_array( 'map_meta_cap', $args );
                }
 
-               if ('' != $post->post_author) {
+               if ( '' != $post->post_author ) {
                        $post_author_data = get_userdata( $post->post_author );
                } else {
                        //No author set yet so default to current user for cap checks
@@ -790,7 +835,7 @@ function map_meta_cap( $cap, $user_id ) {
                }
 
                // If the user is the author...
-               if ( $user_id == $post_author_data->ID ) {
+               if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) {
                        // If the post is published...
                        if ( 'publish' == $post->post_status ) {
                                $caps[] = 'delete_published_posts';
@@ -826,7 +871,7 @@ function map_meta_cap( $cap, $user_id ) {
                        $page_author_data = $author_data;
                }
 
-               if ( $user_id == $page_author_data->ID ) {
+               if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID ) {
                        // If the page is published...
                        if ( $page->post_status == 'publish' ) {
                                $caps[] = 'delete_published_pages';
@@ -853,14 +898,15 @@ function map_meta_cap( $cap, $user_id ) {
                $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                $post = get_post( $args[0] );
-               if ( 'page' == $post->post_type ) {
-                       $args = array_merge( array( 'edit_page', $user_id ), $args );
+               $post_type = get_post_type_object( $post->post_type );
+               if ( $post_type && 'post' != $post_type->capability_type ) {
+                       $args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
                        return call_user_func_array( 'map_meta_cap', $args );
                }
                $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...
-               if ( $user_id == $post_author_data->ID ) {
+               if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) {
                        // If the post is published...
                        if ( 'publish' == $post->post_status ) {
                                $caps[] = 'edit_published_posts';
@@ -888,7 +934,7 @@ function map_meta_cap( $cap, $user_id ) {
                $page_author_data = get_userdata( $page->post_author );
                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
                // If the user is the author...
-               if ( $user_id == $page_author_data->ID ) {
+               if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID ) {
                        // If the page is published...
                        if ( 'publish' == $page->post_status ) {
                                $caps[] = 'edit_published_pages';
@@ -911,8 +957,9 @@ function map_meta_cap( $cap, $user_id ) {
                break;
        case 'read_post':
                $post = get_post( $args[0] );
-               if ( 'page' == $post->post_type ) {
-                       $args = array_merge( array( 'read_page', $user_id ), $args );
+               $post_type = get_post_type_object( $post->post_type );
+               if ( $post_type && 'post' != $post_type->capability_type ) {
+                       $args = array_merge( array( $post_type->cap->read_post, $user_id ), $args );
                        return call_user_func_array( 'map_meta_cap', $args );
                }
 
@@ -923,7 +970,7 @@ function map_meta_cap( $cap, $user_id ) {
 
                $author_data = get_userdata( $user_id );
                $post_author_data = get_userdata( $post->post_author );
-               if ( $user_id == $post_author_data->ID )
+               if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID )
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_posts';
@@ -938,17 +985,60 @@ function map_meta_cap( $cap, $user_id ) {
 
                $author_data = get_userdata( $user_id );
                $page_author_data = get_userdata( $page->post_author );
-               if ( $user_id == $page_author_data->ID )
+               if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID )
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_pages';
                break;
        case 'unfiltered_upload':
-               if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS == true )
+               if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin() )  )
                        $caps[] = $cap;
                else
                        $caps[] = 'do_not_allow';
                break;
+       case 'edit_files':
+       case 'edit_plugins':
+       case 'edit_themes':
+               if ( defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT ) {
+                       $caps[] = 'do_not_allow';
+                       break;
+               }
+               // Fall through if not DISALLOW_FILE_EDIT.
+       case 'update_plugins':
+       case 'delete_plugins':
+       case 'install_plugins':
+       case 'update_themes':
+       case 'delete_themes':
+       case 'install_themes':
+       case 'update_core':
+               // Disallow anything that creates, deletes, or edits core, plugin, or theme files.
+               // Files in uploads are excepted.
+               if ( defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS ) {
+                       $caps[] = 'do_not_allow';
+                       break;
+               }
+               // Fall through if not DISALLOW_FILE_MODS.
+       case 'unfiltered_html':
+               // Disallow unfiltered_html for all users, even admins and super admins.
+               if ( defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML ) {
+                       $caps[] = 'do_not_allow';
+                       break;
+               }
+               // Fall through if not DISALLOW_UNFILTERED_HTML
+       case 'delete_user':
+       case 'delete_users':
+               // If multisite these caps are allowed only for super admins.
+               if ( is_multisite() && !is_super_admin() )
+                       $caps[] = 'do_not_allow';
+               else
+                       $caps[] = $cap;
+               break;
+       case 'create_users':
+               if ( is_multisite() && !get_site_option( 'add_new_users' ) )
+                       $caps[] = 'do_not_allow';
+               else
+                       $caps[] = $cap;
+               break;
        default:
                // If no meta caps match, return the original cap.
                $caps[] = $cap;
@@ -977,6 +1067,36 @@ function current_user_can( $capability ) {
        return call_user_func_array( array( &$current_user, 'has_cap' ), $args );
 }
 
+/**
+ * Whether current user has a capability or role for a given blog.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function current_user_can_for_blog( $blog_id, $capability ) {
+       $current_user = wp_get_current_user();
+
+    if ( is_multisite() && is_super_admin() )
+               return true;
+
+       if ( empty( $current_user ) )
+               return false;
+
+       // Create new object to avoid stomping the global current_user.
+       $user = new WP_User( $current_user->id) ;
+
+       // Set the blog id.  @todo add blog id arg to WP_User constructor?
+       $user->for_blog( $blog_id );
+
+       $args = array_slice( func_get_args(), 2 );
+       $args = array_merge( array( $capability ), $args );
+
+       return call_user_func_array( array( &$user, 'has_cap' ), $args );
+}
+
 /**
  * Whether author of supplied post has capability or role.
  *
@@ -1057,4 +1177,53 @@ function remove_role( $role ) {
        return $wp_roles->remove_role( $role );
 }
 
+/**
+ * Retrieve a list of super admins.
+ *
+ * @since 3.0.0
+ *
+ * @uses $super_admins Super admins global variable, if set.
+ *
+ * @return array List of super admin logins
+ */
+function get_super_admins() {
+       global $super_admins;
+
+       if ( isset($super_admins) )
+               return $super_admins;
+       else
+               return get_site_option( 'site_admins', array('admin') );
+}
+
+/**
+ * Determine if user is a site admin.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id (Optional) The ID of a user. Defaults to the current user.
+ * @return bool True if the user is a site admin.
+ */
+function is_super_admin( $user_id = false ) {
+       if ( ! $user_id ) {
+               $current_user = wp_get_current_user();
+               $user_id = ! empty($current_user) ? $current_user->id : 0;
+       }
+
+       if ( ! $user_id )
+               return false;
+
+       $user = new WP_User($user_id);
+
+       if ( is_multisite() ) {
+               $super_admins = get_super_admins();
+               if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) )
+                       return true;
+       } else {
+               if ( $user->has_cap('delete_users') )
+                       return true;
+       }
+
+       return false;
+}
+
 ?>
index 7e378b449fd3c1dbea11b20f66305b4584832bff..db55a12c7ef3dec38435839bcdb10477dfce0219 100644 (file)
@@ -20,8 +20,7 @@ function get_category_link( $category_id ) {
        $catlink = $wp_rewrite->get_category_permastruct();
 
        if ( empty( $catlink ) ) {
-               $file = get_option( 'home' ) . '/';
-               $catlink = $file . '?cat=' . $category_id;
+               $catlink = home_url('?cat=' . $category_id);
        } else {
                $category = &get_category( $category_id );
                if ( is_wp_error( $category ) )
@@ -34,7 +33,7 @@ function get_category_link( $category_id ) {
                        $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 = home_url( user_trailingslashit( $catlink, 'category' ) );
        }
        return apply_filters( 'category_link', $catlink, $category_id );
 }
@@ -176,6 +175,9 @@ function get_the_category_by_ID( $cat_ID ) {
 function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
        global $wp_rewrite;
        $categories = get_the_category( $post_id );
+       if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) )
+               return apply_filters( 'the_category', '', $separator, $parents );
+
        if ( empty( $categories ) )
                return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
 
@@ -208,7 +210,7 @@ function get_the_category_list( $separator = '', $parents='', $post_id = false )
                $i = 0;
                foreach ( $categories as $category ) {
                        if ( 0 < $i )
-                               $thelist .= $separator . ' ';
+                               $thelist .= $separator;
                        switch ( strtolower( $parents ) ) {
                                case 'multiple':
                                        if ( $category->parent )
@@ -315,9 +317,11 @@ function category_description( $category = 0 ) {
  *     '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.
+ *     'name' (string) - The name attribute value for select element.
+ *     'id' (string) - The ID attribute value for select element. Defaults to name if omitted.
+ *     'class' (string) - The class attribute value for select element.
  *     'selected' (int) - Which category ID is selected.
+ *     'taxonomy' (string) - The name of the taxonomy to retrieve. Defaults to category.
  *
  * The 'hierarchical' argument, which is disabled by default, will override the
  * depth argument, unless it is true. When the argument is false, it will
@@ -337,12 +341,20 @@ function wp_dropdown_categories( $args = '' ) {
                'hide_empty' => 1, 'child_of' => 0,
                'exclude' => '', 'echo' => 1,
                'selected' => 0, 'hierarchical' => 0,
-               'name' => 'cat', 'class' => 'postform',
-               'depth' => 0, 'tab_index' => 0
+               'name' => 'cat', 'id' => '',
+               'class' => 'postform', 'depth' => 0,
+               'tab_index' => 0, 'taxonomy' => 'category',
+               'hide_if_empty' => false
        );
 
        $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
 
+       // Back compat.
+       if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
+               _deprecated_argument( __FUNCTION__, '3.0', '' );
+               $args['taxonomy'] = 'link_category';
+       }
+
        $r = wp_parse_args( $args, $defaults );
 
        if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
@@ -356,13 +368,22 @@ function wp_dropdown_categories( $args = '' ) {
        if ( (int) $tab_index > 0 )
                $tab_index_attribute = " tabindex=\"$tab_index\"";
 
-       $categories = get_categories( $r );
-       $name = esc_attr($name);
-       $class = esc_attr($class);
+       $categories = get_terms( $taxonomy, $r );
+       $name = esc_attr( $name );
+       $class = esc_attr( $class );
+       $id = $id ? esc_attr( $id ) : $name;
+
+       if ( ! $r['hide_if_empty'] || ! empty($categories) )
+               $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
+       else
+               $output = '';
+
+       if ( empty($categories) && ! $r['hide_if_empty'] && !empty($show_option_none) ) {
+               $show_option_none = apply_filters( 'list_cats', $show_option_none );
+               $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n";
+       }
 
-       $output = '';
        if ( ! empty( $categories ) ) {
-               $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 );
@@ -382,8 +403,10 @@ function wp_dropdown_categories( $args = '' ) {
                        $depth = -1; // Flat.
 
                $output .= walk_category_dropdown_tree( $categories, $depth, $r );
-               $output .= "</select>\n";
        }
+       if ( ! $r['hide_if_empty'] || ! empty($categories) )
+               $output .= "</select>\n";
+
 
        $output = apply_filters( 'wp_dropdown_cats', $output );
 
@@ -428,44 +451,53 @@ function wp_dropdown_categories( $args = '' ) {
  */
 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' => '',
-               'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0,
+               'show_option_all' => '', 'show_option_none' => __('No categories'),
+               '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' => '',
+               'exclude_tree' => '', 'current_category' => 0,
                'hierarchical' => true, 'title_li' => __( 'Categories' ),
-               'echo' => 1, 'depth' => 0
+               'echo' => 1, 'depth' => 0,
+               'taxonomy' => 'category'
        );
 
        $r = wp_parse_args( $args, $defaults );
 
-       if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
+       if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] )
                $r['pad_counts'] = true;
-       }
 
-       if ( isset( $r['show_date'] ) ) {
+       if ( isset( $r['show_date'] ) )
                $r['include_last_update_time'] = $r['show_date'];
-       }
 
        if ( true == $r['hierarchical'] ) {
                $r['exclude_tree'] = $r['exclude'];
                $r['exclude'] = '';
        }
 
+       if ( !isset( $r['class'] ) )
+               $r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
+
        extract( $r );
 
+       if ( !taxonomy_exists($taxonomy) )
+               return false;
+
        $categories = get_categories( $r );
 
        $output = '';
        if ( $title_li && 'list' == $style )
-                       $output = '<li class="categories">' . $r['title_li'] . '<ul>';
+                       $output = '<li class="' . $class . '">' . $title_li . '<ul>';
 
        if ( empty( $categories ) ) {
-               if ( 'list' == $style )
-                       $output .= '<li>' . __( "No categories" ) . '</li>';
-               else
-                       $output .= __( "No categories" );
+               if ( ! empty( $show_option_none ) ) {
+                       if ( 'list' == $style )
+                               $output .= '<li>' . $show_option_none . '</li>';
+                       else
+                               $output .= $show_option_none;
+               }
        } else {
                global $wp_query;
 
@@ -475,7 +507,7 @@ function wp_list_categories( $args = '' ) {
                        else
                                $output .= '<a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a>';
 
-               if ( empty( $r['current_category'] ) && is_category() )
+               if ( empty( $r['current_category'] ) && ( is_category() || is_tax() ) )
                        $r['current_category'] = $wp_query->get_queried_object_id();
 
                if ( $hierarchical )
@@ -489,7 +521,7 @@ function wp_list_categories( $args = '' ) {
        if ( $title_li && 'list' == $style )
                $output .= '</ul></li>';
 
-       $output = apply_filters( 'wp_list_categories', $output );
+       $output = apply_filters( 'wp_list_categories', $output, $args );
 
        if ( $echo )
                echo $output;
@@ -848,7 +880,8 @@ function term_description( $term = 0, $taxonomy = 'post_tag' ) {
                $taxonomy = $term->taxonomy;
                $term = $term->term_id;
        }
-       return get_term_field( 'description', $term, $taxonomy );
+       $description = get_term_field( 'description', $term, $taxonomy );
+       return is_wp_error( $description ) ? '' : $description;
 }
 
 /**
@@ -973,4 +1006,4 @@ function has_tag( $tag = '', $_post = null ) {
        return $r;
 }
 
-?>
+?>
\ No newline at end of file
index 372c4c70cb770d68c70ab815a898afdd82484635..1f66518536dc57329b3aae10d3414c132fa13192 100644 (file)
@@ -15,7 +15,7 @@
  */
 function get_all_category_ids() {
        if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
-               $cat_ids = get_terms( 'category', 'fields=ids&get=all' );
+               $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
                wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
        }
 
@@ -37,12 +37,17 @@ function get_all_category_ids() {
  * @return array List of categories.
  */
 function &get_categories( $args = '' ) {
-       $defaults = array( 'type' => 'category' );
+       $defaults = array( 'taxonomy' => 'category' );
        $args = wp_parse_args( $args, $defaults );
 
-       $taxonomy = apply_filters( 'get_categories_taxonomy', 'category', $args );
-       if ( 'link' == $args['type'] )
-               $taxonomy = 'link_category';
+       $taxonomy = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
+
+       // Back compat
+       if ( isset($args['type']) && 'link' == $args['type'] ) {
+               _deprecated_argument( __FUNCTION__, '3.0', '' );
+               $taxonomy = $args['taxonomy'] = 'link_category';
+       }
+
        $categories = (array) get_terms( $taxonomy, $args );
 
        foreach ( array_keys( $categories ) as $k )
@@ -98,7 +103,7 @@ function &get_category( $category, $output = OBJECT, $filter = 'raw' ) {
  * @since 2.1.0
  *
  * @param string $category_path URL containing category slugs.
- * @param bool $full_match Optional. Whether should match full path or not.
+ * @param bool $full_match Optional. Whether full path should be matched.
  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
  * @return null|object|array Null on failure. Type is based on $output value.
  */
@@ -113,7 +118,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
        foreach ( (array) $category_paths as $pathdir )
                $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
 
-       $categories = get_terms( 'category', "get=all&slug=$leaf_path" );
+       $categories = get_terms( 'category', array('get' => 'all', 'slug' => $leaf_path) );
 
        if ( empty( $categories ) )
                return null;
@@ -178,11 +183,13 @@ function get_cat_ID( $cat_name='General' ) {
  * @since 1.0.0
  *
  * @param int $cat_id Category ID
- * @return string Category name
+ * @return string Category name, or an empty string if category doesn't exist.
  */
 function get_cat_name( $cat_id ) {
        $cat_id = (int) $cat_id;
        $category = &get_category( $cat_id );
+       if ( ! $category || is_wp_error( $category ) )
+               return '';
        return $category->name;
 }
 
index f8d61fe82423abaa3a2cb36af232e9336e6351c4..49f80b0ca78a6677cdf143337b7b66e2d141040c 100644 (file)
@@ -356,7 +356,7 @@ EOD;
             $args = $args[0];
         }
         // Are we dealing with a function or a method?
-        if (substr($method, 0, 5) == 'this:') {
+        if ( is_string( $method ) && substr($method, 0, 5) == 'this:' ) {
             // It's a class method - check it exists
             $method = substr($method, 5);
             if (!method_exists($this, $method)) {
@@ -581,7 +581,8 @@ class IXR_Client {
                 $gettingHeaders = false;
             }
             if (!$gettingHeaders) {
-                $contents .= trim($line);
+               // WP#12559 remove trim so as to not strip newlines from received response.
+                $contents .= $line;
             }
             if ($this->debug) {
                 $debug_contents .= $line;
diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php
new file mode 100644 (file)
index 0000000..d913d6d
--- /dev/null
@@ -0,0 +1,2002 @@
+<?php
+/**
+ * Simple and uniform HTTP request API.
+ *
+ * Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk
+ * decoding, if HTTP 1.1 and various other difficult HTTP protocol implementations.
+ *
+ * @link http://trac.wordpress.org/ticket/4779 HTTP API Proposal
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+
+/**
+ * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
+ *
+ * This class is called for the functionality of making HTTP requests and replaces Snoopy
+ * functionality. There is no available functionality to add HTTP transport implementations, since
+ * most of the HTTP transports are added and available for use.
+ *
+ * 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.
+ *
+ * Debugging includes several actions, which pass different variables for debugging the HTTP API.
+ *
+ * <strong>http_transport_get_debug</strong> - gives working, nonblocking, and blocking transports.
+ *
+ * <strong>http_transport_post_debug</strong> - gives working, nonblocking, and blocking transports.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http {
+
+       /**
+        * PHP4 style Constructor - Calls PHP5 Style Constructor
+        *
+        * @since 2.7.0
+        * @return WP_Http
+        */
+       function WP_Http() {
+               $this->__construct();
+       }
+
+       /**
+        * PHP5 style Constructor - Set up 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 set up to save time and will only be created
+        * once. This class can be created many times without having to go through the step of finding
+        * which transports are available.
+        *
+        * @since 2.7.0
+        * @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 HTTP Extension, cURL, Streams, 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 [the]
+        * connected host has failed to respond."
+        *
+        * @since 2.7.0
+        * @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($args) ) {
+                               $working_transport['exthttp'] = new WP_Http_ExtHttp();
+                               $blocking_transport[] = &$working_transport['exthttp'];
+                       } else if ( true === WP_Http_Curl::test($args) ) {
+                               $working_transport['curl'] = new WP_Http_Curl();
+                               $blocking_transport[] = &$working_transport['curl'];
+                       } else if ( true === WP_Http_Streams::test($args) ) {
+                               $working_transport['streams'] = new WP_Http_Streams();
+                               $blocking_transport[] = &$working_transport['streams'];
+                       } else if ( true === WP_Http_Fopen::test($args) ) {
+                               $working_transport['fopen'] = new WP_Http_Fopen();
+                               $blocking_transport[] = &$working_transport['fopen'];
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
+                               $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];
+                       }
+               }
+
+               do_action( 'http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_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.0
+        * @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($args) ) {
+                               $working_transport['exthttp'] = new WP_Http_ExtHttp();
+                               $blocking_transport[] = &$working_transport['exthttp'];
+                       } else if ( true === WP_Http_Curl::test($args) ) {
+                               $working_transport['curl'] = new WP_Http_Curl();
+                               $blocking_transport[] = &$working_transport['curl'];
+                       } else if ( true === WP_Http_Streams::test($args) ) {
+                               $working_transport['streams'] = new WP_Http_Streams();
+                               $blocking_transport[] = &$working_transport['streams'];
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
+                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
+                               $blocking_transport[] = &$working_transport['fsockopen'];
+                       }
+
+                       foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {
+                               if ( isset($working_transport[$transport]) )
+                                       $nonblocking_transport[] = &$working_transport[$transport];
+                       }
+               }
+
+               do_action( 'http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_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.0
+        * @todo Refactor this code. The code in this method extends the scope of its original purpose
+        *              and should be refactored to allow for cleaner abstraction and reduce duplication of the
+        *              code. One suggestion is to create a class specifically for the arguments, however
+        *              preliminary refactoring to this affect has affect more than just the scope of the
+        *              arguments. Something to ponder at least.
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return array containing 'headers', 'body', 'response', 'cookies'
+        */
+       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 . '; ' . get_bloginfo( 'url' )  ),
+                       'blocking' => true,
+                       'headers' => array(),
+                       'cookies' => array(),
+                       'body' => null,
+                       'compress' => false,
+                       'decompress' => true,
+                       'sslverify' => true
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+               $r = apply_filters( 'http_request_args', $r, $url );
+
+               // Allow plugins to short-circuit the request
+               $pre = apply_filters( 'pre_http_request', false, $r, $url );
+               if ( false !== $pre )
+                       return $pre;
+
+               $arrURL = parse_url($url);
+
+               if ( empty( $url ) || empty($url['scheme'] ) )
+                       return new WP_Error('http_request_failed', __('A valid URL was not provided.'));
+
+               if ( $this->block_request( $url ) )
+                       return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
+
+               // Determine if this is a https call and pass that on to the transport functions
+               // so that we can blacklist the transports that do not support ssl verification
+               $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
+
+               // Determine if this request is to OUR install of WordPress
+               $homeURL = parse_url( get_bloginfo('url') );
+               $r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
+               unset($homeURL);
+
+               if ( is_null( $r['headers'] ) )
+                       $r['headers'] = array();
+
+               if ( ! is_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']);
+               }
+
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
+               if ( WP_Http_Encoding::is_available() )
+                       $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
+
+               if ( empty($r['body']) ) {
+                       // Some servers fail when sending content without the content-length header being set.
+                       // Also, to fix another bug, we only send when doing POST and PUT and the content-length
+                       // header isn't already set.
+                       if( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset($r['headers']['Content-Length']) )
+                               $r['headers']['Content-Length'] = 0;
+
+                       // The method is ambiguous, because we aren't talking about HTTP methods, the "get" in
+                       // this case is simply that we aren't sending any bodies and to get the transports that
+                       // don't support sending bodies along with those which do.
+                       $transports = WP_Http::_getTransport($r);
+               } else {
+                       if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
+                               if ( ! version_compare(phpversion(), '5.1.2', '>=') )
+                                       $r['body'] = _http_build_query($r['body'], null, '&');
+                               else
+                                       $r['body'] = http_build_query($r['body'], null, '&');
+                               $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
+                               $r['headers']['Content-Length'] = strlen($r['body']);
+                       }
+
+                       if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
+                               $r['headers']['Content-Length'] = strlen($r['body']);
+
+                       // The method is ambiguous, because we aren't talking about HTTP methods, the "post" in
+                       // this case is simply that we are sending HTTP body and to get the transports that do
+                       // support sending the body. Not all do, depending on the limitations of the PHP core
+                       // limitations.
+                       $transports = WP_Http::_postTransport($r);
+               }
+
+               do_action( 'http_api_debug', $transports, 'transports_list' );
+
+               $response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+               foreach ( (array) $transports as $transport ) {
+                       $response = $transport->request($url, $r);
+
+                       do_action( 'http_api_debug', $response, 'response', get_class($transport) );
+
+                       if ( ! is_wp_error($response) )
+                               return apply_filters( 'http_response', $response, $r, $url );
+               }
+
+               return $response;
+       }
+
+       /**
+        * Uses the POST HTTP method.
+        *
+        * Used for sending data that is expected to be in the body.
+        *
+        * @access public
+        * @since 2.7.0
+        *
+        * @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.0
+        *
+        * @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.0
+        *
+        * @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.0
+        *
+        * @param string $strResponse The full response string
+        * @return array Array with 'headers' and 'body' keys.
+        */
+       function processResponse($strResponse) {
+               $res = explode("\r\n\r\n", $strResponse, 2);
+
+               return array('headers' => isset($res[0]) ? $res[0] : array(), 'body' => isset($res[1]) ? $res[1] : '');
+       }
+
+       /**
+        * 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.0
+        *
+        * @param string|array $headers
+        * @return array Processed string headers. If duplicate headers are encountered,
+        *                                      Then a numbered array is returned as the value of that header-key.
+        */
+       function processHeaders($headers) {
+               // split headers, one per array element
+               if ( is_string($headers) ) {
+                       // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
+                       $headers = str_replace("\r\n", "\n", $headers);
+                       // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
+                       $headers = preg_replace('/\n[ \t]/', ' ', $headers);
+                       // create the headers array
+                       $headers = explode("\n", $headers);
+               }
+
+               $response = array('code' => 0, 'message' => '');
+
+               // If a redirection has taken place, The headers for each page request may have been passed.
+               // In this case, determine the final HTTP header and parse from there.
+               for ( $i = count($headers)-1; $i >= 0; $i-- ) {
+                       if ( !empty($headers[$i]) && false === strpos($headers[$i], ':') ) {
+                               $headers = array_splice($headers, $i);
+                               break;
+                       }
+               }
+
+               $cookies = array();
+               $newheaders = array();
+               foreach ( $headers as $tempheader ) {
+                       if ( empty($tempheader) )
+                               continue;
+
+                       if ( false === strpos($tempheader, ':') ) {
+                               list( , $response['code'], $response['message']) = explode(' ', $tempheader, 3);
+                               continue;
+                       }
+
+                       list($key, $value) = explode(':', $tempheader, 2);
+
+                       if ( !empty( $value ) ) {
+                               $key = strtolower( $key );
+                               if ( isset( $newheaders[$key] ) ) {
+                                       if ( !is_array($newheaders[$key]) )
+                                               $newheaders[$key] = array($newheaders[$key]);
+                                       $newheaders[$key][] = trim( $value );
+                               } else {
+                                       $newheaders[$key] = trim( $value );
+                               }
+                               if ( 'set-cookie' == strtolower( $key ) )
+                                       $cookies[] = new WP_Http_Cookie( $value );
+                       }
+               }
+
+               return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies);
+       }
+
+       /**
+        * Takes the arguments for a ::request() and checks for the cookie array.
+        *
+        * If it's found, then it's assumed to contain WP_Http_Cookie objects, which are each parsed
+        * into strings and added to the Cookie: header (within the arguments array). Edits the array by
+        * reference.
+        *
+        * @access public
+        * @version 2.8.0
+        * @static
+        *
+        * @param array $r Full array of args passed into ::request()
+        */
+       function buildCookieHeader( &$r ) {
+               if ( ! empty($r['cookies']) ) {
+                       $cookies_header = '';
+                       foreach ( (array) $r['cookies'] as $cookie ) {
+                               $cookies_header .= $cookie->getHeaderValue() . '; ';
+                       }
+                       $cookies_header = substr( $cookies_header, 0, -2 );
+                       $r['headers']['cookie'] = $cookies_header;
+               }
+       }
+
+       /**
+        * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
+        *
+        * 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.0
+        * @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;
+                       }
+               }
+       }
+
+       /**
+        * Block requests through the proxy.
+        *
+        * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will
+        * prevent plugins from working and core functionality, if you don't include api.wordpress.org.
+        *
+        * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true in your wp-config.php
+        * file and this will only allow localhost and your blog to make requests. The constant
+        * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
+        * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow.
+        *
+        * @since 2.8.0
+        * @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
+        *
+        * @param string $uri URI of url.
+        * @return bool True to block, false to allow.
+        */
+       function block_request($uri) {
+               // We don't need to block requests, because nothing is blocked.
+               if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL )
+                       return false;
+
+               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+               // This will be displayed on blogs, which is not reasonable.
+               $check = @parse_url($uri);
+
+               /* Malformed URL, can not process, but this could mean ssl, so let through anyway.
+                *
+                * This isn't very security sound. There are instances where a hacker might attempt
+                * to bypass the proxy and this check. However, the reason for this behavior is that
+                * WordPress does not do any checking currently for non-proxy requests, so it is keeps with
+                * the default unsecure nature of the HTTP request.
+                */
+               if ( $check === false )
+                       return false;
+
+               $home = parse_url( get_option('siteurl') );
+
+               // Don't block requests back to ourselves by default
+               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+                       return apply_filters('block_local_requests', false);
+
+               if ( !defined('WP_ACCESSIBLE_HOSTS') )
+                       return true;
+
+               static $accessible_hosts;
+               if ( null == $accessible_hosts )
+                       $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
+
+               return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
+       }
+}
+
+/**
+ * HTTP request method uses fsockopen function to retrieve the url.
+ *
+ * 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.0
+ */
+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', 'cookies' 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, 'cookies' => array()
+               );
+
+               $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']);
+               }
+
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
+               $iError = null; // Store error number
+               $strError = null; // Store error string
+
+               $arrURL = parse_url($url);
+
+               $fsockopen_host = $arrURL['host'];
+
+               $secure_transport = false;
+
+               if ( ! isset( $arrURL['port'] ) ) {
+                       if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
+                               $fsockopen_host = "ssl://$fsockopen_host";
+                               $arrURL['port'] = 443;
+                               $secure_transport = true;
+                       } else {
+                               $arrURL['port'] = 80;
+                       }
+               }
+
+               //fsockopen has issues with 'localhost' with IPv6 with certain versions of PHP, It attempts to connect to ::1,
+               // which fails when the server is not set up for it. For compatibility, always connect to the IPv4 address.
+               if ( 'localhost' == strtolower($fsockopen_host) )
+                       $fsockopen_host = '127.0.0.1';
+
+               // 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();
+
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( !WP_DEBUG ) {
+                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                               $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+                       else
+                               $handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+               } else {
+                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                               $handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+                       else
+                               $handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+               }
+
+               $endDelay = time();
+
+               // 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);
+
+               $timeout = (int) floor( $r['timeout'] );
+               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
+               stream_set_timeout( $handle, $timeout, $utimeout );
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field.
+                       $requestPath = $url;
+               else
+                       $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
+
+               if ( empty($requestPath) )
+                       $requestPath .= '/';
+
+               $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                       $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
+               else
+                       $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
+
+               if ( isset($r['user-agent']) )
+                       $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
+
+               if ( is_array($r['headers']) ) {
+                       foreach ( (array) $r['headers'] as $header => $headerValue )
+                               $strHeaders .= $header . ': ' . $headerValue . "\r\n";
+               } else {
+                       $strHeaders .= $r['headers'];
+               }
+
+               if ( $proxy->use_authentication() )
+                       $strHeaders .= $proxy->authentication_header() . "\r\n";
+
+               $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' => false, 'message' => false), 'cookies' => array() );
+               }
+
+               $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 ( 'HEAD' != $r['method'] && 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']);
+
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) )
+                       $process['body'] = WP_Http_Encoding::decompress( $process['body'] );
+
+               return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @since 2.7.0
+        * @static
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test( $args = array() ) {
+               if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
+                       return false;
+
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
+
+               if ( ! $is_ssl && function_exists( 'fsockopen' ) )
+                       $use = true;
+               elseif ( $is_ssl && extension_loaded('openssl') && function_exists( 'fsockopen' ) )
+                       $use = true;
+               else
+                       $use = false;
+
+               return apply_filters('use_fsockopen_transport', $use, $args);
+       }
+}
+
+/**
+ * HTTP request method uses fopen function to retrieve the url.
+ *
+ * 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.0
+ */
+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.0
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null, 'cookies' => array()
+               );
+
+               $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 ( is_null( $r['headers'] ) )
+                       $r['headers'] = array();
+
+               if ( is_string($r['headers']) ) {
+                       $processedHeaders = WP_Http::processHeaders($r['headers']);
+                       $r['headers'] = $processedHeaders['headers'];
+               }
+
+               $initial_user_agent = ini_get('user_agent');
+
+               if ( !empty($r['headers']) && is_array($r['headers']) ) {
+                       $user_agent_extra_headers = '';
+                       foreach ( $r['headers'] as $header => $value )
+                               $user_agent_extra_headers .= "\r\n$header: $value";
+                       @ini_set('user_agent', $r['user-agent'] . $user_agent_extra_headers);
+               } else {
+                       @ini_set('user_agent', $r['user-agent']);
+               }
+
+               if ( !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));
+
+               $timeout = (int) floor( $r['timeout'] );
+               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
+               stream_set_timeout( $handle, $timeout, $utimeout );
+
+               if ( ! $r['blocking'] ) {
+                       fclose($handle);
+                       @ini_set('user_agent', $initial_user_agent); //Clean up any extra headers added
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+               }
+
+               $strResponse = '';
+               while ( ! feof($handle) )
+                       $strResponse .= fread($handle, 4096);
+
+               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 {
+                       //$http_response_header is a PHP reserved variable which is set in the current-scope when using the HTTP Wrapper
+                       //see http://php.oregonstate.edu/manual/en/reserved.variables.httpresponseheader.php
+                       $theHeaders = $http_response_header;
+               }
+
+               fclose($handle);
+
+               @ini_set('user_agent', $initial_user_agent); //Clean up any extra headers added
+
+               $processedHeaders = WP_Http::processHeaders($theHeaders);
+
+               if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
+                       $strResponse = WP_Http::chunkTransferDecode($strResponse);
+
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
+
+               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @since 2.7.0
+        * @static
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test($args = array()) {
+               if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+                       return false;
+
+               if ( isset($args['method']) && 'HEAD' == $args['method'] ) //This transport cannot make a HEAD request
+                       return false;
+
+               $use = true;
+               //PHP does not verify SSL certs, We can only make a request via this transports if SSL Verification is turned off.
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
+               if ( $is_ssl ) {
+                       $is_local = isset($args['local']) && $args['local'];
+                       $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+                       if ( $is_local && true != apply_filters('https_local_ssl_verify', true) )
+                               $use = true;
+                       elseif ( !$is_local && true != apply_filters('https_ssl_verify', true) )
+                               $use = true;
+                       elseif ( !$ssl_verify )
+                               $use = true;
+                       else
+                               $use = false;
+               }
+
+               return apply_filters('use_fopen_transport', $use, $args);
+       }
+}
+
+/**
+ * HTTP request method uses Streams to retrieve the url.
+ *
+ * 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.0
+ */
+class WP_Http_Streams {
+       /**
+        * Send a HTTP request to a URI using streams with fopen().
+        *
+        * @access public
+        * @since 2.7.0
+        *
+        * @param string $url
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null, 'cookies' => array()
+               );
+
+               $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']);
+               }
+
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
+               $arrURL = parse_url($url);
+
+               if ( false === $arrURL )
+                       return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
+
+               if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
+                       $url = preg_replace('|^' . preg_quote($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'];
+
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+               $arrContext = array('http' =>
+                       array(
+                               'method' => strtoupper($r['method']),
+                               'user_agent' => $r['user-agent'],
+                               'max_redirects' => $r['redirection'] + 1, // See #11557
+                               'protocol_version' => (float) $r['httpversion'],
+                               'header' => $strHeaders,
+                               'ignore_errors' => true, // Return non-200 requests.
+                               'timeout' => $r['timeout'],
+                               'ssl' => array(
+                                               'verify_peer' => $ssl_verify,
+                                               'verify_host' => $ssl_verify
+                               )
+                       )
+               );
+
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+                       $arrContext['http']['proxy'] = 'tcp://' . $proxy->host() . ':' . $proxy->port();
+                       $arrContext['http']['request_fulluri'] = true;
+
+                       // We only support Basic authentication so this will only work if that is what your proxy supports.
+                       if ( $proxy->use_authentication() )
+                               $arrContext['http']['header'] .= $proxy->authentication_header() . "\r\n";
+               }
+
+               if ( 'HEAD' == $r['method'] ) // Disable redirects for HEAD requests
+                       $arrContext['http']['max_redirects'] = 1;
+
+               if ( ! empty($r['body'] ) )
+                       $arrContext['http']['content'] = $r['body'];
+
+               $context = stream_context_create($arrContext);
+
+               if ( !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));
+
+               $timeout = (int) floor( $r['timeout'] );
+               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
+               stream_set_timeout( $handle, $timeout, $utimeout );
+
+               if ( ! $r['blocking'] ) {
+                       stream_set_blocking($handle, 0);
+                       fclose($handle);
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+               }
+
+               $strResponse = stream_get_contents($handle);
+               $meta = stream_get_meta_data($handle);
+
+               fclose($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);
+
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
+
+               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @access public
+        * @since 2.7.0
+        *
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test($args = array()) {
+               if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+                       return false;
+
+               if ( version_compare(PHP_VERSION, '5.0', '<') )
+                       return false;
+
+               //HTTPS via Proxy was added in 5.1.0
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
+               if ( $is_ssl && version_compare(PHP_VERSION, '5.1.0', '<') ) {
+                       $proxy = new WP_HTTP_Proxy();
+                       /**
+                        * No URL check, as its not currently passed to the ::test() function
+                        * In the case where a Proxy is in use, Just bypass this transport for HTTPS.
+                        */
+                       if ( $proxy->is_enabled() )
+                               return false;
+               }
+
+               return apply_filters('use_streams_transport', true, $args);
+       }
+}
+
+/**
+ * HTTP request method uses HTTP extension to retrieve the url.
+ *
+ * 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.0
+ */
+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', 'cookies' 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, 'cookies' => array()
+               );
+
+               $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']);
+               }
+
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
+               switch ( $r['method'] ) {
+                       case 'POST':
+                               $r['method'] = HTTP_METH_POST;
+                               break;
+                       case 'HEAD':
+                               $r['method'] = HTTP_METH_HEAD;
+                               break;
+                       case 'PUT':
+                               $r['method'] =  HTTP_METH_PUT;
+                               break;
+                       case 'GET':
+                       default:
+                               $r['method'] = HTTP_METH_GET;
+               }
+
+               $arrURL = parse_url($url);
+
+               if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
+                       $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
+
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+               $r['timeout'] = (int) ceil( $r['timeout'] );
+
+               $options = array(
+                       'timeout' => $r['timeout'],
+                       'connecttimeout' => $r['timeout'],
+                       'redirect' => $r['redirection'],
+                       'useragent' => $r['user-agent'],
+                       'headers' => $r['headers'],
+                       'ssl' => array(
+                               'verifypeer' => $ssl_verify,
+                               'verifyhost' => $ssl_verify
+                       )
+               );
+
+               if ( HTTP_METH_HEAD == $r['method'] )
+                       $options['redirect'] = 0; // Assumption: Docs seem to suggest that this means do not follow. Untested.
+
+               // The HTTP extensions offers really easy proxy support.
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+                       $options['proxyhost'] = $proxy->host();
+                       $options['proxyport'] = $proxy->port();
+                       $options['proxytype'] = HTTP_PROXY_HTTP;
+
+                       if ( $proxy->use_authentication() ) {
+                               $options['proxyauth'] = $proxy->authentication();
+                               $options['proxyauthtype'] = HTTP_AUTH_ANY;
+                       }
+               }
+
+               if ( !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
+
+               // Error may still be set, Response may return headers or partial document, and error
+               // contains a reason the request was aborted, eg, timeout expired or max-redirects reached.
+               if ( false === $strResponse || ! empty($info['error']) )
+                       return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
+
+               if ( ! $r['blocking'] )
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+
+               $headers_body = WP_HTTP::processResponse($strResponse);
+               $theHeaders = $headers_body['headers'];
+               $theBody = $headers_body['body'];
+               unset($headers_body);
+
+               $theHeaders = WP_Http::processHeaders($theHeaders);
+
+               if ( ! empty( $theBody ) && isset( $theHeaders['headers']['transfer-encoding'] ) && 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
+                       if ( !WP_DEBUG )
+                               $theBody = @http_chunked_decode($theBody);
+                       else
+                               $theBody = http_chunked_decode($theBody);
+               }
+
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+                       $theBody = http_inflate( $theBody );
+
+               $theResponse = array();
+               $theResponse['code'] = $info['response_code'];
+               $theResponse['message'] = get_status_header_desc($info['response_code']);
+
+               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse, 'cookies' => $theHeaders['cookies']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @since 2.7.0
+        *
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test($args = array()) {
+               return apply_filters('use_http_extension_transport', function_exists('http_request'), $args );
+       }
+}
+
+/**
+ * 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.0
+        *
+        * @param string $url
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null, 'cookies' => array()
+               );
+
+               $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']);
+               }
+
+               // Construct Cookie: header if any cookies are set.
+               WP_Http::buildCookieHeader( $r );
+
+               $handle = curl_init();
+
+               // cURL offers really easy proxy support.
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+
+                       $isPHP5 = version_compare(PHP_VERSION, '5.0.0', '>=');
+
+                       if ( $isPHP5 ) {
+                               curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
+                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
+                               curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
+                       } else {
+                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() .':'. $proxy->port() );
+                       }
+
+                       if ( $proxy->use_authentication() ) {
+                               if ( $isPHP5 )
+                                       curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
+
+                               curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
+                       }
+               }
+
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+
+               // CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers.  Have to use ceil since
+               // a value of 0 will allow an ulimited timeout.
+               $timeout = (int) ceil( $r['timeout'] );
+               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
+               curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
+
+               curl_setopt( $handle, CURLOPT_URL, $url);
+               curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
+               curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, $ssl_verify );
+               curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
+               curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
+               curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
+
+               switch ( $r['method'] ) {
+                       case 'HEAD':
+                               curl_setopt( $handle, CURLOPT_NOBODY, true );
+                               break;
+                       case 'POST':
+                               curl_setopt( $handle, CURLOPT_POST, true );
+                               curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
+                               break;
+                       case 'PUT':
+                               curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
+                               curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
+                               break;
+               }
+
+               if ( true === $r['blocking'] )
+                       curl_setopt( $handle, CURLOPT_HEADER, true );
+               else
+                       curl_setopt( $handle, CURLOPT_HEADER, false );
+
+               // The option doesn't work with safe mode or when open_basedir is set.
+               // Disable HEAD when making HEAD requests.
+               if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 'HEAD' != $r['method'] )
+                       curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
+
+               if ( !empty( $r['headers'] ) ) {
+                       // cURL expects full header strings in each element
+                       $headers = array();
+                       foreach ( $r['headers'] as $name => $value ) {
+                               $headers[] = "{$name}: $value";
+                       }
+                       curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
+               }
+
+               if ( $r['httpversion'] == '1.0' )
+                       curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
+               else
+                       curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
+
+               // Cookies are not handled by the HTTP API currently. Allow for plugin authors to handle it
+               // themselves... Although, it is somewhat pointless without some reference.
+               do_action_ref_array( 'http_api_curl', array(&$handle) );
+
+               // We don't need to return the body, so don't. Just execute request and return.
+               if ( ! $r['blocking'] ) {
+                       curl_exec( $handle );
+                       curl_close( $handle );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+               }
+
+               $theResponse = curl_exec( $handle );
+
+               if ( !empty($theResponse) ) {
+                       $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
+                       $theHeaders = trim( substr($theResponse, 0, $headerLength) );
+                       if ( strlen($theResponse) > $headerLength )
+                               $theBody = substr( $theResponse, $headerLength );
+                       else
+                               $theBody = '';
+                       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(), 'cookies' => array() );
+                       $theBody = '';
+               }
+
+               $response = array();
+               $response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
+               $response['message'] = get_status_header_desc($response['code']);
+
+               curl_close( $handle );
+
+               // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually.
+               if ( !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) {
+                       if ( $r['redirection']-- > 0 ) {
+                               return $this->request($theHeaders['headers']['location'], $r);
+                       } else {
+                               return new WP_Error('http_request_failed', __('Too many redirects.'));
+                       }
+               }
+
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+                       $theBody = WP_Http_Encoding::decompress( $theBody );
+
+               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @since 2.7.0
+        *
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test($args = array()) {
+               if ( function_exists('curl_init') && function_exists('curl_exec') )
+                       return apply_filters('use_curl_transport', true, $args);
+
+               return false;
+       }
+}
+
+/**
+ * Adds Proxy support to the WordPress HTTP API.
+ *
+ * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
+ * enable proxy support. There are also a few filters that plugins can hook into for some of the
+ * constants.
+ *
+ * Please note that only BASIC authentication is supported by most transports.
+ * cURL and the PHP HTTP Extension MAY support more methods (such as NTLM authentication) depending on your environment.
+ *
+ * The constants are as follows:
+ * <ol>
+ * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
+ * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
+ * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
+ * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
+ * <li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
+ * You do not need to have localhost and the blog host in this list, because they will not be passed
+ * through the proxy. The list should be presented in a comma separated list</li>
+ * </ol>
+ *
+ * An example can be as seen below.
+ * <code>
+ * define('WP_PROXY_HOST', '192.168.84.101');
+ * define('WP_PROXY_PORT', '8080');
+ * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
+ * </code>
+ *
+ * @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
+ * @since 2.8
+ */
+class WP_HTTP_Proxy {
+
+       /**
+        * Whether proxy connection should be used.
+        *
+        * @since 2.8
+        * @use WP_PROXY_HOST
+        * @use WP_PROXY_PORT
+        *
+        * @return bool
+        */
+       function is_enabled() {
+               return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT');
+       }
+
+       /**
+        * Whether authentication should be used.
+        *
+        * @since 2.8
+        * @use WP_PROXY_USERNAME
+        * @use WP_PROXY_PASSWORD
+        *
+        * @return bool
+        */
+       function use_authentication() {
+               return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD');
+       }
+
+       /**
+        * Retrieve the host for the proxy server.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function host() {
+               if ( defined('WP_PROXY_HOST') )
+                       return WP_PROXY_HOST;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the port for the proxy server.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function port() {
+               if ( defined('WP_PROXY_PORT') )
+                       return WP_PROXY_PORT;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the username for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function username() {
+               if ( defined('WP_PROXY_USERNAME') )
+                       return WP_PROXY_USERNAME;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the password for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function password() {
+               if ( defined('WP_PROXY_PASSWORD') )
+                       return WP_PROXY_PASSWORD;
+
+               return '';
+       }
+
+       /**
+        * Retrieve authentication string for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function authentication() {
+               return $this->username() . ':' . $this->password();
+       }
+
+       /**
+        * Retrieve header string for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function authentication_header() {
+               return 'Proxy-Authorization: Basic ' . base64_encode( $this->authentication() );
+       }
+
+       /**
+        * Whether URL should be sent through the proxy server.
+        *
+        * We want to keep localhost and the blog URL from being sent through the proxy server, because
+        * some proxies can not handle this. We also have the constant available for defining other
+        * hosts that won't be sent through the proxy.
+        *
+        * @uses WP_PROXY_BYPASS_HOSTS
+        * @since unknown
+        *
+        * @param string $uri URI to check.
+        * @return bool True, to send through the proxy and false if, the proxy should not be used.
+        */
+       function send_through_proxy( $uri ) {
+               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+               // This will be displayed on blogs, which is not reasonable.
+               $check = @parse_url($uri);
+
+               // Malformed URL, can not process, but this could mean ssl, so let through anyway.
+               if ( $check === false )
+                       return true;
+
+               $home = parse_url( get_option('siteurl') );
+
+               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+                       return false;
+
+               if ( !defined('WP_PROXY_BYPASS_HOSTS') )
+                       return true;
+
+               static $bypass_hosts;
+               if ( null == $bypass_hosts )
+                       $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
+
+               return !in_array( $check['host'], $bypass_hosts );
+       }
+}
+/**
+ * Internal representation of a single cookie.
+ *
+ * Returned cookies are represented using this class, and when cookies are set, if they are not
+ * already a WP_Http_Cookie() object, then they are turned into one.
+ *
+ * @todo The WordPress convention is to use underscores instead of camelCase for function and method
+ * names. Need to switch to use underscores instead for the methods.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.8.0
+ */
+class WP_Http_Cookie {
+
+       /**
+        * Cookie name.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $name;
+
+       /**
+        * Cookie value.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $value;
+
+       /**
+        * When the cookie expires.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $expires;
+
+       /**
+        * Cookie URL path.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $path;
+
+       /**
+        * Cookie Domain.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $domain;
+
+       /**
+        * PHP4 style Constructor - Calls PHP5 Style Constructor.
+        *
+        * @access public
+        * @since 2.8.0
+        * @param string|array $data Raw cookie data.
+        */
+       function WP_Http_Cookie( $data ) {
+               $this->__construct( $data );
+       }
+
+       /**
+        * Sets up this cookie object.
+        *
+        * The parameter $data should be either an associative array containing the indices names below
+        * or a header string detailing it.
+        *
+        * If it's an array, it should include the following elements:
+        * <ol>
+        * <li>Name</li>
+        * <li>Value - should NOT be urlencoded already.</li>
+        * <li>Expires - (optional) String or int (UNIX timestamp).</li>
+        * <li>Path (optional)</li>
+        * <li>Domain (optional)</li>
+        * </ol>
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @param string|array $data Raw cookie data.
+        */
+       function __construct( $data ) {
+               if ( is_string( $data ) ) {
+                       // Assume it's a header string direct from a previous request
+                       $pairs = explode( ';', $data );
+
+                       // Special handling for first pair; name=value. Also be careful of "=" in value
+                       $name  = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) );
+                       $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 );
+                       $this->name  = $name;
+                       $this->value = urldecode( $value );
+                       array_shift( $pairs ); //Removes name=value from items.
+
+                       // Set everything else as a property
+                       foreach ( $pairs as $pair ) {
+                               $pair = rtrim($pair);
+                               if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
+                                       continue;
+
+                               list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' );
+                               $key = strtolower( trim( $key ) );
+                               if ( 'expires' == $key )
+                                       $val = strtotime( $val );
+                               $this->$key = $val;
+                       }
+               } else {
+                       if ( !isset( $data['name'] ) )
+                               return false;
+
+                       // Set properties based directly on parameters
+                       $this->name   = $data['name'];
+                       $this->value  = isset( $data['value'] ) ? $data['value'] : '';
+                       $this->path   = isset( $data['path'] ) ? $data['path'] : '';
+                       $this->domain = isset( $data['domain'] ) ? $data['domain'] : '';
+
+                       if ( isset( $data['expires'] ) )
+                               $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] );
+                       else
+                               $this->expires = null;
+               }
+       }
+
+       /**
+        * Confirms that it's OK to send this cookie to the URL checked against.
+        *
+        * Decision is based on RFC 2109/2965, so look there for details on validity.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @param string $url URL you intend to send this cookie to
+        * @return boolean TRUE if allowed, FALSE otherwise.
+        */
+       function test( $url ) {
+               // Expires - if expired then nothing else matters
+               if ( time() > $this->expires )
+                       return false;
+
+               // Get details on the URL we're thinking about sending to
+               $url = parse_url( $url );
+               $url['port'] = isset( $url['port'] ) ? $url['port'] : 80;
+               $url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
+
+               // Values to use for comparison against the URL
+               $path   = isset( $this->path )   ? $this->path   : '/';
+               $port   = isset( $this->port )   ? $this->port   : 80;
+               $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] );
+               if ( false === stripos( $domain, '.' ) )
+                       $domain .= '.local';
+
+               // Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
+               $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
+               if ( substr( $url['host'], -strlen( $domain ) ) != $domain )
+                       return false;
+
+               // Port - supports "port-lists" in the format: "80,8000,8080"
+               if ( !in_array( $url['port'], explode( ',', $port) ) )
+                       return false;
+
+               // Path - request path must start with path restriction
+               if ( substr( $url['path'], 0, strlen( $path ) ) != $path )
+                       return false;
+
+               return true;
+       }
+
+       /**
+        * Convert cookie name and value back to header string.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @return string Header encoded cookie name and value.
+        */
+       function getHeaderValue() {
+               if ( empty( $this->name ) || empty( $this->value ) )
+                       return '';
+
+               return $this->name . '=' . urlencode( $this->value );
+       }
+
+       /**
+        * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @return string
+        */
+       function getFullHeader() {
+               return 'Cookie: ' . $this->getHeaderValue();
+       }
+}
+
+/**
+ * Implementation for deflate and gzip transfer encodings.
+ *
+ * Includes RFC 1950, RFC 1951, and RFC 1952.
+ *
+ * @since 2.8
+ * @package WordPress
+ * @subpackage HTTP
+ */
+class WP_Http_Encoding {
+
+       /**
+        * Compress raw string using the deflate format.
+        *
+        * Supports the RFC 1951 standard.
+        *
+        * @since 2.8
+        *
+        * @param string $raw String to compress.
+        * @param int $level Optional, default is 9. Compression level, 9 is highest.
+        * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
+        * @return string|bool False on failure.
+        */
+       function compress( $raw, $level = 9, $supports = null ) {
+               return gzdeflate( $raw, $level );
+       }
+
+       /**
+        * Decompression of deflated string.
+        *
+        * Will attempt to decompress using the RFC 1950 standard, and if that fails
+        * then the RFC 1951 standard deflate will be attempted. Finally, the RFC
+        * 1952 standard gzip decode will be attempted. If all fail, then the
+        * original compressed string will be returned.
+        *
+        * @since 2.8
+        *
+        * @param string $compressed String to decompress.
+        * @param int $length The optional length of the compressed data.
+        * @return string|bool False on failure.
+        */
+       function decompress( $compressed, $length = null ) {
+
+               if ( empty($compressed) )
+                       return $compressed;
+
+               if ( false !== ( $decompressed = @gzinflate( $compressed ) ) )
+                       return $decompressed;
+
+               if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) )
+                       return $decompressed;
+
+               if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) )
+                       return $decompressed;
+
+               if ( function_exists('gzdecode') ) {
+                       $decompressed = @gzdecode( $compressed );
+
+                       if ( false !== $decompressed )
+                               return $decompressed;
+               }
+
+               return $compressed;
+       }
+
+       /**
+        * Decompression of deflated string while staying compatible with the majority of servers.
+        *
+        * Certain Servers will return deflated data with headers which PHP's gziniflate()
+        * function cannot handle out of the box. The following function lifted from
+        * http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
+        * the various return forms used.
+        *
+        * @since 2.8.1
+        * @link http://au2.php.net/manual/en/function.gzinflate.php#77336
+        *
+        * @param string $gzData String to decompress.
+        * @return string|bool False on failure.
+        */
+       function compatible_gzinflate($gzData) {
+               if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
+                       $i = 10;
+                       $flg = ord( substr($gzData, 3, 1) );
+                       if ( $flg > 0 ) {
+                               if ( $flg & 4 ) {
+                                       list($xlen) = unpack('v', substr($gzData, $i, 2) );
+                                       $i = $i + 2 + $xlen;
+                               }
+                               if ( $flg & 8 )
+                                       $i = strpos($gzData, "\0", $i) + 1;
+                               if ( $flg & 16 )
+                                       $i = strpos($gzData, "\0", $i) + 1;
+                               if ( $flg & 2 )
+                                       $i = $i + 2;
+                       }
+                       return gzinflate( substr($gzData, $i, -8) );
+               } else {
+                       return false;
+               }
+       }
+
+       /**
+        * What encoding types to accept and their priority values.
+        *
+        * @since 2.8
+        *
+        * @return string Types of encoding to accept.
+        */
+       function accept_encoding() {
+               $type = array();
+               if ( function_exists( 'gzinflate' ) )
+                       $type[] = 'deflate;q=1.0';
+
+               if ( function_exists( 'gzuncompress' ) )
+                       $type[] = 'compress;q=0.5';
+
+               if ( function_exists( 'gzdecode' ) )
+                       $type[] = 'gzip;q=0.5';
+
+               return implode(', ', $type);
+       }
+
+       /**
+        * What enconding the content used when it was compressed to send in the headers.
+        *
+        * @since 2.8
+        *
+        * @return string Content-Encoding string to send in the header.
+        */
+       function content_encoding() {
+               return 'deflate';
+       }
+
+       /**
+        * Whether the content be decoded based on the headers.
+        *
+        * @since 2.8
+        *
+        * @param array|string $headers All of the available headers.
+        * @return bool
+        */
+       function should_decode($headers) {
+               if ( is_array( $headers ) ) {
+                       if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
+                               return true;
+               } else if ( is_string( $headers ) ) {
+                       return ( stripos($headers, 'content-encoding:') !== false );
+               }
+
+               return false;
+       }
+
+       /**
+        * Whether decompression and compression are supported by the PHP version.
+        *
+        * Each function is tested instead of checking for the zlib extension, to
+        * ensure that the functions all exist in the PHP version and aren't
+        * disabled.
+        *
+        * @since 2.8
+        *
+        * @return bool
+        */
+       function is_available() {
+               return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
+       }
+}
index 207c1774d74657ad94178ee4e870bd59e7f76137..7582609a66cc49b680dcef1b68ab53fda8fcd78e 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+if ( !class_exists( 'Services_JSON' ) ) :
 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 /**
  * Converts to and from JSON format.
@@ -858,3 +859,5 @@ if (class_exists('PEAR_Error')) {
        }
 
 }
+endif;
+?>
index 41794e02462f302b1076f56854e3da82d99adb19..a09b316768132fe8ea6f42d6cc49cdbac7955f7b 100644 (file)
@@ -37,23 +37,27 @@ class WP_oEmbed {
                // The WP_Embed class disables discovery for non-unfiltered_html users, so only providers in this array will be used for them.
                // Add to this list using the wp_oembed_add_provider() function (see it's PHPDoc for details).
                $this->providers = apply_filters( 'oembed_providers', array(
-                       '#http://(www\.)?youtube.com/watch.*#i' => array( 'http://www.youtube.com/oembed',            true  ),
-                       'http://blip.tv/file/*'                 => array( 'http://blip.tv/oembed/',                   false ),
-                       '#http://(www\.)?vimeo\.com/.*#i'       => array( 'http://www.vimeo.com/api/oembed.{format}', true  ),
-                       '#http://(www\.)?dailymotion\.com/.*#i' => array( 'http://www.dailymotion.com/api/oembed',    true  ),
-                       '#http://(www\.)?flickr\.com/.*#i'      => array( 'http://www.flickr.com/services/oembed/',   true  ),
-                       '#http://(www\.)?hulu\.com/watch/.*#i'  => array( 'http://www.hulu.com/api/oembed.{format}',  true  ),
-                       '#http://(www\.)?viddler\.com/.*#i'     => array( 'http://lab.viddler.com/services/oembed/',  true  ),
-                       'http://qik.com/*'                      => array( 'http://qik.com/api/oembed.{format}',       false ),
-                       'http://revision3.com/*'                => array( 'http://revision3.com/api/oembed/',         false ),
-                       'http://i*.photobucket.com/albums/*'    => array( 'http://photobucket.com/oembed',            false ),
-                       'http://gi*.photobucket.com/groups/*'   => array( 'http://photobucket.com/oembed',            false ),
-                       '#http://(www\.)?scribd\.com/.*#i'      => array( 'http://www.scribd.com/services/oembed',    true  ),
-                       'http://wordpress.tv/*'                 => array( 'http://wordpress.tv/oembed/',              false ),
+                       '#http://(www\.)?youtube.com/watch.*#i'         => array( 'http://www.youtube.com/oembed',            true  ),
+                       'http://youtu.be/*'                             => array( 'http://www.youtube.com/oembed',            false ),
+                       'http://blip.tv/file/*'                         => array( 'http://blip.tv/oembed/',                   false ),
+                       '#http://(www\.)?vimeo\.com/.*#i'               => array( 'http://www.vimeo.com/api/oembed.{format}', true  ),
+                       '#http://(www\.)?dailymotion\.com/.*#i'         => array( 'http://www.dailymotion.com/api/oembed',    true  ),
+                       '#http://(www\.)?flickr\.com/.*#i'              => array( 'http://www.flickr.com/services/oembed/',   true  ),
+                       '#http://(.+)?smugmug\.com/.*#i'                => array( 'http://api.smugmug.com/services/oembed/',  true  ),
+                       '#http://(www\.)?hulu\.com/watch/.*#i'          => array( 'http://www.hulu.com/api/oembed.{format}',  true  ),
+                       '#http://(www\.)?viddler\.com/.*#i'             => array( 'http://lab.viddler.com/services/oembed/',  true  ),
+                       'http://qik.com/*'                              => array( 'http://qik.com/api/oembed.{format}',       false ),
+                       'http://revision3.com/*'                        => array( 'http://revision3.com/api/oembed/',         false ),
+                       'http://i*.photobucket.com/albums/*'            => array( 'http://photobucket.com/oembed',            false ),
+                       'http://gi*.photobucket.com/groups/*'           => array( 'http://photobucket.com/oembed',            false ),
+                       '#http://(www\.)?scribd\.com/.*#i'              => array( 'http://www.scribd.com/services/oembed',    true  ),
+                       'http://wordpress.tv/*'                         => array( 'http://wordpress.tv/oembed/',              false ),
+                       '#http://(answers|surveys)\.polldaddy.com/.*#i' => array( 'http://polldaddy.com/oembed/',             true  ),
+                       '#http://(www\.)?funnyordie\.com/videos/.*#i'   => array( 'http://www.funnyordie.com/oembed',         true  ),
                ) );
 
-               // Fix Scribd embeds. They contain new lines in the middle of the HTML which breaks wpautop().
-               add_filter( 'oembed_dataparse', array(&$this, 'strip_scribd_newlines'), 10, 3 );
+               // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
+               add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 );
        }
 
        /**
@@ -161,36 +165,63 @@ class WP_oEmbed {
        function fetch( $provider, $url, $args = '' ) {
                $args = wp_parse_args( $args, wp_embed_defaults() );
 
-               $provider = add_query_arg( 'format', 'json', $provider ); // JSON is easier to deal with than XML
-
                $provider = add_query_arg( 'maxwidth', $args['width'], $provider );
                $provider = add_query_arg( 'maxheight', $args['height'], $provider );
                $provider = add_query_arg( 'url', urlencode($url), $provider );
 
-               if ( !$result = wp_remote_retrieve_body( wp_remote_get( $provider ) ) )
-                       return false;
-
-               $result = trim( $result );
-
-               // JSON?
-               // Example content: http://vimeo.com/api/oembed.json?url=http%3A%2F%2Fvimeo.com%2F240975
-               if ( $data = json_decode($result) ) {
-                       return $data;
+               foreach( array( 'json', 'xml' ) as $format ) {
+                       $result = $this->_fetch_with_format( $provider, $format );
+                       if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
+                               continue;
+                       return ( $result && ! is_wp_error( $result ) ) ? $result : false;
                }
+               return false;
+       }
 
-               // Must be XML. Only parse it if PHP5 is installed. (PHP4 isn't worth the trouble.)
-               // Example content: http://vimeo.com/api/oembed.xml?url=http%3A%2F%2Fvimeo.com%2F240975
-               elseif ( function_exists('simplexml_load_string') ) {
-                       $errors = libxml_use_internal_errors( 'true' );
+       /**
+        * Fetches result from an oEmbed provider for a specific format and complete provider URL
+        *
+        * @since 3.0.0
+        * @access private
+        * @param string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
+        * @param string $format Format to use
+        * @return bool|object False on failure, otherwise the result in the form of an object.
+        */
+       function _fetch_with_format( $provider_url_with_args, $format ) {
+               $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
+               $response = wp_remote_get( $provider_url_with_args );
+               if ( 501 == wp_remote_retrieve_response_code( $response ) )
+                       return new WP_Error( 'not-implemented' );
+               if ( ! $body = wp_remote_retrieve_body( $response ) )
+                       return false;
+               $parse_method = "_parse_$format";
+               return $this->$parse_method( $body );
+       }
 
-                       $data = simplexml_load_string( $result );
+       /**
+        * Parses a json response body.
+        *
+        * @since 3.0.0
+        * @access private
+        */
+       function _parse_json( $response_body ) {
+               return ( ( $data = json_decode( trim( $response_body ) ) ) && is_object( $data ) ) ? $data : false;
+       }
 
+       /**
+        * Parses an XML response body.
+        *
+        * @since 3.0.0
+        * @access private
+        */
+       function _parse_xml( $response_body ) {
+               if ( function_exists('simplexml_load_string') ) {
+                       $errors = libxml_use_internal_errors( 'true' );
+                       $data = simplexml_load_string( $response_body );
                        libxml_use_internal_errors( $errors );
-
-                       if ( is_object($data) )
+                       if ( is_object( $data ) )
                                return $data;
                }
-
                return false;
        }
 
@@ -211,7 +242,7 @@ class WP_oEmbed {
                                        return false;
 
                                $title = ( !empty($data->title) ) ? $data->title : '';
-                               $return = '<img src="' . esc_attr( clean_url( $data->url ) ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />';
+                               $return = '<img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />';
                                break;
 
                        case 'video':
@@ -220,7 +251,7 @@ class WP_oEmbed {
                                break;
 
                        case 'link':
-                               $return = ( !empty($data->title) ) ? '<a href="' . clean_url($url) . '">' . esc_html($data->title) . '</a>' : false;
+                               $return = ( !empty($data->title) ) ? '<a href="' . esc_url($url) . '">' . esc_html($data->title) . '</a>' : false;
                                break;
 
                        default;
@@ -232,15 +263,16 @@ class WP_oEmbed {
        }
 
        /**
-        * Strip new lines from the HTML if it's a Scribd embed.
+        * Strip any new lines from the HTML.
         *
+        * @access private
         * @param string $html Existing HTML.
         * @param object $data Data object from WP_oEmbed::data2html()
         * @param string $url The original URL passed to oEmbed.
         * @return string Possibly modified $html
         */
-       function strip_scribd_newlines( $html, $data, $url ) {
-               if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) )
+       function _strip_newlines( $html, $data, $url ) {
+               if ( false !== strpos( $html, "\n" ) )
                        $html = str_replace( array( "\r\n", "\n" ), '', $html );
 
                return $html;
index 93f4536cfbe5fa695fa3f4f4c23d119e776a3ce7..6d77a1cce9fd57870cfe3750ec227a404ddaeef9 100644 (file)
@@ -3,7 +3,7 @@
  * Portable PHP password hashing framework.
  * @package phpass
  * @since 2.5
- * @version 0.1
+ * @version 0.2 / genuine.
  * @link http://www.openwall.com/phpass/
  */
 
@@ -29,7 +29,7 @@
  * Portable PHP password hashing framework.
  *
  * @package phpass
- * @version 0.1 / genuine
+ * @version 0.2 / genuine.
  * @link http://www.openwall.com/phpass/
  * @since 2.5
  */
@@ -49,14 +49,14 @@ class PasswordHash {
 
                $this->portable_hashes = $portable_hashes;
 
-               $this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);
-
+               $this->random_state = microtime() . uniqid(rand(), TRUE); // removed getmypid() for compability reasons
        }
 
        function get_random_bytes($count)
        {
                $output = '';
-               if (($fh = @fopen('/dev/urandom', 'rb'))) {
+               if ( @is_readable('/dev/urandom') &&
+                   ($fh = @fopen('/dev/urandom', 'rb'))) {
                        $output = fread($fh, $count);
                        fclose($fh);
                }
index a404081bec9f52753fc815b4b454dbc0161a1415..98843f03d3d21cea4553bfb7cd441754e3898c73 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+if ( !class_exists( 'SimplePie' ) ) :
 /**
  * SimplePie
  *
@@ -4066,16 +4067,16 @@ class SimplePie_Item
                                        $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
                                        if (sizeof($temp) > 0)
                                        {
-                                               (int) $seconds = array_pop($temp);
+                                               $seconds = (int) array_pop($temp);
                                        }
                                        if (sizeof($temp) > 0)
                                        {
-                                               (int) $minutes = array_pop($temp);
+                                               $minutes = (int) array_pop($temp);
                                                $seconds += $minutes * 60;
                                        }
                                        if (sizeof($temp) > 0)
                                        {
-                                               (int) $hours = array_pop($temp);
+                                               $hours = (int) array_pop($temp);
                                                $seconds += $hours * 3600;
                                        }
                                        unset($temp);
@@ -14997,5 +14998,5 @@ class SimplePie_Sanitize
                }
        }
 }
-
+endif;
 ?>
index 250153c172e55ccfa7e0f2ea2ae77ea8bf93d05a..065e2e93166467db158f497b6024550006b8a918 100644 (file)
@@ -265,7 +265,7 @@ class SMTP
    * 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>.
+   * and the message body being separated by and additional <CRLF>.
    *
    * Implements rfc 821: DATA <CRLF>
    *
index b1b32d2faa9bbd82e8da6a7c161257de6864f02f..da3d824eee3ecb255b7e7820b7cdac8eadcc7606 100644 (file)
@@ -1,5 +1,11 @@
 <?php
-if ( !in_array('Snoopy', get_declared_classes() ) ) :
+
+/**
+ * Deprecated. Use WP_HTTP (http.php, class-http.php) instead.
+ */
+_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/http.php' );
+
+if ( !class_exists( 'Snoopy' ) ) :
 /*************************************************
 
 Snoopy - the PHP net client
index 54afdef0b2cb4e2ac5bba29eb9e56d2e1751e294..ea607de2cf45e534e125e0155b449a4cefe5c151 100644 (file)
@@ -232,8 +232,6 @@ class _WP_Dependency {
                @list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
                if ( !is_array($this->deps) )
                        $this->deps = array();
-               if ( !$this->ver )
-                       $this->ver = false;
        }
 
        function add_data( $name, $data ) {
index 9fa96e9d020d5d22e3cb9039cecd9eeab7feaa84..45d2e54cb1f2891f03f69e886ad3962106d8baa7 100644 (file)
@@ -90,9 +90,13 @@ class WP_Scripts extends WP_Dependencies {
                if ( false === $group && in_array($handle, $this->in_footer, true) )
                        $this->in_footer = array_diff( $this->in_footer, (array) $handle );
 
-               $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+               if ( null === $this->registered[$handle]->ver )
+                       $ver = '';
+               else
+                       $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+
                if ( isset($this->args[$handle]) )
-                       $ver .= '&amp;' . $this->args[$handle];
+                       $ver = $ver ? $ver . '&amp;' . $this->args[$handle] : $this->args[$handle];
 
                $src = $this->registered[$handle]->src;
 
@@ -114,7 +118,8 @@ class WP_Scripts extends WP_Dependencies {
                        $src = $this->base_url . $src;
                }
 
-               $src = add_query_arg('ver', $ver, $src);
+               if ( !empty($ver) )
+                       $src = add_query_arg('ver', $ver, $src);
                $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
 
                if ( $this->do_concat )
index 731ae39cf47a6fcd6ecc9edffb16fee0739a185a..ecc0bb9e22c50f322770f27316d3cd0af2cb4830 100644 (file)
@@ -35,9 +35,13 @@ class WP_Styles extends WP_Dependencies {
                if ( !parent::do_item($handle) )
                        return false;
 
-               $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+               if ( null === $this->registered[$handle]->ver )
+                       $ver = '';
+               else
+                       $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+
                if ( isset($this->args[$handle]) )
-                       $ver .= '&amp;' . $this->args[$handle];
+                       $ver = $ver ? $ver . '&amp;' . $this->args[$handle] : $this->args[$handle];
 
                if ( $this->do_concat ) {
                        if ( $this->in_default_dir($this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {
@@ -64,10 +68,12 @@ class WP_Styles extends WP_Dependencies {
 
                $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
                if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {
-                       if ( is_bool( $this->registered[$handle]->extra['rtl'] ) )
-                               $rtl_href = str_replace( '.css', '-rtl.css', $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" ));
-                       else
+                       if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) {
+                               $suffix = isset( $this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : '';
+                               $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" ));
+                       } else {
                                $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
+                       }
 
                        $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
                }
@@ -96,11 +102,12 @@ class WP_Styles extends WP_Dependencies {
        }
 
        function _css_href( $src, $ver, $handle ) {
-               if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
+               if ( !is_bool($src) && !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
                        $src = $this->base_url . $src;
                }
 
-               $src = add_query_arg('ver', $ver, $src);
+               if ( !empty($ver) )
+                       $src = add_query_arg('ver', $ver, $src);
                $src = apply_filters( 'style_loader_src', $src, $handle );
                return esc_url( $src );
        }
index d290bbaa5b68e5a1223bb34e7a453da127b09def..9a136a38c438a3159a77e1f5c9dd55d7c2c76f82 100644 (file)
@@ -26,7 +26,7 @@ class WP {
         * @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');
+       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', 'post_type');
 
        /**
         * Private query variables.
@@ -133,6 +133,7 @@ class WP {
 
                $this->query_vars = array();
                $taxonomy_query_vars = array();
+               $post_type_query_vars = array();
 
                if ( is_array($extra_query_vars) )
                        $this->extra_query_vars = & $extra_query_vars;
@@ -144,7 +145,7 @@ class WP {
                // Fetch the rewrite rules.
                $rewrite = $wp_rewrite->wp_rewrite_rules();
 
-               if (! empty($rewrite)) {
+               if ( ! empty($rewrite) ) {
                        // If we match a rewrite rule, this will be cleared.
                        $error = '404';
                        $this->did_permalink = true;
@@ -159,7 +160,7 @@ class WP {
                        $req_uri_array = explode('?', $req_uri);
                        $req_uri = $req_uri_array[0];
                        $self = $_SERVER['PHP_SELF'];
-                       $home_path = parse_url(get_option('home'));
+                       $home_path = parse_url(home_url());
                        if ( isset($home_path['path']) )
                                $home_path = $home_path['path'];
                        else
@@ -203,12 +204,11 @@ class WP {
 
                                // If the requesting file is the anchor of the match, prepend it
                                // to the path info.
-                               if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request)) {
+                               if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) )
                                        $request_match = $req_uri . '/' . $request;
-                               }
 
-                               if (preg_match("#^$match#", $request_match, $matches) ||
-                                       preg_match("#^$match#", urldecode($request_match), $matches)) {
+                               if ( preg_match("#^$match#", $request_match, $matches) ||
+                                       preg_match("#^$match#", urldecode($request_match), $matches) ) {
                                        // Got a match.
                                        $this->matched_rule = $match;
 
@@ -225,10 +225,10 @@ class WP {
 
                                        // If we're processing a 404 request, clear the error var
                                        // since we found something.
-                                       if (isset($_GET['error']))
+                                       if ( isset($_GET['error']) )
                                                unset($_GET['error']);
 
-                                       if (isset($error))
+                                       if ( isset($error) )
                                                unset($error);
 
                                        break;
@@ -236,14 +236,14 @@ class WP {
                        }
 
                        // If req_uri is empty or if it is a request for ourself, unset error.
-                       if (empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {
-                               if (isset($_GET['error']))
+                       if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
+                               if ( isset($_GET['error']) )
                                        unset($_GET['error']);
 
-                               if (isset($error))
+                               if ( isset($error) )
                                        unset($error);
 
-                               if (isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false)
+                               if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
                                        unset($perma_query_vars);
 
                                $this->did_permalink = false;
@@ -256,32 +256,46 @@ class WP {
                        if ( $t->query_var )
                                $taxonomy_query_vars[$t->query_var] = $taxonomy;
 
-               for ($i=0; $i<count($this->public_query_vars); $i += 1) {
+               foreach ( $GLOBALS['wp_post_types'] as $post_type => $t )
+                       if ( $t->query_var )
+                               $post_type_query_vars[$t->query_var] = $post_type;
+
+               for ( $i = 0; $i < count($this->public_query_vars); $i += 1 ) {
                        $wpvar = $this->public_query_vars[$i];
-                       if (isset($this->extra_query_vars[$wpvar]))
+                       if ( isset($this->extra_query_vars[$wpvar]) )
                                $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
-                       elseif (isset($GLOBALS[$wpvar]))
+                       elseif ( isset($GLOBALS[$wpvar]) )
                                $this->query_vars[$wpvar] = $GLOBALS[$wpvar];
-                       elseif (!empty($_POST[$wpvar]))
+                       elseif ( !empty($_POST[$wpvar]) )
                                $this->query_vars[$wpvar] = $_POST[$wpvar];
-                       elseif (!empty($_GET[$wpvar]))
+                       elseif ( !empty($_GET[$wpvar]) )
                                $this->query_vars[$wpvar] = $_GET[$wpvar];
-                       elseif (!empty($perma_query_vars[$wpvar]))
+                       elseif ( !empty($perma_query_vars[$wpvar]) )
                                $this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
 
                        if ( !empty( $this->query_vars[$wpvar] ) ) {
                                $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
-                               if ( in_array( $wpvar, $taxonomy_query_vars ) ) {
+                               if ( isset( $taxonomy_query_vars[$wpvar] ) ) {
                                        $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
                                        $this->query_vars['term'] = $this->query_vars[$wpvar];
+                               } elseif ( isset($post_type_query_vars[$wpvar] ) ) {
+                                       $this->query_vars['post_type'] = $post_type_query_vars[$wpvar];
+                                       $this->query_vars['name'] = $this->query_vars[$wpvar];
                                }
                        }
                }
 
+               // Limit publicly queried post_types to those that are publicly_queryable
+               if ( isset( $this->query_vars['post_type']) ) {
+                       $queryable_post_types =  get_post_types( array('publicly_queryable' => true) );
+                       if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
+                               unset( $this->query_vars['post_type'] );
+               }
+
                foreach ( (array) $this->private_query_vars as $var) {
-                       if (isset($this->extra_query_vars[$var]))
+                       if ( isset($this->extra_query_vars[$var]) )
                                $this->query_vars[$var] = $this->extra_query_vars[$var];
-                       elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var])
+                       elseif ( isset($GLOBALS[$var]) && '' != $GLOBALS[$var] )
                                $this->query_vars[$var] = $GLOBALS[$var];
                }
 
@@ -395,7 +409,7 @@ class WP {
        }
 
        /**
-        * Setup the WordPress Globals.
+        * Set up 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
@@ -426,7 +440,7 @@ class WP {
        }
 
        /**
-        * Setup the current user.
+        * Set up the current user.
         *
         * @since 2.0.0
         */
@@ -435,7 +449,7 @@ class WP {
        }
 
        /**
-        * Setup the Loop based on the query variables.
+        * Set up the Loop based on the query variables.
         *
         * @uses WP::$query_vars
         * @since 2.0.0
@@ -447,21 +461,22 @@ class WP {
        }
 
        /**
-        * Set the Headers for 404, if permalink is not found.
+        * Set the Headers for 404, if nothing is found for requested URL.
+        *
+        * Issue a 404 if a request doesn't match any posts and doesn't match
+        * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
+        * issued, and if the request was not a search or the homepage.
         *
-        * 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.
+        * Otherwise, issue a 200.
         *
         * @since 2.0.0
         */
        function handle_404() {
                global $wp_query;
 
-               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_robots() && !is_search() && !is_home() ) {
                        // 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_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) {
                                if ( !is_404() )
                                        status_header( 200 );
                                return;
@@ -907,7 +922,7 @@ class Walker {
 
                /*
                 * need to display in hierarchical order
-                * seperate elements into two buckets: top level and children elements
+                * separate 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.
                 */
@@ -1021,7 +1036,7 @@ class Walker {
                }
 
                /*
-                * seperate elements into two buckets: top level and children elements
+                * separate 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.
                 */
@@ -1140,7 +1155,7 @@ class Walker_Page extends Walker {
         */
        function start_lvl(&$output, $depth) {
                $indent = str_repeat("\t", $depth);
-               $output .= "\n$indent<ul>\n";
+               $output .= "\n$indent<ul class='children'>\n";
        }
 
        /**
@@ -1187,7 +1202,7 @@ class Walker_Page extends Walker {
 
                $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
 
-               $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . esc_attr(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
+               $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
 
                if ( !empty($show_date) ) {
                        if ( 'modified' == $show_date )
@@ -1327,7 +1342,7 @@ class Walker_Category extends Walker {
 
                $cat_name = esc_attr( $category->name);
                $cat_name = apply_filters( 'list_cats', $cat_name, $category );
-               $link = '<a href="' . get_category_link( $category->term_id ) . '" ';
+               $link = '<a href="' . get_term_link( $category, $category->taxonomy ) . '" ';
                if ( $use_desc_for_title == 0 || empty($category->description) )
                        $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
                else
@@ -1341,7 +1356,7 @@ class Walker_Category extends Walker {
                        if ( empty($feed_image) )
                                $link .= '(';
 
-                       $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
+                       $link .= '<a href="' . get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) . '"';
 
                        if ( empty($feed) )
                                $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
@@ -1677,7 +1692,7 @@ class WP_MatchesMapRegex {
         */
        function callback($matches) {
                $index = intval(substr($matches[0], 9, -1));
-               return ( isset( $this->_matches[$index] ) ? $this->_matches[$index] : '' );
+               return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
        }
 
 }
index 321080afbf0844da9eb995f302dbc472f988c071..4bc9edb8d5f77c64371a621aead4a2324f128dcc 100644 (file)
  * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
  *
+ * @param int $comment_ID The ID of the comment for which to retrieve the author. Optional.
  * @return string The comment author
  */
-function get_comment_author() {
-       global $comment;
+function get_comment_author( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        if ( empty($comment->comment_author) ) {
                if (!empty($comment->user_id)){
                        $user=get_userdata($comment->user_id);
@@ -39,9 +40,11 @@ function get_comment_author() {
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_author' on comment author before displaying
+ *
+ * @param int $comment_ID The ID of the comment for which to print the author. Optional.
  */
-function comment_author() {
-       $author = apply_filters('comment_author', get_comment_author() );
+function comment_author( $comment_ID = 0 ) {
+       $author = apply_filters('comment_author', get_comment_author( $comment_ID ) );
        echo $author;
 }
 
@@ -52,10 +55,11 @@ function comment_author() {
  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
  * @uses $comment
  *
+ * @param int $comment_ID The ID of the comment for which to get the author's email.  Optional.
  * @return string The current comment author's email
  */
-function get_comment_author_email() {
-       global $comment;
+function get_comment_author_email( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        return apply_filters('get_comment_author_email', $comment->comment_author_email);
 }
 
@@ -70,9 +74,11 @@ function get_comment_author_email() {
  *
  * @since 0.71
  * @uses apply_filters() Calls 'author_email' hook on the author email
+ *
+ * @param int $comment_ID The ID of the comment for which to print the author's email. Optional.
  */
-function comment_author_email() {
-       echo apply_filters('author_email', get_comment_author_email() );
+function comment_author_email( $comment_ID = 0 ) {
+       echo apply_filters('author_email', get_comment_author_email( $comment_ID ) );
 }
 
 /**
@@ -135,12 +141,13 @@ function get_comment_author_email_link($linktext='', $before='', $after='') {
  * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
  *
+ * @param int $comment_ID The ID of the comment for which to get the author's link.  Optional.
  * @return string Comment Author name or HTML link for author's URL
  */
-function get_comment_author_link() {
+function get_comment_author_link( $comment_ID = 0 ) {
        /** @todo Only call these functions when they are needed. Include in if... else blocks */
-       $url    = get_comment_author_url();
-       $author = get_comment_author();
+       $url    = get_comment_author_url( $comment_ID );
+       $author = get_comment_author( $comment_ID );
 
        if ( empty( $url ) || 'http://' == $url )
                $return = $author;
@@ -153,10 +160,12 @@ function get_comment_author_link() {
  * Display the html link to the url of the author of the current comment.
  *
  * @since 0.71
- * @see get_comment_author_link() Echos result
+ * @see get_comment_author_link() Echoes result
+ *
+ * @param int The ID of the comment for which to print the author's link. Optional.
  */
-function comment_author_link() {
-       echo get_comment_author_link();
+function comment_author_link( $comment_ID = 0 ) {
+       echo get_comment_author_link( $comment_ID );
 }
 
 /**
@@ -166,10 +175,11 @@ function comment_author_link() {
  * @uses $comment
  * @uses apply_filters()
  *
- * @return unknown
+ * @param int $comment_ID The ID of the comment for which to get the author's IP address. Optional.
+ * @return string The comment author's IP address.
  */
-function get_comment_author_IP() {
-       global $comment;
+function get_comment_author_IP( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        return apply_filters('get_comment_author_IP', $comment->comment_author_IP);
 }
 
@@ -177,10 +187,12 @@ function get_comment_author_IP() {
  * Display the IP address of the author of the current comment.
  *
  * @since 0.71
- * @see get_comment_author_IP() Echos Result
+ * @see get_comment_author_IP() Echoes Result
+ *
+ * @param int $comment_ID The ID of the comment for which to print the author's IP address.  Optional.
  */
-function comment_author_IP() {
-       echo get_comment_author_IP();
+function comment_author_IP( $comment_ID = 0 ) {
+       echo get_comment_author_IP( $comment_ID );
 }
 
 /**
@@ -189,10 +201,11 @@ function comment_author_IP() {
  * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
  *
+ * @param int $comment_ID The ID of the comment for which to get the author's URL.  Optional.
  * @return string
  */
-function get_comment_author_url() {
-       global $comment;
+function get_comment_author_url( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
        $url = esc_url( $url, array('http', 'https') );
        return apply_filters('get_comment_author_url', $url);
@@ -204,9 +217,11 @@ function get_comment_author_url() {
  * @since 0.71
  * @uses apply_filters()
  * @uses get_comment_author_url() Retrieves the comment author's URL
+ *
+ * @param int $comment_ID The ID of the comment for which to print the author's URL. Optional.
  */
-function comment_author_url() {
-       echo apply_filters('comment_url', get_comment_author_url());
+function comment_author_url( $comment_ID = 0 ) {
+       echo apply_filters('comment_url', get_comment_author_url( $comment_ID ));
 }
 
 /**
@@ -242,7 +257,7 @@ function get_comment_author_url_link( $linktext = '', $before = '', $after = ''
  * Displays the HTML link of the url of the author of the current comment.
  *
  * @since 0.71
- * @see get_comment_author_url_link() Echos result
+ * @see get_comment_author_url_link() Echoes result
  *
  * @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.
@@ -351,10 +366,11 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
  * @uses $comment
  *
  * @param string $d The format of the date (defaults to user's config)
+ * @param int $comment_ID The ID of the comment for which to get the date. Optional.
  * @return string The comment's date
  */
-function get_comment_date( $d = '' ) {
-       global $comment;
+function get_comment_date( $d = '', $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        if ( '' == $d )
                $date = mysql2date(get_option('date_format'), $comment->comment_date);
        else
@@ -368,9 +384,10 @@ function get_comment_date( $d = '' ) {
  * @since 0.71
  *
  * @param string $d The format of the date (defaults to user's config)
+ * @param int $comment_ID The ID of the comment for which to print the date.  Optional.
  */
-function comment_date( $d = '' ) {
-       echo get_comment_date( $d );
+function comment_date( $d = '', $comment_ID = 0 ) {
+       echo get_comment_date( $d, $comment_ID );
 }
 
 /**
@@ -384,10 +401,11 @@ function comment_date( $d = '' ) {
  * @uses $comment
  * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment
  *
+ * @param int $comment_ID The ID of the comment for which to get the excerpt. Optional.
  * @return string The maybe truncated comment with 20 words or less
  */
-function get_comment_excerpt() {
-       global $comment;
+function get_comment_excerpt( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        $comment_text = strip_tags($comment->comment_content);
        $blah = explode(' ', $comment_text);
        if (count($blah) > 20) {
@@ -410,9 +428,11 @@ function get_comment_excerpt() {
  *
  * @since 1.2.0
  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
+ *
+ * @param int $comment_ID The ID of the comment for which to print the excerpt. Optional.
  */
-function comment_excerpt() {
-       echo apply_filters('comment_excerpt', get_comment_excerpt() );
+function comment_excerpt( $comment_ID = 0 ) {
+       echo apply_filters('comment_excerpt', get_comment_excerpt($comment_ID) );
 }
 
 /**
@@ -433,7 +453,7 @@ function get_comment_ID() {
  * Displays the comment id of the current comment.
  *
  * @since 0.71
- * @see get_comment_ID() Echos Result
+ * @see get_comment_ID() Echoes Result
  */
 function comment_ID() {
        echo get_comment_ID();
@@ -492,10 +512,11 @@ function get_comment_link( $comment = null, $args = array() ) {
  *
  * @since 1.5.0
  *
+ * @param int $post_id Optional post id
  * @return string The link to the comments
  */
-function get_comments_link() {
-       return get_permalink() . '#comments';
+function get_comments_link($post_id = 0) {
+       return get_permalink($post_id) . '#comments';
 }
 
 /**
@@ -504,9 +525,13 @@ function get_comments_link() {
  * @since 0.71
  *
  * @param string $deprecated Not Used
- * @param bool $deprecated Not Used
+ * @param bool $deprecated_2 Not Used
  */
-function comments_link( $deprecated = '', $deprecated = '' ) {
+function comments_link( $deprecated = '', $deprecated_2 = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '0.72' );
+       if ( !empty( $deprecated_2 ) )
+               _deprecated_argument( __FUNCTION__, '1.3' );
        echo get_comments_link();
 }
 
@@ -549,6 +574,10 @@ function get_comments_number( $post_id = 0 ) {
  */
 function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
        global $id;
+
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '1.3' );
+
        $number = get_comments_number($id);
 
        if ( $number > 1 )
@@ -567,10 +596,11 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
  * @since 1.5.0
  * @uses $comment
  *
+ * @param int $comment_ID The ID of the comment for which to get the text. Optional.
  * @return string The comment content
  */
-function get_comment_text() {
-       global $comment;
+function get_comment_text( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        return apply_filters('get_comment_text', $comment->comment_content);
 }
 
@@ -580,8 +610,10 @@ function get_comment_text() {
  * @since 0.71
  * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display
  * @uses get_comment_text() Gets the comment content
+ *
+ * @param int $comment_ID The ID of the comment for which to print the text. Optional.
  */
-function comment_text() {
+function comment_text( $comment_ID = 0 ) {
        echo apply_filters('comment_text', get_comment_text() );
 }
 
@@ -625,11 +657,11 @@ function comment_time( $d = '' ) {
  * @uses $comment
  * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type
  *
+ * @param int $comment_ID The ID of the comment for which to get the type. Optional.
  * @return string The comment type
  */
-function get_comment_type() {
-       global $comment;
-
+function get_comment_type( $comment_ID = 0 ) {
+       $comment = get_comment( $comment_ID );
        if ( '' == $comment->comment_type )
                $comment->comment_type = 'comment';
 
@@ -691,36 +723,16 @@ function get_trackback_url() {
  * @since 0.71
  * @uses get_trackback_url() Gets the trackback url for the current post
  *
- * @param bool $deprecated Remove backwards compat in 2.5
+ * @param bool $deprecated_echo Remove backwards compat in 2.5
  * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() for the result instead.
  */
-function trackback_url($deprecated = true) {
-       if ($deprecated) echo get_trackback_url();
-       else return get_trackback_url();
-}
-
-/**
- * Generates and displays the RDF for the trackback information of current post.
- *
- * @since 0.71
- *
- * @param int $deprecated Not used (Was $timezone = 0)
- */
-function trackback_rdf($deprecated = '') {
-       if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) {
-               echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-                               xmlns:dc="http://purl.org/dc/elements/1.1/"
-                               xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
-                       <rdf:Description rdf:about="';
-               the_permalink();
-               echo '"'."\n";
-               echo '    dc:identifier="';
-               the_permalink();
-               echo '"'."\n";
-               echo '    dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'"'."\n";
-               echo '    trackback:ping="'.get_trackback_url().'"'." />\n";
-               echo '</rdf:RDF>';
-       }
+function trackback_url( $deprecated_echo = true ) {
+       if ( $deprecated_echo !== true )
+               _deprecated_argument( __FUNCTION__, '2.5', __('Use <code>get_trackback_url()</code> instead if you do not want the value echoed.') );
+       if ( $deprecated_echo )
+               echo get_trackback_url();
+       else
+               return get_trackback_url();
 }
 
 /**
@@ -877,8 +889,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false
                require( $include );
        elseif ( file_exists( TEMPLATEPATH . $file ) )
                require( TEMPLATEPATH .  $file );
-       else
-               require( get_theme_root() . '/default/comments.php');
+       else // Backward compat code will be removed in a future release
+               require( WPINC . '/theme-compat/comments.php');
 }
 
 /**
@@ -892,7 +904,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false
  *
  * @since 0.71
  * @global string $wpcommentspopupfile The URL to use for the popup window
- * @global int $wpcommentsjavascript Whether to use JavaScript or not. Set when function is called
+ * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called
  *
  * @param int $width Optional. The width of the popup window
  * @param int $height Optional. The height of the popup window
@@ -932,7 +944,7 @@ function comments_popup_script($width=400, $height=400, $file='') {
  * @return null Returns null on single posts and pages.
  */
 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
-       global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
+       global $id, $wpcommentspopupfile, $wpcommentsjavascript;
 
     if ( false === $zero ) $zero = __( 'No Comments' );
     if ( false === $one ) $one = __( '1 Comment' );
@@ -947,14 +959,14 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
        }
 
        if ( post_password_required() ) {
-               echo __('Enter your password to view comments');
+               echo __('Enter your password to view comments.');
                return;
        }
 
        echo '<a href="';
        if ( $wpcommentsjavascript ) {
                if ( empty( $wpcommentspopupfile ) )
-                       $home = get_option('home');
+                       $home = home_url();
                else
                        $home = get_option('siteurl');
                echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
@@ -970,12 +982,12 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
        if ( !empty( $css_class ) ) {
                echo ' class="'.$css_class.'" ';
        }
-       $title = the_title_attribute( 'echo=0' );
+       $title = the_title_attribute( array('echo' => 0 ) );
 
        echo apply_filters( 'comments_popup_link_attributes', '' );
 
        echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
-       comments_number( $zero, $one, $more, $number );
+       comments_number( $zero, $one, $more );
        echo '</a>';
 }
 
@@ -1010,6 +1022,8 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null)
        extract($args, EXTR_SKIP);
 
        $comment = get_comment($comment);
+       if ( empty($post) )
+               $post = $comment->comment_post_ID;
        $post = get_post($post);
 
        if ( !comments_open($post->ID) )
@@ -1117,16 +1131,29 @@ function cancel_comment_reply_link($text = '') {
 }
 
 /**
- * Output hidden input HTML for replying to comments.
+ * Retrieve hidden input HTML for replying to comments.
  *
- * @since 2.7.0
+ * @since 3.0.0
+ *
+ * @return string Hidden input HTML for replying to comments
  */
-function comment_id_fields() {
+function get_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";
+       $result  = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
+       $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
+       return apply_filters('comment_id_fields', $result, $id, $replytoid);
+}
+
+/**
+ * Output hidden input HTML for replying to comments.
+ *
+ * @since 2.7.0
+ * @see get_comment_id_fields() Echoes result
+ */
+function comment_id_fields() {
+       echo get_comment_id_fields();
 }
 
 /**
@@ -1225,6 +1252,45 @@ class Walker_Comment extends Walker {
                }
        }
 
+       /**
+        * This function is designed to enhance Walker::display_element() to
+        * display children of higher nesting levels than selected inline on
+        * the highest depth level displayed. This prevents them being orphaned
+        * at the end of the comment list.
+        *
+        * Example: max_depth = 2, with 5 levels of nested content.
+        * 1
+        *  1.1
+        *    1.1.1
+        *    1.1.1.1
+        *    1.1.1.1.1
+        *    1.1.2
+        *    1.1.2.1
+        * 2
+        *  2.2
+        *
+        */
+       function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
+
+               if ( !$element )
+                       return;
+
+               $id_field = $this->db_fields['id'];
+               $id = $element->$id_field;
+
+               parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
+
+               // If we're at the max depth, and the current element still has children, loop over those and display them at this level
+               // This is to prevent them being orphaned to the end of the list.
+               if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) {
+                       foreach ( $children_elements[ $id ] as $child )
+                               $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
+
+                       unset( $children_elements[ $id ] );
+               }
+
+       }
+
        /**
         * @see Walker::start_el()
         * @since unknown
@@ -1267,7 +1333,12 @@ class Walker_Comment extends Walker {
                <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>
+               <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
+                       <?php
+                               /* translators: 1: date, 2: time */
+                               printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );
+                       ?>
+               </div>
 
                <?php comment_text() ?>
 
@@ -1372,7 +1443,7 @@ function wp_list_comments($args = array(), $comments = null ) {
                if ( empty($overridden_cpage) ) {
                        $r['page'] = get_query_var('cpage');
                } else {
-                       $threaded = ( -1 == $r['max_depth'] ) ? false : true;
+                       $threaded = ( -1 != $r['max_depth'] );
                        $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
                        set_query_var( 'cpage', $r['page'] );
                }
@@ -1383,7 +1454,7 @@ function wp_list_comments($args = array(), $comments = null ) {
                $r['page'] = 1;
 
        if ( null === $r['reverse_top_level'] )
-               $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
+               $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') );
 
        extract( $r, EXTR_SKIP );
 
@@ -1396,4 +1467,98 @@ function wp_list_comments($args = array(), $comments = null ) {
        $in_comment_loop = false;
 }
 
+/**
+ * Outputs a complete commenting form for use within a template.
+ * Most strings and form fields may be controlled through the $args array passed
+ * into the function, while you may also choose to use the comment_form_default_fields
+ * filter to modify the array of default fields if you'd just like to add a new
+ * one or remove a single field. All fields are also individually passed through
+ * a filter of the form comment_form_field_$name where $name is the key used
+ * in the array of fields.
+ *
+ * @since 3.0.0
+ * @param array $args Options for strings, fields etc in the form
+ * @param mixed $post_id Post ID to generate the form for, uses the current post if null
+ * @return void
+ */
+function comment_form( $args = array(), $post_id = null ) {
+       global $user_identity, $id;
+
+       if ( null === $post_id )
+               $post_id = $id;
+       else
+               $id = $post_id;
+
+       $commenter = wp_get_current_commenter();
+
+       $req = get_option( 'require_name_email' );
+       $aria_req = ( $req ? " aria-required='true'" : '' );
+       $fields =  array(
+               'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
+                           '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
+               'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
+                           '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
+               'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
+                           '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
+       );
+
+       $required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
+       $defaults = array(
+               'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
+               'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
+               'must_log_in'          => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+               'logged_in_as'         => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+               'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
+               'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
+               'id_form'              => 'commentform',
+               'id_submit'            => 'submit',
+               'title_reply'          => __( 'Leave a Reply' ),
+               'title_reply_to'       => __( 'Leave a Reply to %s' ),
+               'cancel_reply_link'    => __( 'Cancel reply' ),
+               'label_submit'         => __( 'Post Comment' ),
+       );
+
+       $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
+
+       ?>
+               <?php if ( comments_open() ) : ?>
+                       <?php do_action( 'comment_form_before' ); ?>
+                       <div id="respond">
+                               <h3 id="reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>
+                               <?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
+                                       <?php echo $args['must_log_in']; ?>
+                                       <?php do_action( 'comment_form_must_log_in_after' ); ?>
+                               <?php else : ?>
+                                       <form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>">
+                                               <?php do_action( 'comment_form_top' ); ?>
+                                               <?php if ( is_user_logged_in() ) : ?>
+                                                       <?php echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); ?>
+                                                       <?php do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); ?>
+                                               <?php else : ?>
+                                                       <?php echo $args['comment_notes_before']; ?>
+                                                       <?php
+                                                       do_action( 'comment_form_before_fields' );
+                                                       foreach ( (array) $args['fields'] as $name => $field ) {
+                                                               echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
+                                                       }
+                                                       do_action( 'comment_form_after_fields' );
+                                                       ?>
+                                               <?php endif; ?>
+                                               <?php echo apply_filters( 'comment_form_field_comment', $args['comment_field'] ); ?>
+                                               <?php echo $args['comment_notes_after']; ?>
+                                               <p class="form-submit">
+                                                       <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
+                                                       <?php comment_id_fields(); ?>
+                                               </p>
+                                               <?php do_action( 'comment_form', $post_id ); ?>
+                                       </form>
+                               <?php endif; ?>
+                       </div><!-- #respond -->
+                       <?php do_action( 'comment_form_after' ); ?>
+               <?php else : ?>
+                       <?php do_action( 'comment_form_comments_closed' ); ?>
+               <?php endif; ?>
+       <?php
+}
+
 ?>
index 2024c13ef0970e1f16850dbd3de456d47d987fc6..4956fa77b621787ca649f3d86304f00ef14f1064 100644 (file)
@@ -45,8 +45,13 @@ 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 ( 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
+       // Check # of external links
+       if ( $max_links = get_option( 'comment_max_links' ) ) {
+               $num_links = preg_match_all( '/<a [^>]*href/i', apply_filters( 'comment_text', $comment ), $out );
+               $num_links = apply_filters( 'comment_max_links_url', $num_links, $url ); // provide for counting of $url as a link
+               if ( $num_links >= $max_links )
+                       return false;
+       }
 
        $mod_keys = trim(get_option('moderation_keys'));
        if ( !empty($mod_keys) ) {
@@ -78,7 +83,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
                if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll
                        $uri = parse_url($url);
                        $domain = $uri['host'];
-                       $uri = parse_url( get_option('home') );
+                       $uri = parse_url( home_url() );
                        $home_domain = $uri['host'];
                        if ( $wpdb->get_var($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_url LIKE (%s) LIMIT 1", '%'.$domain.'%')) || $domain == $home_domain )
                                return true;
@@ -185,7 +190,21 @@ function &get_comment(&$comment, $output = OBJECT) {
 function get_comments( $args = '' ) {
        global $wpdb;
 
-       $defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
+       $defaults = array(
+               'author_email' => '',
+               'ID' => '',
+               'karma' => '',
+               'number' => '',
+               'offset' => '',
+               'orderby' => '',
+               'order' => 'DESC',
+               'parent' => '',
+               'post_ID' => '',
+               'post_id' => 0,
+               'status' => '',
+               'type' => '',
+               'user_id' => '',
+       );
 
        $args = wp_parse_args( $args, $defaults );
        extract( $args, EXTR_SKIP );
@@ -218,7 +237,32 @@ function get_comments( $args = '' ) {
 
        $order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
 
-       $orderby = 'comment_date_gmt';  // Hard code for now
+       if ( ! empty( $orderby ) ) {
+               $ordersby = is_array($orderby) ? $orderby : preg_split('/[,\s]/', $orderby);
+               $ordersby = array_intersect(
+                       $ordersby,
+                       array(
+                               'comment_agent',
+                               'comment_approved',
+                               'comment_author',
+                               'comment_author_email',
+                               'comment_author_IP',
+                               'comment_author_url',
+                               'comment_content',
+                               'comment_date',
+                               'comment_date_gmt',
+                               'comment_ID',
+                               'comment_karma',
+                               'comment_parent',
+                               'comment_post_ID',
+                               'comment_type',
+                               'user_id',
+                       )
+               );
+               $orderby = empty( $ordersby ) ? 'comment_date_gmt' : implode(', ', $ordersby);
+       } else {
+               $orderby = 'comment_date_gmt';
+       }
 
        $number = absint($number);
        $offset = absint($offset);
@@ -233,10 +277,22 @@ function get_comments( $args = '' ) {
                $number = '';
        }
 
+       $post_where = '';
+
        if ( ! empty($post_id) )
-               $post_where = $wpdb->prepare( 'comment_post_ID = %d AND', $post_id );
-       else
-               $post_where = '';
+               $post_where .= $wpdb->prepare( 'comment_post_ID = %d AND ', $post_id );
+       if ( '' !== $author_email )
+               $post_where .= $wpdb->prepare( 'comment_author_email = %s AND ', $author_email );
+       if ( '' !== $karma )
+               $post_where .= $wpdb->prepare( 'comment_karma = %d AND ', $karma );
+       if ( 'comment' == $type )
+               $post_where .= "comment_type = '' AND ";
+       elseif ( ! empty( $type ) )
+               $post_where .= $wpdb->prepare( 'comment_type = %s AND ', $type );
+       if ( '' !== $parent )
+               $post_where .= $wpdb->prepare( 'comment_parent = %d AND ', $parent );
+       if ( '' !== $user_id )
+               $post_where .= $wpdb->prepare( 'user_id = %d AND ', $user_id );
 
        $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
        wp_cache_add( $cache_key, $comments, 'comment' );
@@ -371,7 +427,7 @@ function get_comment_count( $post_id = 0 ) {
 /**
  * Add meta data field to a comment.
  *
- * @since 2.9
+ * @since 2.9.0
  * @uses add_metadata
  * @link http://codex.wordpress.org/Function_Reference/add_comment_meta
  *
@@ -392,7 +448,7 @@ function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
  * value, will keep from removing duplicate metadata with the same key. It also
  * allows removing all metadata matching key, if needed.
  *
- * @since 2.9
+ * @since 2.9.0
  * @uses delete_metadata
  * @link http://codex.wordpress.org/Function_Reference/delete_comment_meta
  *
@@ -408,7 +464,7 @@ function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
 /**
  * Retrieve comment meta field for a comment.
  *
- * @since 2.9
+ * @since 2.9.0
  * @uses get_metadata
  * @link http://codex.wordpress.org/Function_Reference/get_comment_meta
  *
@@ -430,7 +486,7 @@ function get_comment_meta($comment_id, $key, $single = false) {
  *
  * If the meta field for the comment does not exist, it will be added.
  *
- * @since 2.9
+ * @since 2.9.0
  * @uses update_metadata
  * @link http://codex.wordpress.org/Function_Reference/update_comment_meta
  *
@@ -475,11 +531,12 @@ function sanitize_comment_cookies() {
 }
 
 /**
- * Validates whether this comment is allowed to be made or not.
+ * Validates whether this comment is allowed to be made.
  *
  * @since 2.0.0
  * @uses $wpdb
  * @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment
+ * @uses apply_filters() Calls 'comment_duplicate_trigger' hook on commentdata.
  * @uses do_action() Calls 'check_comment_flood' hook on $comment_author_IP, $comment_author_email, and $comment_date_gmt
  *
  * @param array $commentdata Contains information on the comment
@@ -496,6 +553,7 @@ function wp_allow_comment($commentdata) {
                $dupe .= "OR comment_author_email = '$comment_author_email' ";
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
        if ( $wpdb->get_var($dupe) ) {
+               do_action( 'comment_duplicate_trigger', $commentdata );
                if ( defined('DOING_AJAX') )
                        die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
 
@@ -777,7 +835,7 @@ function wp_count_comments( $post_id = 0 ) {
        $total = 0;
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
        $known_types = array_keys( $approved );
-       foreach( (array) $count as $row_num => $row ) {
+       foreach ( (array) $count as $row ) {
                // Don't count post-trashed toward totals
                if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
                        $total += $row['num_comments'];
@@ -798,7 +856,10 @@ function wp_count_comments( $post_id = 0 ) {
 }
 
 /**
- * Removes comment ID and maybe updates post comment count.
+ * Trashes or deletes a comment.
+ *
+ * The comment is moved to trash instead of permanently deleted unless trash is
+ * disabled, item is already in the trash, or $force_delete is true.
  *
  * The post comment count will be updated if the comment was approved and has a
  * post ID available.
@@ -811,14 +872,15 @@ function wp_count_comments( $post_id = 0 ) {
  * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
  *
  * @param int $comment_id Comment ID
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
  * @return bool False if delete comment query failure, true on success.
  */
-function wp_delete_comment($comment_id) {
+function wp_delete_comment($comment_id, $force_delete = false) {
        global $wpdb;
        if (!$comment = get_comment($comment_id))
                return false;
 
-       if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
+       if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status($comment_id), array( 'trash', 'spam' ) ) )
                return wp_trash_comment($comment_id);
 
        do_action('delete_comment', $comment_id);
@@ -857,16 +919,19 @@ function wp_delete_comment($comment_id) {
 /**
  * Moves a comment to the Trash
  *
+ * If trash is disabled, comment is permanently deleted.
+ *
  * @since 2.9.0
  * @uses do_action() on 'trash_comment' before trashing
  * @uses do_action() on 'trashed_comment' after trashing
+ * @uses wp_delete_comment() if trash is disabled
  *
  * @param int $comment_id Comment ID.
  * @return mixed False on failure
  */
 function wp_trash_comment($comment_id) {
-       if ( EMPTY_TRASH_DAYS == 0 )
-               return wp_delete_comment($comment_id);
+       if ( !EMPTY_TRASH_DAYS )
+               return wp_delete_comment($comment_id, true);
 
        if ( !$comment = get_comment($comment_id) )
                return false;
@@ -1137,7 +1202,7 @@ function wp_filter_comment($commentdata) {
                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
        elseif ( isset($commentdata['user_id']) )
                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);
-       $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
+       $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
        $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
        $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
        $commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
@@ -1216,8 +1281,8 @@ function wp_new_comment( $commentdata ) {
 
                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
 
-               if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] )
-                       wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
+               if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
+                       wp_notify_postauthor($comment_ID, empty( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
        }
 
        return $comment_ID;
@@ -1331,9 +1396,7 @@ function wp_update_comment($commentarr) {
                $comment_approved = 1;
 
        $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt');
-       $wpdb->update($wpdb->comments, $data, compact('comment_ID'));
-
-       $rval = $wpdb->rows_affected;
+       $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
 
        clean_comment_cache($comment_ID);
        wp_update_comment_count($comment_post_ID);
@@ -1460,7 +1523,9 @@ function wp_update_comment_count_now($post_id) {
  * @param int $deprecated Not Used.
  * @return bool|string False on failure, string containing URI on success.
  */
-function discover_pingback_server_uri($url, $deprecated = 2048) {
+function discover_pingback_server_uri( $url, $deprecated = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.7' );
 
        $pingback_str_dquote = 'rel="pingback"';
        $pingback_str_squote = 'rel=\'pingback\'';
@@ -1766,7 +1831,7 @@ function weblog_ping($server = '', $path = '') {
 
        // when set to true, this outputs debug messages by itself
        $client->debug = false;
-       $home = trailingslashit( get_option('home') );
+       $home = trailingslashit( home_url() );
        if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
                $client->query('weblogUpdates.ping', get_option('blogname'), $home);
 }
index 45d746bec117df33755135022634391b91802bd2..4edf33b0ce626aadac01f450ddf2e5550ba7d563 100644 (file)
@@ -129,7 +129,7 @@ if ( !function_exists('json_encode') ) {
                global $wp_json;
 
                if ( !is_a($wp_json, 'Services_JSON') ) {
-                       require_once( 'class-json.php' );
+                       require_once( ABSPATH . WPINC . '/class-json.php' );
                        $wp_json = new Services_JSON();
                }
 
@@ -138,15 +138,23 @@ if ( !function_exists('json_encode') ) {
 }
 
 if ( !function_exists('json_decode') ) {
-       function json_decode( $string ) {
+       function json_decode( $string, $assoc_array = false ) {
                global $wp_json;
 
                if ( !is_a($wp_json, 'Services_JSON') ) {
-                       require_once( 'class-json.php' );
+                       require_once( ABSPATH . WPINC . '/class-json.php' );
                        $wp_json = new Services_JSON();
                }
 
-               return $wp_json->decode( $string );
+               $res = $wp_json->decode( $string );
+               if ( $assoc_array )
+                       $res = _json_decode_object_helper( $res );
+               return $res;
+       }
+       function _json_decode_object_helper($data) {
+               if ( is_object($data) )
+                       $data = get_object_vars($data);
+               return is_array($data) ? array_map(__FUNCTION__, $data) : $data;
        }
 }
 
index 416803a9bc04cf15ce01ea2cd9ead74732af5be1..921f8c86616e25e830d9d30d46702a1dd3d67bf2 100644 (file)
@@ -130,10 +130,15 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
  * @since 2.1.0
  *
  * @param string $hook Action hook, the execution of which will be unscheduled.
- * @param mixed $args,... Optional. Event arguments.
+ * @param array $args Optional. Arguments that were to be pass to the hook's callback function.
  */
-function wp_clear_scheduled_hook( $hook ) {
-       $args = array_slice( func_get_args(), 1 );
+function wp_clear_scheduled_hook( $hook, $args = array() ) {
+       // Backward compatibility
+       // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
+       if ( !is_array($args) ) {
+               _deprecated_argument( __FUNCTION__, '3.0.0', __('This argument has changed to an array to match the behavior of the other cron functions.') );
+               $args = array_slice( func_get_args(), 1 );
+       }
 
        while ( $timestamp = wp_next_scheduled( $hook, $args ) )
                wp_unschedule_event( $timestamp, $hook, $args );
@@ -219,7 +224,7 @@ function spawn_cron( $local_time = 0 ) {
                while ( @ob_end_flush() );
                flush();
 
-               @include_once(ABSPATH . 'wp-cron.php');
+               WP_DEBUG ? include_once( ABSPATH . 'wp-cron.php' ) : @include_once( ABSPATH . 'wp-cron.php' );
                return;
        }
 
diff --git a/wp-includes/default-constants.php b/wp-includes/default-constants.php
new file mode 100644 (file)
index 0000000..47b9cd7
--- /dev/null
@@ -0,0 +1,297 @@
+<?php
+/**
+ * Defines constants and global variables that can be overridden, generally in wp-config.php.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Defines initial WordPress constants
+ *
+ * @see wp_debug_mode()
+ *
+ * @since 3.0.0
+ */
+function wp_initial_constants( ) {
+       global $blog_id;
+
+       // set memory limits
+       if ( !defined('WP_MEMORY_LIMIT') ) {
+               if( is_multisite() ) {
+                       define('WP_MEMORY_LIMIT', '64M');
+               } else {
+                       define('WP_MEMORY_LIMIT', '32M');
+               }
+       }
+
+       /**
+        * The $blog_id global, which you can change in the config allows you to create a simple
+        * multiple blog installation using just one WordPress and changing $blog_id around.
+        *
+        * @global int $blog_id
+        * @since 2.0.0
+        */
+       if ( ! isset($blog_id) )
+               $blog_id = 1;
+
+       // set memory limits.
+       if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
+               @ini_set('memory_limit', WP_MEMORY_LIMIT);
+
+       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
+
+       // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
+       if ( !defined('WP_DEBUG') )
+               define( 'WP_DEBUG', false );
+
+       // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php use the globally configured setting for display_errors and not force errors to be displayed.
+       if ( !defined('WP_DEBUG_DISPLAY') )
+               define( 'WP_DEBUG_DISPLAY', true );
+
+       // Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
+       if ( !defined('WP_DEBUG_LOG') )
+               define('WP_DEBUG_LOG', false);
+
+       if ( !defined('WP_CACHE') )
+               define('WP_CACHE', false);
+
+       /**
+        * Private
+        */
+       if ( !defined('MEDIA_TRASH') )
+               define('MEDIA_TRASH', false);
+
+       if ( !defined('SHORTINIT') )
+               define('SHORTINIT', false);
+}
+
+/**
+ * Defines plugin directory WordPress constants
+ *
+ * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in
+ *
+ * @since 3.0.0
+ */
+function wp_plugin_directory_constants( ) {
+       if ( !defined('WP_CONTENT_URL') )
+               define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
+
+       /**
+        * Allows for the plugins directory to be moved from the default location.
+        *
+        * @since 2.6.0
+        */
+       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
+
+       /**
+        * Allows for the plugins directory to be moved from the default location.
+        *
+        * @since 2.1.0
+        * @deprecated
+        */
+       if ( !defined('PLUGINDIR') )
+               define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
+
+       /**
+        * Allows for the mu-plugins directory to be moved from the default location.
+        *
+        * @since 2.8.0
+        */
+       if ( !defined('WPMU_PLUGIN_DIR') )
+               define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
+
+       /**
+        * Allows for the mu-plugins directory to be moved from the default location.
+        *
+        * @since 2.8.0
+        */
+       if ( !defined('WPMU_PLUGIN_URL') )
+               define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
+
+       /**
+        * Allows for the mu-plugins directory to be moved from the default location.
+        *
+        * @since 2.8.0
+        * @deprecated
+        */
+       if ( !defined( 'MUPLUGINDIR' ) )
+               define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
+}
+
+/**
+ * Defines cookie related WordPress constants
+ *
+ * Defines constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
+ * @since 3.0.0
+ */
+function wp_cookie_constants( ) {
+       global $wp_default_secret_key;
+
+       /**
+        * Used to guarantee unique hash cookies
+        * @since 1.5
+        */
+       if ( !defined( 'COOKIEHASH' ) ) {
+               $siteurl = get_site_option( 'siteurl' );
+               if ( $siteurl )
+                       define( 'COOKIEHASH', md5( $siteurl ) );
+               else
+                       define( 'COOKIEHASH', '' );
+       }
+
+       /**
+        * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
+        * @since 2.5.0
+        */
+       $wp_default_secret_key = 'put your unique phrase here';
+
+       /**
+        * @since 2.0.0
+        */
+       if ( !defined('USER_COOKIE') )
+               define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
+
+       /**
+        * @since 2.0.0
+        */
+       if ( !defined('PASS_COOKIE') )
+               define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
+
+       /**
+        * @since 2.5.0
+        */
+       if ( !defined('AUTH_COOKIE') )
+               define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('SECURE_AUTH_COOKIE') )
+               define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('LOGGED_IN_COOKIE') )
+               define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
+
+       /**
+        * @since 2.3.0
+        */
+       if ( !defined('TEST_COOKIE') )
+               define('TEST_COOKIE', 'wordpress_test_cookie');
+
+       /**
+        * @since 1.2.0
+        */
+       if ( !defined('COOKIEPATH') )
+               define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
+
+       /**
+        * @since 1.5.0
+        */
+       if ( !defined('SITECOOKIEPATH') )
+               define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('ADMIN_COOKIE_PATH') )
+               define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('PLUGINS_COOKIE_PATH') )
+               define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
+
+       /**
+        * @since 2.0.0
+        */
+       if ( !defined('COOKIE_DOMAIN') )
+               define('COOKIE_DOMAIN', false);
+}
+
+/**
+ * Defines cookie related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_ssl_constants( ) {
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('FORCE_SSL_ADMIN') )
+               define('FORCE_SSL_ADMIN', false);
+       force_ssl_admin(FORCE_SSL_ADMIN);
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined('FORCE_SSL_LOGIN') )
+               define('FORCE_SSL_LOGIN', false);
+       force_ssl_login(FORCE_SSL_LOGIN);
+}
+
+/**
+ * Defines functionality related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_functionality_constants( ) {
+       /**
+        * @since 2.5.0
+        */
+       if ( !defined( 'AUTOSAVE_INTERVAL' ) )
+               define( 'AUTOSAVE_INTERVAL', 60 );
+
+       /**
+        * @since 2.9.0
+        */
+       if ( !defined( 'EMPTY_TRASH_DAYS' ) )
+               define( 'EMPTY_TRASH_DAYS', 30 );
+
+       if ( !defined('WP_POST_REVISIONS') )
+               define('WP_POST_REVISIONS', true);
+}
+
+/**
+ * Defines templating related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_templating_constants( ) {
+       /**
+        * Web Path to the current active template directory
+        * @since 1.5.0
+        */
+       define('TEMPLATEPATH', get_template_directory());
+
+       /**
+        * Web Path to the current active template stylesheet directory
+        * @since 2.1.0
+        */
+       define('STYLESHEETPATH', get_stylesheet_directory());
+
+       /**
+        * Slug of the default theme for this install.
+        * Used as the default theme when installing new sites.
+        * Will be used as the fallback if the current theme doesn't exist.
+        * @since 3.0.0
+        */
+       if ( !defined('WP_DEFAULT_THEME') )
+               define( 'WP_DEFAULT_THEME', 'twentyten' );
+
+}
+
+?>
index d0a2336d2c17386502ae815b1b4abd06b9415adf..1283c1e2ecc9c0176230682fa7434bd6db5b03be 100644 (file)
@@ -32,21 +32,4 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
 }
 wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
 
-/**
- * The PollDaddy.com embed handler callback. PollDaddy does not support oEmbed, at least not yet.
- *
- * @see WP_Embed::register_handler()
- * @see WP_Embed::shortcode()
- *
- * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
- * @param array $attr Embed attributes.
- * @param string $url The original URL that was matched by the regex.
- * @param array $rawattr The original unmodified attributes.
- * @return string The embed HTML.
- */
-function wp_embed_handler_polldaddy( $matches, $attr, $url, $rawattr ) {
-       return apply_filters( 'embed_polldaddy', '<script type="text/javascript" charset="utf8" src="http://s3.polldaddy.com/p/' . esc_attr($matches[1]) . '"></script>', $matches, $attr, $url, $rawattr );
-}
-wp_embed_register_handler( 'polldaddy', '#http://answers.polldaddy.com/poll/(\d+)(.*?)#i', 'wp_embed_handler_polldaddy' );
-
 ?>
\ No newline at end of file
index 668f389deddc305a2f5169480e1e49bd6b336a57..d3f5fc0c2e81f2f4275002a37a125d42b8090cc5 100644 (file)
@@ -86,6 +86,16 @@ foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description',
        add_filter( $filter, 'esc_html'      );
 }
 
+// Format WordPress
+foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
+       add_filter( $filter, 'capital_P_dangit' );
+
+// Format titles
+foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
+       add_filter( $filter, 'wptexturize' );
+       add_filter( $filter, 'strip_tags'  );
+}
+
 // Format text area for display.
 foreach ( array( 'term_description' ) as $filter ) {
        add_filter( $filter, 'wptexturize'      );
@@ -163,27 +173,36 @@ 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'                           );
+add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object'    );
 
 // Atom SSL support
 add_filter( 'atom_service_url','atom_service_url_filter' );
 
 // Actions
-add_action( 'wp_head',             'wp_enqueue_scripts',             1    );
-add_action( 'wp_head',             'feed_links_extra',               3    );
+add_action( 'wp_head',             'wp_enqueue_scripts',            1     );
+add_action( 'wp_head',             'feed_links',                    2     );
+add_action( 'wp_head',             'feed_links_extra',              3     );
 add_action( 'wp_head',             'rsd_link'                             );
 add_action( 'wp_head',             'wlwmanifest_link'                     );
 add_action( 'wp_head',             'index_rel_link'                       );
 add_action( 'wp_head',             'parent_post_rel_link',          10, 0 );
 add_action( 'wp_head',             'start_post_rel_link',           10, 0 );
-add_action( 'wp_head',             'adjacent_posts_rel_link',       10, 0 );
+add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
 add_action( 'wp_head',             'locale_stylesheet'                    );
 add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
-add_action( 'wp_head',             'noindex',                        1    );
-add_action( 'wp_head',             'wp_print_styles',                8    );
-add_action( 'wp_head',             'wp_print_head_scripts',          9    );
+add_action( 'wp_head',             'noindex',                           );
+add_action( 'wp_head',             'wp_print_styles',                   );
+add_action( 'wp_head',             'wp_print_head_scripts',             );
 add_action( 'wp_head',             'wp_generator'                         );
 add_action( 'wp_head',             'rel_canonical'                        );
 add_action( 'wp_footer',           'wp_print_footer_scripts'              );
+add_action( 'wp_head',             'wp_shortlink_wp_head',          10, 0 );
+add_action( 'template_redirect',   'wp_shortlink_header',           11, 0 );
+
+// Feed Generator Tags
+foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
+       add_action( $action, 'the_generator' );
+}
 
 // WP Cron
 if ( !defined( 'DOING_CRON' ) )
@@ -206,22 +225,32 @@ add_action( 'plugins_loaded',             'wp_maybe_load_embeds',     0    );
 add_action( 'shutdown',                   'wp_ob_end_flush_all',      1    );
 add_action( 'pre_post_update',            'wp_save_post_revision'          );
 add_action( 'publish_post',               '_publish_post_hook',       5, 1 );
-add_action( 'future_post',                '_future_post_hook',        5, 2 );
-add_action( 'future_page',                '_future_post_hook',        5, 2 );
 add_action( 'save_post',                  '_save_post_hook',          5, 2 );
 add_action( 'transition_post_status',     '_transition_post_status',  5, 3 );
 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce'        );
-add_action( 'wp_scheduled_delete',        'wp_scheduled_delete' );
+add_action( 'wp_scheduled_delete',        'wp_scheduled_delete'            );
+
+// Navigation menu actions
+add_action( 'delete_post',                '_wp_delete_post_menu_item'      );
+add_action( 'delete_term',                '_wp_delete_tax_menu_item'       );
+add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu',  10, 3 );
 
 // Post Thumbnail CSS class filtering
 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add'    );
 add_action( 'end_fetch_post_thumbnail_html',   '_wp_post_thumbnail_class_filter_remove' );
 
 // Redirect Old Slugs
-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'         );
+add_action( 'template_redirect', 'wp_old_slug_redirect'              );
+add_action( 'post_updated',      'wp_check_for_changed_slugs', 12, 3 );
+
+// Nonce check for Post Previews
+add_action( 'init', '_show_post_preview' );
 
 // Timezone
 add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
+
+// Admin Color Schemes
+add_action( 'admin_init', 'register_admin_color_schemes', 1);
+add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+
+?>
index e5219fecc37b581404eda95cc95d87846de0cda8..47e06860a767c8b1fdf578ba01750deec6005efc 100644 (file)
 class WP_Widget_Pages extends WP_Widget {
 
        function WP_Widget_Pages() {
-               $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your blog&#8217;s WordPress Pages') );
+               $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your site&#8217;s WordPress Pages') );
                $this->WP_Widget('pages', __('Pages'), $widget_ops);
        }
 
        function widget( $args, $instance ) {
                extract( $args );
 
-               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']);
+               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base);
                $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
                $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
 
@@ -172,13 +172,13 @@ class WP_Widget_Links extends WP_Widget {
 class WP_Widget_Search extends WP_Widget {
 
        function WP_Widget_Search() {
-               $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") );
+               $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site") );
                $this->WP_Widget('search', __('Search'), $widget_ops);
        }
 
        function widget( $args, $instance ) {
                extract($args);
-               $title = apply_filters('widget_title', $instance['title']);
+               $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
 
                echo $before_widget;
                if ( $title )
@@ -215,7 +215,7 @@ class WP_Widget_Search extends WP_Widget {
 class WP_Widget_Archives extends WP_Widget {
 
        function WP_Widget_Archives() {
-               $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your blog&#8217;s posts') );
+               $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s posts') );
                $this->WP_Widget('archives', __('Archives'), $widget_ops);
        }
 
@@ -223,7 +223,7 @@ class WP_Widget_Archives extends WP_Widget {
                extract($args);
                $c = $instance['count'] ? '1' : '0';
                $d = $instance['dropdown'] ? '1' : '0';
-               $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title']);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base);
 
                echo $before_widget;
                if ( $title )
@@ -286,7 +286,7 @@ class WP_Widget_Meta extends WP_Widget {
 
        function widget( $args, $instance ) {
                extract($args);
-               $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base);
 
                echo $before_widget;
                if ( $title )
@@ -328,13 +328,13 @@ class WP_Widget_Meta extends WP_Widget {
 class WP_Widget_Calendar extends WP_Widget {
 
        function WP_Widget_Calendar() {
-               $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your blog&#8217;s posts') );
+               $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s posts') );
                $this->WP_Widget('calendar', __('Calendar'), $widget_ops);
        }
 
        function widget( $args, $instance ) {
                extract($args);
-               $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
+               $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
                echo $before_widget;
                if ( $title )
                        echo $before_title . $title . $after_title;
@@ -376,7 +376,7 @@ class WP_Widget_Text extends WP_Widget {
 
        function widget( $args, $instance ) {
                extract($args);
-               $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );
+               $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
                $text = apply_filters( 'widget_text', $instance['text'], $instance );
                echo $before_widget;
                if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
@@ -406,7 +406,7 @@ class WP_Widget_Text extends WP_Widget {
 
                <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
 
-               <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
+               <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
 <?php
        }
 }
@@ -426,7 +426,7 @@ class WP_Widget_Categories extends WP_Widget {
        function widget( $args, $instance ) {
                extract( $args );
 
-               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title']);
+               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base);
                $c = $instance['count'] ? '1' : '0';
                $h = $instance['hierarchical'] ? '1' : '0';
                $d = $instance['dropdown'] ? '1' : '0';
@@ -447,7 +447,7 @@ class WP_Widget_Categories extends WP_Widget {
        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;
+                       location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
                }
        }
        dropdown.onchange = onCatChange;
@@ -472,9 +472,9 @@ class WP_Widget_Categories extends WP_Widget {
        function update( $new_instance, $old_instance ) {
                $instance = $old_instance;
                $instance['title'] = strip_tags($new_instance['title']);
-               $instance['count'] = $new_instance['count'] ? 1 : 0;
-               $instance['hierarchical'] = $new_instance['hierarchical'] ? 1 : 0;
-               $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
+               $instance['count'] = !empty($new_instance['count']) ? 1 : 0;
+               $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
+               $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
 
                return $instance;
        }
@@ -511,7 +511,7 @@ class WP_Widget_Categories extends WP_Widget {
 class WP_Widget_Recent_Posts extends WP_Widget {
 
        function WP_Widget_Recent_Posts() {
-               $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") );
+               $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );
                $this->WP_Widget('recent-posts', __('Recent Posts'), $widget_ops);
                $this->alt_option_name = 'widget_recent_entries';
 
@@ -534,7 +534,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
                ob_start();
                extract($args);
 
-               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
                if ( !$number = (int) $instance['number'] )
                        $number = 10;
                else if ( $number < 1 )
@@ -549,16 +549,18 @@ class WP_Widget_Recent_Posts extends WP_Widget {
                <?php if ( $title ) echo $before_title . $title . $after_title; ?>
                <ul>
                <?php  while ($r->have_posts()) : $r->the_post(); ?>
-               <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
+               <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li>
                <?php endwhile; ?>
                </ul>
                <?php echo $after_widget; ?>
 <?php
-                       wp_reset_query();  // Restore global post data stomped by the_post().
+               // Reset the global $the_post as this query will have stomped on it
+               wp_reset_postdata();
+
                endif;
 
                $cache[$args['widget_id']] = ob_get_flush();
-               wp_cache_add('widget_recent_posts', $cache, 'widget');
+               wp_cache_set('widget_recent_posts', $cache, 'widget');
        }
 
        function update( $new_instance, $old_instance ) {
@@ -587,8 +589,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
                <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
 
                <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:'); ?></label>
-               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
-               <small><?php _e('(at most 15)'); ?></small></p>
+               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
 <?php
        }
 }
@@ -618,36 +619,48 @@ class WP_Widget_Recent_Comments extends WP_Widget {
        }
 
        function flush_widget_cache() {
-               wp_cache_delete('recent_comments', 'widget');
+               wp_cache_delete('widget_recent_comments', 'widget');
        }
 
        function widget( $args, $instance ) {
-               global $wpdb, $comments, $comment;
+               global $comments, $comment;
 
-               extract($args, EXTR_SKIP);
-               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);
-               if ( !$number = (int) $instance['number'] )
-                       $number = 5;
-               else if ( $number < 1 )
-                       $number = 1;
-               else if ( $number > 15 )
-                       $number = 15;
+               $cache = wp_cache_get('widget_recent_comments', 'widget');
+
+               if ( ! is_array( $cache ) )
+                       $cache = array();
 
-               if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
-                       $comments = $wpdb->get_results("SELECT $wpdb->comments.* FROM $wpdb->comments JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_status = 'publish' ORDER BY comment_date_gmt DESC LIMIT 15");
-                       wp_cache_add( 'recent_comments', $comments, 'widget' );
+               if ( isset( $cache[$args['widget_id']] ) ) {
+                       echo $cache[$args['widget_id']];
+                       return;
                }
 
-               $comments = array_slice( (array) $comments, 0, $number );
-?>
-               <?php echo $before_widget; ?>
-                       <?php if ( $title ) echo $before_title . $title . $after_title; ?>
-                       <ul id="recentcomments"><?php
-                       if ( $comments ) : foreach ( (array) $comments as $comment) :
-                       echo  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
-                       endforeach; endif;?></ul>
-               <?php echo $after_widget; ?>
-<?php
+               extract($args, EXTR_SKIP);
+               $output = '';
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);
+
+               if ( ! $number = (int) $instance['number'] )
+                       $number = 5;
+               else if ( $number < 1 )
+                       $number = 1;
+
+               $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) );
+               $output .= $before_widget;
+               if ( $title )
+                       $output .= $before_title . $title . $after_title;
+
+               $output .= '<ul id="recentcomments">';
+               if ( $comments ) {
+                       foreach ( (array) $comments as $comment) {
+                               $output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
+                       }
+               }
+               $output .= '</ul>';
+               $output .= $after_widget;
+
+               echo $output;
+               $cache[$args['widget_id']] = $output;
+               wp_cache_set('widget_recent_comments', $cache, 'widget');
        }
 
        function update( $new_instance, $old_instance ) {
@@ -671,8 +684,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
                <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
 
                <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of comments to show:'); ?></label>
-               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
-               <small><?php _e('(at most 15)'); ?></small></p>
+               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
 <?php
        }
 }
@@ -721,11 +733,11 @@ class WP_Widget_RSS extends WP_Widget {
                if ( empty($title) )
                        $title = empty($desc) ? __('Unknown Feed') : $desc;
 
-               $title = apply_filters('widget_title', $title );
+               $title = apply_filters('widget_title', $title, $instance, $this->id_base);
                $url = esc_url(strip_tags($url));
                $icon = includes_url('images/rss.png');
                if ( $title )
-                       $title = "<a class='rsswidget' href='$url' title='" . esc_attr(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
+                       $title = "<a class='rsswidget' href='$url' title='" . esc_attr__( 'Syndicate this content' ) ."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
 
                echo $before_widget;
                if ( $title )
@@ -739,7 +751,7 @@ class WP_Widget_RSS extends WP_Widget {
        }
 
        function update($new_instance, $old_instance) {
-               $testurl = $new_instance['url'] != $old_instance['url'];
+               $testurl = ( isset($new_instance['url']) && ($new_instance['url'] != $old_instance['url']) );
                return wp_widget_rss_process( $new_instance, $testurl );
        }
 
@@ -790,7 +802,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
 
        if ( !$rss->get_item_quantity() ) {
                echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
-               $rss->__destruct(); 
+               $rss->__destruct();
                unset($rss);
                return;
        }
@@ -805,8 +817,15 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                if ( empty($title) )
                        $title = __('Untitled');
 
-               $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
-               $desc = wp_html_excerpt( $desc, 360 ) . ' [&hellip;]';
+               $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
+               $desc = wp_html_excerpt( $desc, 360 );
+
+               // Append ellipsis. Change existing [...] to [&hellip;].
+               if ( '[...]' == substr( $desc, -5 ) )
+                       $desc = substr( $desc, 0, -5 ) . '[&hellip;]';
+               elseif ( '[&hellip;]' != substr( $desc, -10 ) )
+                       $desc .= ' [&hellip;]';
+
                $desc = esc_html( $desc );
 
                if ( $show_summary ) {
@@ -843,7 +862,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                }
        }
        echo '</ul>';
-       $rss->__destruct(); 
+       $rss->__destruct();
        unset($rss);
 }
 
@@ -939,9 +958,9 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
                $items = 10;
        $url           = esc_url_raw(strip_tags( $widget_rss['url'] ));
        $title         = trim(strip_tags( $widget_rss['title'] ));
-       $show_summary  = (int) $widget_rss['show_summary'];
-       $show_author   = (int) $widget_rss['show_author'];
-       $show_date     = (int) $widget_rss['show_date'];
+       $show_summary  = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
+       $show_author   = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] :0;
+       $show_date     = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
 
        if ( $check_feed ) {
                $rss = fetch_feed($url);
@@ -976,27 +995,123 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
 
        function widget( $args, $instance ) {
                extract($args);
-               $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
+               $current_taxonomy = $this->_get_current_taxonomy($instance);
+               if ( !empty($instance['title']) ) {
+                       $title = $instance['title'];
+               } else {
+                       if ( 'post_tag' == $current_taxonomy ) {
+                               $title = __('Tags');
+                       } else {
+                               $tax = get_taxonomy($current_taxonomy);
+                               $title = $tax->labels->name;
+                       }
+               }
+               $title = apply_filters('widget_title', $title, $instance, $this->id_base);
 
                echo $before_widget;
                if ( $title )
                        echo $before_title . $title . $after_title;
                echo '<div>';
-               wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()));
+               wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) );
                echo "</div>\n";
                echo $after_widget;
        }
 
        function update( $new_instance, $old_instance ) {
                $instance['title'] = strip_tags(stripslashes($new_instance['title']));
+               $instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
                return $instance;
        }
 
        function form( $instance ) {
+               $current_taxonomy = $this->_get_current_taxonomy($instance);
 ?>
        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
        <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
-<?php
+       <p><label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:') ?></label>
+       <select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">
+       <?php foreach ( get_object_taxonomies('post') as $taxonomy ) :
+                               $tax = get_taxonomy($taxonomy);
+                               if ( !$tax->show_tagcloud || empty($tax->labels->name) )
+                                       continue;
+       ?>
+               <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
+       <?php endforeach; ?>
+       </select></p><?php
+       }
+
+       function _get_current_taxonomy($instance) {
+               if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
+                       return $instance['taxonomy'];
+
+               return 'post_tag';
+       }
+}
+
+/**
+ * Navigation Menu widget class
+ *
+ * @since 3.0.0
+ */
+ class WP_Nav_Menu_Widget extends WP_Widget {
+
+       function WP_Nav_Menu_Widget() {
+               $widget_ops = array( 'description' => __('Use this widget to add one of your custom menus as a widget.') );
+               parent::WP_Widget( 'nav_menu', __('Custom Menu'), $widget_ops );
+       }
+
+       function widget($args, $instance) {
+               // Get menu
+               $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] );
+
+               if ( !$nav_menu )
+                       return;
+
+               echo $args['before_widget'];
+
+               if ( !empty($instance['title']) )
+                       echo $args['before_title'] . $instance['title'] . $args['after_title'];
+
+               wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) );
+
+               echo $args['after_widget'];
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
+               $instance['nav_menu'] = (int) $new_instance['nav_menu'];
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $title = isset( $instance['title'] ) ? $instance['title'] : '';
+               $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
+
+               // Get menus
+               $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
+
+               // If no menus exists, direct the user to go and create some.
+               if ( !$menus ) {
+                       echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
+                       return;
+               }
+               ?>
+               <p>
+                       <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
+                       <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
+               </p>
+               <p>
+                       <label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
+                       <select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
+               <?php
+                       foreach ( $menus as $menu ) {
+                               $selected = $nav_menu == $menu->term_id ? ' selected="selected"' : '';
+                               echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>';
+                       }
+               ?>
+                       </select>
+               </p>
+               <?php
        }
 }
 
@@ -1036,6 +1151,8 @@ function wp_widgets_init() {
 
        register_widget('WP_Widget_Tag_Cloud');
 
+       register_widget('WP_Nav_Menu_Widget');
+
        do_action('widgets_init');
 }
 
index 0b546ebff4ebfd8a7deccbcf2a0eb57088493be3..77c3e1dfe60a2a44b4a1187d7dd37ce52d3f2e09 100644 (file)
@@ -1,79 +1,13 @@
 <?php
 /**
  * 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.
+ * functions and look for the alternatives instead. The functions will be
+ * removed in a later version.
  *
  * @package WordPress
  * @subpackage Deprecated
  */
 
-/*
- * Deprecated global variables.
- */
-
-/**
- * The name of the Posts table
- * @global string $tableposts
- * @deprecated Use $wpdb->posts
- */
-$tableposts = $wpdb->posts;
-
-/**
- * The name of the Users table
- * @global string $tableusers
- * @deprecated Use $wpdb->users
- */
-$tableusers = $wpdb->users;
-
-/**
- * The name of the Categories table
- * @global string $tablecategories
- * @deprecated Use $wpdb->categories
- */
-$tablecategories = $wpdb->categories;
-
-/**
- * The name of the post to category table
- * @global string $tablepost2cat
- * @deprecated Use $wpdb->post2cat;
- */
-$tablepost2cat = $wpdb->post2cat;
-
-/**
- * The name of the comments table
- * @global string $tablecomments
- * @deprecated Use $wpdb->comments;
- */
-$tablecomments = $wpdb->comments;
-
-/**
- * The name of the links table
- * @global string $tablelinks
- * @deprecated Use $wpdb->links;
- */
-$tablelinks = $wpdb->links;
-
-/**
- * @global string $tablelinkcategories
- * @deprecated Not used anymore;
- */
-$tablelinkcategories = 'linkcategories_is_gone';
-
-/**
- * The name of the options table
- * @global string $tableoptions
- * @deprecated Use $wpdb->options;
- */
-$tableoptions = $wpdb->options;
-
-/**
- * The name of the postmeta table
- * @global string $tablepostmeta
- * @deprecated Use $wpdb->postmeta;
- */
-$tablepostmeta = $wpdb->postmeta;
-
 /*
  * Deprecated functions come here to die.
  */
@@ -82,6 +16,7 @@ $tablepostmeta = $wpdb->postmeta;
  * Entire Post data.
  *
  * @since 0.71
+ * @deprecated 1.5.1
  * @deprecated Use get_post()
  * @see get_post()
  *
@@ -89,7 +24,7 @@ $tablepostmeta = $wpdb->postmeta;
  * @return array
  */
 function get_postdata($postid) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_post()');
+       _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
 
        $post = &get_post($postid);
 
@@ -118,12 +53,13 @@ function get_postdata($postid) {
  * Sets up the WordPress Loop.
  *
  * @since 1.0.1
- * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
+ * @deprecated 1.5
+ * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
  */
 function start_wp() {
        global $wp_query, $post;
 
-       _deprecated_function(__FUNCTION__, '1.5', __('new WordPress Loop') );
+       _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') );
 
        // Since the old style loop is being used, advance the query iterator here.
        $wp_query->next_post();
@@ -135,6 +71,7 @@ function start_wp() {
  * Return or Print Category ID.
  *
  * @since 0.71
+ * @deprecated 0.71
  * @deprecated use get_the_category()
  * @see get_the_category()
  *
@@ -142,7 +79,7 @@ function start_wp() {
  * @return null|int
  */
 function the_category_ID($echo = true) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_the_category()');
+       _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
 
        // Grab the first cat in the list.
        $categories = get_the_category();
@@ -158,6 +95,7 @@ function the_category_ID($echo = true) {
  * Print category with optional text before and after.
  *
  * @since 0.71
+ * @deprecated 0.71
  * @deprecated use get_the_category_by_ID()
  * @see get_the_category_by_ID()
  *
@@ -167,7 +105,7 @@ function the_category_ID($echo = true) {
 function the_category_head($before='', $after='') {
        global $currentcat, $previouscat;
 
-       _deprecated_function(__FUNCTION__, '0.0', 'get_the_category_by_ID()');
+       _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
 
        // Grab the first cat in the list.
        $categories = get_the_category();
@@ -184,6 +122,7 @@ function the_category_head($before='', $after='') {
  * Prints link to the previous post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use previous_post_link()
  * @see previous_post_link()
  *
@@ -196,7 +135,7 @@ function the_category_head($before='', $after='') {
  */
 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
 
-       _deprecated_function(__FUNCTION__, '0.0', 'previous_post_link()');
+       _deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' );
 
        if ( empty($in_same_cat) || 'no' == $in_same_cat )
                $in_same_cat = false;
@@ -220,6 +159,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
  * Prints link to the next post.
  *
  * @since 0.71
+ * @deprecated 2.0
  * @deprecated Use next_post_link()
  * @see next_post_link()
  *
@@ -231,7 +171,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
  * @param string $excluded_categories
  */
 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
-       _deprecated_function(__FUNCTION__, '0.0', 'next_post_link()');
+       _deprecated_function( __FUNCTION__, '2.0', 'next_post_link()' );
 
        if ( empty($in_same_cat) || 'no' == $in_same_cat )
                $in_same_cat = false;
@@ -255,6 +195,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
  * Whether user can create a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -264,7 +205,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
  * @return bool
  */
 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
-       _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $author_data = get_userdata($user_id);
        return ($author_data->user_level > 1);
@@ -274,6 +215,7 @@ function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
  * Whether user can create a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -283,7 +225,7 @@ function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
  * @return bool
  */
 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
-       _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $author_data = get_userdata($user_id);
        return ($author_data->user_level >= 1);
@@ -293,6 +235,7 @@ function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
  * Whether user can edit a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -302,13 +245,13 @@ function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
  * @return bool
  */
 function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
-       _deprecated_function(__FUNCTION__, '0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $author_data = get_userdata($user_id);
        $post = get_post($post_id);
        $post_author_data = get_userdata($post->post_author);
 
-       if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' &&  $author_data->user_level < 2))
+       if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
                         || ($author_data->user_level > $post_author_data->user_level)
                         || ($author_data->user_level >= 10) ) {
                return true;
@@ -321,6 +264,7 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
  * Whether user can delete a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -330,7 +274,7 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
  * @return bool
  */
 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
-       _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        // right now if one can edit, one can delete
        return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -340,6 +284,7 @@ function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
  * Whether user can set new posts' dates.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -349,7 +294,7 @@ function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
  * @return bool
  */
 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
-       _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $author_data = get_userdata($user_id);
        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
@@ -359,6 +304,7 @@ function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
  * Whether user can delete a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -368,7 +314,7 @@ function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
  * @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()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $author_data = get_userdata($user_id);
        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
@@ -378,6 +324,7 @@ function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
  * Whether user can delete a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -387,7 +334,7 @@ function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
  * @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()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        // right now if one can edit a post, one can edit comments made on it
        return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -397,6 +344,7 @@ function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
  * Whether user can delete a post.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -406,7 +354,7 @@ function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
  * @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()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        // right now if one can edit comments, one can delete comments
        return user_can_edit_post_comments($user_id, $post_id, $blog_id);
@@ -416,6 +364,7 @@ function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
  * Can user can edit other user.
  *
  * @since 1.5
+ * @deprecated 2.0
  * @deprecated Use current_user_can()
  * @see current_user_can()
  *
@@ -424,7 +373,7 @@ function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
  * @return bool
  */
 function user_can_edit_user($user_id, $other_user) {
-       _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
+       _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
 
        $user  = get_userdata($user_id);
        $other = get_userdata($other_user);
@@ -438,8 +387,9 @@ function user_can_edit_user($user_id, $other_user) {
  * Gets the links associated with category $cat_name.
  *
  * @since 0.71
- * @deprecated Use get_links()
- * @see get_links()
+ * @deprecated 2.1
+ * @deprecated Use get_bookmarks()
+ * @see get_bookmarks()
  *
  * @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.
@@ -457,7 +407,7 @@ function user_can_edit_user($user_id, $other_user) {
 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
                                                 $show_description = true, $show_rating = false,
                                                 $limit = -1, $show_updated = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_links()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
        $cat_id = -1;
        $cat = get_term_by('name', $cat_name, 'link_category');
@@ -471,23 +421,31 @@ function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
  * Gets the links associated with the named category.
  *
  * @since 1.0.1
- * @deprecated Use wp_get_links()
- * @see wp_get_links()
+ * @deprecated 2.1
+ * @deprecated Use wp_list_bookmarks()
+ * @see wp_list_bookmarks()
  *
  * @param string $category The category to use.
  * @param string $args
  * @return bool|null
  */
 function wp_get_linksbyname($category, $args = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_get_links()');
+       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
 
-       $cat = get_term_by('name', $category, 'link_category');
-       if ( !$cat )
-               return false;
-       $cat_id = $cat->term_id;
+       $defaults = array(
+               'after' => '<br />',
+               'before' => '',
+               'categorize' => 0,
+               'category_after' => '',
+               'category_before' => '',
+               'category_name' => $category,
+               'show_description' => 1,
+               'title_li' => '',
+       );
+
+       $r = wp_parse_args( $args, $defaults );
 
-       $args = add_query_arg('category', $cat_id, $args);
-       wp_get_links($args);
+       return wp_list_bookmarks($r);
 }
 
 /**
@@ -501,8 +459,9 @@ function wp_get_linksbyname($category, $args = '') {
  * </code>
  *
  * @since 1.0.1
- * @deprecated Use get_linkobjects()
- * @see get_linkobjects()
+ * @deprecated 2.1
+ * @deprecated Use get_bookmarks()
+ * @see get_bookmarks()
  *
  * @param string $cat_name The category name to use. If no match is found uses all.
  * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
@@ -512,7 +471,7 @@ function wp_get_linksbyname($category, $args = '') {
  * @return unknown
  */
 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_linkobjects()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
        $cat_id = -1;
        $cat = get_term_by('name', $cat_name, 'link_category');
@@ -553,6 +512,7 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
  * </ol>
  *
  * @since 1.0.1
+ * @deprecated 2.1
  * @deprecated Use get_bookmarks()
  * @see get_bookmarks()
  *
@@ -565,9 +525,9 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
  * @return unknown
  */
 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
-       $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit");
+       $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
 
        $links_array = array();
        foreach ($links as $link)
@@ -580,6 +540,7 @@ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
  * Gets the links associated with category 'cat_name' and display rating stars/chars.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use get_bookmarks()
  * @see get_bookmarks()
  *
@@ -598,7 +559,7 @@ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
  */
 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
                                                                        $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
        get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
 }
@@ -607,6 +568,7 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '', $after =
  * Gets the links associated with category n and display rating stars/chars.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use get_bookmarks()
  * @see get_bookmarks()
  *
@@ -625,7 +587,7 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '', $after =
  */
 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
                                                          $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
        get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
 }
@@ -634,18 +596,20 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />', $
  * Gets the auto_toggle setting.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated No alternative function available
  *
  * @param int $id The category to get. If no category supplied uses 0
  * @return int Only returns 0.
  */
 function get_autotoggle($id = 0) {
-       _deprecated_function(__FUNCTION__, '0.0' );
+       _deprecated_function( __FUNCTION__, '2.1' );
        return 0;
 }
 
 /**
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use wp_list_categories()
  * @see wp_list_categories()
  *
@@ -672,7 +636,7 @@ function get_autotoggle($id = 0) {
 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
                                   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
                                   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
 
        $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
                'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
@@ -681,6 +645,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
 
 /**
  * @since 1.2
+ * @deprecated 2.1
  * @deprecated Use wp_list_categories()
  * @see wp_list_categories()
  *
@@ -688,7 +653,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
  * @return unknown
  */
 function wp_list_cats($args = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
 
        $r = wp_parse_args( $args );
 
@@ -712,6 +677,7 @@ function wp_list_cats($args = '') {
 
 /**
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use wp_dropdown_categories()
  * @see wp_dropdown_categories()
  *
@@ -730,7 +696,7 @@ function wp_list_cats($args = '') {
 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
                $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
                $selected = 0, $exclude = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_dropdown_categories()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_dropdown_categories()' );
 
        $show_option_all = '';
        if ( $optionall )
@@ -746,19 +712,9 @@ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = '
        return wp_dropdown_categories($query);
 }
 
-/**
- * @since 2.1
- * @deprecated Use wp_tiny_mce().
- * @see wp_tiny_mce()
- */
-function tinymce_include() {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_tiny_mce()');
-
-       wp_tiny_mce();
-}
-
 /**
  * @since 1.2
+ * @deprecated 2.1
  * @deprecated Use wp_list_authors()
  * @see wp_list_authors()
  *
@@ -771,7 +727,7 @@ function tinymce_include() {
  * @return unknown
  */
 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_authors()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_list_authors()' );
 
        $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
        return wp_list_authors($args);
@@ -779,6 +735,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
 
 /**
  * @since 1.0.1
+ * @deprecated 2.1
  * @deprecated Use wp_get_post_categories()
  * @see wp_get_post_categories()
  *
@@ -787,7 +744,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
  * @return unknown
  */
 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_get_post_categories()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_get_post_categories()' );
        return wp_get_post_categories($post_ID);
 }
 
@@ -795,6 +752,7 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) {
  * Sets the categories that the post id belongs to.
  *
  * @since 1.0.1
+ * @deprecated 2.1
  * @deprecated Use wp_set_post_categories()
  * @see wp_set_post_categories()
  *
@@ -804,12 +762,13 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) {
  * @return unknown
  */
 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_set_post_categories()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_set_post_categories()' );
        return wp_set_post_categories($post_ID, $post_categories);
 }
 
 /**
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use wp_get_archives()
  * @see wp_get_archives()
  *
@@ -822,7 +781,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
  * @return unknown
  */
 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_get_archives()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_get_archives()' );
        $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
        return wp_get_archives($args);
 }
@@ -831,6 +790,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
  * Returns or Prints link to the author's posts.
  *
  * @since 1.2
+ * @deprecated 2.1
  * @deprecated Use get_author_posts_url()
  * @see get_author_posts_url()
  *
@@ -840,7 +800,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
  * @return string|null
  */
 function get_author_link($echo = false, $author_id, $author_nicename = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_author_posts_url()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' );
 
        $link = get_author_posts_url($author_id, $author_nicename);
 
@@ -853,6 +813,7 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
  * Print list of pages based on arguments.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use wp_link_pages()
  * @see wp_link_pages()
  *
@@ -867,7 +828,7 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
  */
 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
                                        $pagelink='%', $more_file='') {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()');
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_link_pages()' );
 
        $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
        return wp_link_pages($args);
@@ -877,6 +838,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
  * Get value based on option.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use get_option()
  * @see get_option()
  *
@@ -884,7 +846,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
  * @return string
  */
 function get_settings($option) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_option()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_option()' );
 
        return get_option($option);
 }
@@ -893,11 +855,12 @@ function get_settings($option) {
  * Print the permalink of the current post in the loop.
  *
  * @since 0.71
+ * @deprecated 1.2
  * @deprecated Use the_permalink()
  * @see the_permalink()
  */
 function permalink_link() {
-       _deprecated_function(__FUNCTION__, '0.0', 'the_permalink()');
+       _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );
        the_permalink();
 }
 
@@ -905,13 +868,14 @@ function permalink_link() {
  * Print the permalink to the RSS feed.
  *
  * @since 0.71
+ * @deprecated 2.3
  * @deprecated Use the_permalink_rss()
  * @see the_permalink_rss()
  *
  * @param string $file
  */
 function permalink_single_rss($deprecated = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'the_permalink_rss()');
+       _deprecated_function( __FUNCTION__, '0.0', 'the_permalink_rss()' );
        the_permalink_rss();
 }
 
@@ -920,14 +884,15 @@ function permalink_single_rss($deprecated = '') {
  *
  * @see get_links() for argument information that can be used in $args
  * @since 1.0.1
- * @deprecated Use get_bookmarks()
- * @see get_bookmarks()
+ * @deprecated 2.1
+ * @deprecated Use wp_list_bookmarks()
+ * @see wp_list_bookmarks()
  *
  * @param string $args a query string
  * @return null|string
  */
 function wp_get_links($args = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
+       _deprecated_function( __FUNCTION__, '0.0', 'wp_list_bookmarks()' );
 
        if ( strpos( $args, '=' ) === false ) {
                $cat_id = $args;
@@ -935,24 +900,31 @@ function wp_get_links($args = '') {
        }
 
        $defaults = array(
-               'category' => -1, 'before' => '',
-               'after' => '<br />', 'between' => ' ',
-               'show_images' => true, 'orderby' => 'name',
-               'show_description' => true, 'show_rating' => false,
-               'limit' => -1, 'show_updated' => true,
-               'echo' => true
+               'after' => '<br />',
+               'before' => '',
+               'between' => ' ',
+               'categorize' => 0,
+               'category' => '',
+               'echo' => true,
+               'limit' => -1,
+               'orderby' => 'name',
+               'show_description' => true,
+               'show_images' => true,
+               'show_rating' => false,
+               'show_updated' => true,
+               'title_li' => '',
        );
 
        $r = wp_parse_args( $args, $defaults );
-       extract( $r, EXTR_SKIP );
 
-       return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo);
+       return wp_list_bookmarks($r);
 }
 
 /**
  * Gets the links associated with category by id.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use get_bookmarks()
  * @see get_bookmarks()
  *
@@ -975,7 +947,7 @@ function wp_get_links($args = '') {
  */
 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
                        $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
 
        $order = 'ASC';
        if ( substr($orderby, 0, 1) == '_' ) {
@@ -986,7 +958,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
        if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
                $category = '';
 
-       $results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit");
+       $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
 
        if ( !$results )
                return;
@@ -1060,16 +1032,15 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
  * 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
+ * @deprecated 2.1
  * @deprecated Use wp_list_bookmarks()
  * @see wp_list_bookmarks()
  *
  * @param string $order Sort link categories by 'name' or 'id'
- * @param string $$deprecated Not Used
  */
-function get_links_list($order = 'name', $deprecated = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
+function get_links_list($order = 'name') {
+       _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
 
        $order = strtolower($order);
 
@@ -1083,7 +1054,7 @@ function get_links_list($order = 'name', $deprecated = '') {
        if ( !isset($direction) )
                $direction = '';
 
-       $cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");
+       $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
 
        // Display each category
        if ( $cats ) {
@@ -1104,10 +1075,8 @@ function get_links_list($order = 'name', $deprecated = '') {
 /**
  * Show the link to the links popup and the number of links.
  *
- * @author Fullo
- * @link http://sprite.csr.unibo.it/fullo/
- *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated {@internal Use function instead is unknown}}
  *
  * @param string $text the text of the link
@@ -1117,7 +1086,7 @@ function get_links_list($order = 'name', $deprecated = '') {
  * @param bool $count the number of links in the db
  */
 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
-       _deprecated_function(__FUNCTION__, '0.0' );
+       _deprecated_function( __FUNCTION__, '2.1' );
 
        if ( $count )
                $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
@@ -1134,6 +1103,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400, $file='lin
 
 /**
  * @since 1.0.1
+ * @deprecated 2.1
  * @deprecated Use sanitize_bookmark_field()
  * @see sanitize_bookmark_field()
  *
@@ -1141,7 +1111,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400, $file='lin
  * @return unknown
  */
 function get_linkrating($link) {
-       _deprecated_function(__FUNCTION__, '0.0', 'sanitize_bookmark_field()');
+       _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' );
        return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
 }
 
@@ -1149,6 +1119,7 @@ function get_linkrating($link) {
  * Gets the name of category by id.
  *
  * @since 0.71
+ * @deprecated 2.1
  * @deprecated Use get_category()
  * @see get_category()
  *
@@ -1156,7 +1127,7 @@ function get_linkrating($link) {
  * @return string
  */
 function get_linkcatname($id = 0) {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_category()');
+       _deprecated_function( __FUNCTION__, '2.1', 'get_category()' );
 
        $id = (int) $id;
 
@@ -1178,14 +1149,14 @@ function get_linkcatname($id = 0) {
  * Print RSS comment feed link.
  *
  * @since 1.0.1
+ * @deprecated 2.5
  * @deprecated Use post_comments_feed_link()
  * @see post_comments_feed_link()
  *
  * @param string $link_text
- * @param string $deprecated Not used
  */
-function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'post_comments_feed_link()');
+function comments_rss_link($link_text = 'Comments RSS') {
+       _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' );
        post_comments_feed_link($link_text);
 }
 
@@ -1193,16 +1164,16 @@ function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') {
  * Print/Return link to category RSS2 feed.
  *
  * @since 1.2
+ * @deprecated 2.5
  * @deprecated Use get_category_feed_link()
  * @see get_category_feed_link()
  *
  * @param bool $echo
  * @param int $cat_ID
- * @param string $deprecated Not used
  * @return string|null
  */
-function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_category_feed_link()');
+function get_category_rss_link($echo = false, $cat_ID = 1) {
+       _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' );
 
        $link = get_category_feed_link($cat_ID, 'rss2');
 
@@ -1215,16 +1186,16 @@ function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') {
  * Print/Return link to author RSS feed.
  *
  * @since 1.2
+ * @deprecated 2.5
  * @deprecated Use get_author_feed_link()
  * @see get_author_feed_link()
  *
  * @param bool $echo
  * @param int $author_id
- * @param string $deprecated Not used
  * @return string|null
  */
-function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') {
-       _deprecated_function(__FUNCTION__, '0.0', 'get_author_feed_link()');
+function get_author_rss_link($echo = false, $author_id = 1) {
+       _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' );
 
        $link = get_author_feed_link($author_id);
        if ( $echo )
@@ -1236,66 +1207,56 @@ function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') {
  * Return link to the post RSS feed.
  *
  * @since 1.5
+ * @deprecated 2.2
  * @deprecated Use get_post_comments_feed_link()
  * @see get_post_comments_feed_link()
  *
- * @param string $deprecated Not used
  * @return string
  */
-function comments_rss($deprecated = '') {
-       _deprecated_function(__FUNCTION__, '2.2', 'get_post_comments_feed_link()');
+function comments_rss() {
+       _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
        return get_post_comments_feed_link();
 }
 
 /**
  * An alias of wp_create_user().
  *
+ * @since 2.0
+ * @deprecated 2.0
+ * @deprecated Use wp_create_user()
+ * @see 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).
  * @return int The new user's ID.
- * @deprecated Use wp_create_user()
- * @see wp_create_user()
  */
 function create_user($username, $password, $email) {
        _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' );
        return wp_create_user($username, $password, $email);
 }
 
-/**
- * Unused Admin function.
- *
- * @since 2.0
- * @param string $deprecated Unknown
- * @deprecated 2.5
- */
-function documentation_link( $deprecated = '' ) {
-       _deprecated_function( __FUNCTION__, '2.5', '' );
-       return;
-}
-
 /**
  * Unused function.
  *
  * @deprecated 2.5
 */
 function gzip_compression() {
+       _deprecated_function( __FUNCTION__, '2.5' );
        return false;
 }
 
 /**
  * Retrieve an array of comment data about comment $comment_ID.
  *
+ * @since 0.71
+ * @deprecated 2.7
  * @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
+ * @param int $no_cache Whether to use the cache (cast to bool)
+ * @param bool $include_unapproved Whether to include unapproved comments
  * @return array The comment data
  */
 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
@@ -1307,14 +1268,15 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
  * Retrieve the category name by the category ID.
  *
  * @since 0.71
+ * @deprecated 2.8
  * @deprecated Use get_cat_name()
- * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
+ * @see get_cat_name()
  *
  * @param int $cat_ID Category ID
  * @return string category name
  */
 function get_catname( $cat_ID ) {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_cat_name()');
+       _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' );
        return get_cat_name( $cat_ID );
 }
 
@@ -1322,6 +1284,9 @@ function get_catname( $cat_ID ) {
  * Retrieve category children list separated before and after the term IDs.
  *
  * @since 1.2.0
+ * @deprecated 2.8
+ * @deprecated Use get_term_children()
+ * @see get_term_children()
  *
  * @param int $id Category ID to retrieve children.
  * @param string $before Optional. Prepend before category term ID.
@@ -1330,7 +1295,7 @@ function get_catname( $cat_ID ) {
  * @return string
  */
 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_term_children()');
+       _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' );
        if ( 0 == $id )
                return '';
 
@@ -1358,25 +1323,26 @@ function get_category_children( $id, $before = '/', $after = '', $visited = arra
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
- * @return string The author's description.
  * @deprecated Use the_author_meta('description')
+ * @see get_the_author_meta()
+ *
+ * @return string The author's description.
  */
 function get_the_author_description() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
        return get_the_author_meta('description');
 }
 
 /**
  * Display the description of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_description
  * @since 1.0.0
  * @deprecated 2.8
  * @deprecated Use the_author_meta('description')
+ * @see the_author_meta()
  */
 function the_author_description() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
        the_author_meta('description');
 }
 
@@ -1385,25 +1351,26 @@ function the_author_description() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
- * @return string The author's login name (username).
  * @deprecated Use the_author_meta('login')
+ * @see get_the_author_meta()
+ *
+ * @return string The author's login name (username).
  */
 function get_the_author_login() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
        return get_the_author_meta('login');
 }
 
 /**
  * Display the login name of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_login
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('login')
+ * @see the_author_meta()
  */
 function the_author_login() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
        the_author_meta('login');
 }
 
@@ -1412,25 +1379,26 @@ function the_author_login() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
- * @return string The author's first name.
  * @deprecated Use the_author_meta('first_name')
+ * @see get_the_author_meta()
+ *
+ * @return string The author's first name.
  */
 function get_the_author_firstname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
        return get_the_author_meta('first_name');
 }
 
 /**
  * Display the first name of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('first_name')
+ * @see the_author_meta()
  */
 function the_author_firstname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
        the_author_meta('first_name');
 }
 
@@ -1439,25 +1407,26 @@ function the_author_firstname() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('last_name')
+ * @see get_the_author_meta()
+ *
  * @return string The author's last name.
- * @deprecated Use the_author_meta('last_name')
  */
 function get_the_author_lastname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
        return get_the_author_meta('last_name');
 }
 
 /**
  * Display the last name of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('last_name')
+ * @see the_author_meta()
  */
 function the_author_lastname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
        the_author_meta('last_name');
 }
 
@@ -1466,25 +1435,26 @@ function the_author_lastname() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('nickname')
+ * @see get_the_author_meta()
+ *
  * @return string The author's nickname.
- * @deprecated Use the_author_meta('nickname')
  */
 function get_the_author_nickname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
        return get_the_author_meta('nickname');
 }
 
 /**
  * Display the nickname of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('nickname')
+ * @see the_author_meta()
  */
 function the_author_nickname() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
        the_author_meta('nickname');
 }
 
@@ -1493,25 +1463,26 @@ function the_author_nickname() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('email')
+ * @see get_the_author_meta()
+ *
  * @return string The author's username.
- * @deprecated Use the_author_meta('email')
  */
 function get_the_author_email() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
        return get_the_author_meta('email');
 }
 
 /**
  * Display the email of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_email
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('email')
+ * @see the_author_meta()
  */
 function the_author_email() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
        the_author_meta('email');
 }
 
@@ -1520,26 +1491,26 @@ function the_author_email() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('icq')
+ * @see get_the_author_meta()
+ *
  * @return string The author's ICQ number.
- * @deprecated Use the_author_meta('icq')
  */
 function get_the_author_icq() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
        return get_the_author_meta('icq');
 }
 
 /**
  * Display the ICQ number of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_icq
  * @since 0.71
  * @deprecated 2.8
- * @see get_the_author_icq()
  * @deprecated Use the_author_meta('icq')
+ * @see the_author_meta()
  */
 function the_author_icq() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
        the_author_meta('icq');
 }
 
@@ -1548,25 +1519,26 @@ function the_author_icq() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('yim')
+ * @see get_the_author_meta()
+ *
  * @return string The author's Yahoo! IM name.
- * @deprecated Use the_author_meta('yim')
  */
 function get_the_author_yim() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
        return get_the_author_meta('yim');
 }
 
 /**
  * Display the Yahoo! IM name of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_yim
  * @since 0.71
  * @deprecated 2.8
  * @deprecated Use the_author_meta('yim')
+ * @see the_author_meta()
  */
 function the_author_yim() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
        the_author_meta('yim');
 }
 
@@ -1575,26 +1547,26 @@ function the_author_yim() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('msn')
+ * @see get_the_author_meta()
+ *
  * @return string The author's MSN address.
- * @deprecated Use the_author_meta('msn')
  */
 function get_the_author_msn() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
        return get_the_author_meta('msn');
 }
 
 /**
  * Display the MSN address of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_msn
  * @since 0.71
  * @deprecated 2.8
- * @see get_the_author_msn()
  * @deprecated Use the_author_meta('msn')
+ * @see the_author_meta()
  */
 function the_author_msn() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
        the_author_meta('msn');
 }
 
@@ -1603,26 +1575,26 @@ function the_author_msn() {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('aim')
+ * @see get_the_author_meta()
+ *
  * @return string The author's AIM address.
- * @deprecated Use the_author_meta('aim')
  */
 function get_the_author_aim() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
        return get_the_author_meta('aim');
 }
 
 /**
  * Display the AIM address of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_aim
  * @since 0.71
+ * @see the_author_meta()
  * @deprecated 2.8
- * @see get_the_author_aim()
  * @deprecated Use the_author_meta('aim')
  */
 function the_author_aim() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
        the_author_meta('aim');
 }
 
@@ -1631,12 +1603,14 @@ function the_author_aim() {
  *
  * @since 1.0.0
  * @deprecated 2.8
+ * @deprecated Use get_the_author_meta('display_name')
+ * @see get_the_author_meta()
+ *
  * @param int $auth_id The ID of the author.
  * @return string The author's display name.
- * @deprecated Use the_author_meta('display_name')
  */
 function get_author_name( $auth_id = false ) {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
        return get_the_author_meta('display_name', $auth_id);
 }
 
@@ -1645,23 +1619,26 @@ function get_author_name( $auth_id = false ) {
  *
  * @since 1.5
  * @deprecated 2.8
- * @uses $authordata The current author's DB object.
+ * @deprecated Use get_the_author_meta('url')
+ * @see get_the_author_meta()
+ *
  * @return string The URL to the author's page.
  */
 function get_the_author_url() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
        return get_the_author_meta('url');
 }
 
 /**
  * Display the URL to the home page of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_url
  * @since 0.71
  * @deprecated 2.8
+ * @deprecated Use the_author_meta('url')
+ * @see the_author_meta()
  */
 function the_author_url() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
        the_author_meta('url');
 }
 
@@ -1670,23 +1647,26 @@ function the_author_url() {
  *
  * @since 1.5
  * @deprecated 2.8
+ * @deprecated Use get_the_author_meta('ID')
+ * @see get_the_author_meta()
+ *
  * @return int The author's ID.
  */
 function get_the_author_ID() {
-       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
        return get_the_author_meta('ID');
 }
 
 /**
  * Display the ID of the author of the current post.
  *
- * @link http://codex.wordpress.org/Template_Tags/the_author_ID
  * @since 0.71
  * @deprecated 2.8
- * @uses get_the_author_ID()
+ * @deprecated Use the_author_meta('ID')
+ * @see the_author_meta()
 */
 function the_author_ID() {
-       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
+       _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
        the_author_meta('ID');
 }
 
@@ -1715,6 +1695,8 @@ function the_author_ID() {
  *             parameters.
  *
  * @deprecated 2.9.0
+ * @deprecated Use the_content_feed()
+ * @see the_content_feed()
  *
  * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
  * @param int|bool $stripteaser Optional. Default is 0.
@@ -1723,7 +1705,7 @@ function the_author_ID() {
  * @param int $encode_html Optional. How to encode the content.
  */
 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
-       _deprecated_function(__FUNCTION__, '2.9', 'the_content_feed' );
+       _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' );
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content_rss', $content);
        if ( $cut && !$encode_html )
@@ -1769,7 +1751,7 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
  * @return string HTML stripped out of content with links at the bottom.
  */
 function make_url_footnote( $content ) {
-       _deprecated_function(__FUNCTION__, '2.9', '' );
+       _deprecated_function( __FUNCTION__, '2.9', '' );
        preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
        $links_summary = "\n";
        for ( $i=0; $i<count($matches[0]); $i++ ) {
@@ -1801,13 +1783,767 @@ function make_url_footnote( $content ) {
  *
  * @since 2.2.0
  * @deprecated 2.9.0
+ * @deprecated Use _x()
+ * @see _x()
  *
  * @param string $text Text to translate
  * @param string $domain Optional. Domain to retrieve the translated text
  * @return string Translated context string without pipe
  */
 function _c( $text, $domain = 'default' ) {
-       _deprecated_function(__FUNCTION__, '2.9', '_x' );
-       return translate_with_context( $text, $domain );
+       _deprecated_function( __FUNCTION__, '2.9', '_x()' );
+       return before_last_bar( translate( $text, $domain ) );
+}
+
+/**
+ * Translates $text like translate(), but assumes that the text
+ * contains a context after its last vertical bar.
+ *
+ * @since 2.5
+ * @uses translate()
+ * @deprecated 3.0.0
+ * @deprecated Use _x()
+ * @see _x()
+ *
+ * @param string $text Text to translate
+ * @param string $domain Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function translate_with_context( $text, $domain = 'default' ) {
+       _deprecated_function( __FUNCTION__, '2.9', '_x()' );
+       return before_last_bar( translate( $text, $domain ) );
+}
+
+/**
+ * A version of _n(), which supports contexts.
+ * Strips everything from the translation after the last bar.
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use _nx()
+ * @see _nx()
+ * @see _n() For parameters.
+ * @see _c() For parameters. _c() is deprecated.
+ *
+ */
+function _nc( $single, $plural, $number, $domain = 'default' ) {
+       _deprecated_function( __FUNCTION__, '2.9', '_nx()' );
+       return before_last_bar( _n( $single, $plural, $number, $domain ) );
+}
+
+/**
+ * Retrieve the plural or single form based on the amount.
+ *
+ * @since 1.2.0
+ * @deprecated 2.8.0
+ * @deprecated Use _n()
+ * @see _n()
+ */
+function __ngettext() {
+       _deprecated_function( __FUNCTION__, '2.8', '_n()' );
+       $args = func_get_args();
+       return call_user_func_array('_n', $args);
+}
+
+/**
+ * Register plural strings in POT file, but don't translate them.
+ *
+ * @since 2.5
+ * @deprecated 2.8.0
+ * @deprecated Use _n_noop()
+ * @see _n_noop()
+ */
+function __ngettext_noop() {
+       _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
+       $args = func_get_args();
+       return call_user_func_array('_n_noop', $args);
+
+}
+
+/**
+ * Retrieve all autoload options, or all options if no autoloaded ones exist.
+ *
+ * @since 1.0.0
+ * @deprecated 3.0.0
+ * @deprecated Use wp_load_alloptions())
+ * @see wp_load_alloptions()
+ *
+ * @return array List of all options.
+ */
+function get_alloptions() {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' );
+       return wp_load_alloptions();
+}
+
+/**
+ * Retrieve HTML content of attachment image with link.
+ *
+ * @since 2.0.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_get_attachment_link()
+ * @see wp_get_attachment_link()
+ *
+ * @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) {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' );
+       $id = (int) $id;
+       $_post = & get_post($id);
+
+       if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
+               return __('Missing Attachment');
+
+       if ( $permalink )
+               $url = get_attachment_link($_post->ID);
+
+       $post_title = esc_attr($_post->post_title);
+
+       $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
+       return "<a href='$url' title='$post_title'>$innerHTML</a>";
+}
+
+/**
+ * Retrieve icon URL and Path.
+ *
+ * @since 2.1.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_get_attachment_image_src()
+ * @see wp_get_attachment_image_src()
+ *
+ * @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 ) {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' );
+       $id = (int) $id;
+       if ( !$post = & get_post($id) )
+               return false;
+
+       $file = get_attached_file( $post->ID );
+
+       if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
+               // We have a thumbnail desired, specified and existing
+
+               $src_file = basename($src);
+               $class = 'attachmentthumb';
+       } elseif ( wp_attachment_is_image( $post->ID ) ) {
+               // We have an image without a thumbnail
+
+               $src = wp_get_attachment_url( $post->ID );
+               $src_file = & $file;
+               $class = 'attachmentimage';
+       } elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
+               // No thumb, no image. We'll look for a mime-related icon instead.
+
+               $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
+               $src_file = $icon_dir . '/' . basename($src);
+       }
+
+       if ( !isset($src) || !$src )
+               return false;
+
+       return array($src, $src_file);
+}
+
+/**
+ * Retrieve HTML content of icon attachment image element.
+ *
+ * @since 2.0.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_get_attachment_image()
+ * @see wp_get_attachment_image()
+ *
+ * @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 ) {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
+       $id = (int) $id;
+       if ( !$post = & get_post($id) )
+               return false;
+
+       if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
+               return false;
+
+       list($src, $src_file) = $src;
+
+       // Do we need to constrain the image?
+       if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
+
+               $imagesize = getimagesize($src_file);
+
+               if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
+                       $actual_aspect = $imagesize[0] / $imagesize[1];
+                       $desired_aspect = $max_dims[0] / $max_dims[1];
+
+                       if ( $actual_aspect >= $desired_aspect ) {
+                               $height = $actual_aspect * $max_dims[0];
+                               $constraint = "width='{$max_dims[0]}' ";
+                               $post->iconsize = array($max_dims[0], $height);
+                       } else {
+                               $width = $max_dims[1] / $actual_aspect;
+                               $constraint = "height='{$max_dims[1]}' ";
+                               $post->iconsize = array($width, $max_dims[1]);
+                       }
+               } else {
+                       $post->iconsize = array($imagesize[0], $imagesize[1]);
+                       $constraint = '';
+               }
+       } else {
+               $constraint = '';
+       }
+
+       $post_title = esc_attr($post->post_title);
+
+       $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
+
+       return apply_filters( 'attachment_icon', $icon, $post->ID );
+}
+
+/**
+ * Retrieve HTML content of image element.
+ *
+ * @since 2.0.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_get_attachment_image()
+ * @see wp_get_attachment_image()
+ *
+ * @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) {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
+       $id = (int) $id;
+       if ( !$post = & get_post($id) )
+               return false;
+
+       if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
+               return $innerHTML;
+
+
+       $innerHTML = esc_attr($post->post_title);
+
+       return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
+}
+
+/*
+ * Retrieve bookmark data based on ID.
+ *
+ * @since 2.0.0
+ * @deprecated 2.1.0
+ * @deprecated Use get_bookmark()
+ * @see get_bookmark()
+ *
+ * @param int $bookmark_id ID of link
+ * @param string $output OBJECT, ARRAY_N, or ARRAY_A
+ * @return object|array
+ */
+function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
+       _deprecated_function( __FUNCTION__, '2.1', 'get_bookmark()' );
+       return get_bookmark($bookmark_id, $output, $filter);
+}
+
+/**
+ * Performs esc_url() for database or redirect usage.
+ *
+ * @since 2.3.1
+ * @deprecated 2.8.0
+ * @deprecated Use esc_url_raw()
+ * @see esc_url_raw()
+ *
+ * @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 ) {
+       _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' );
+       return esc_url_raw( $url, $protocols );
+}
+
+/**
+ * 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
+ * @deprecated 3.0.0
+ * @deprecated Use esc_url()
+ * @see Alias for esc_url()
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols Optional. An array of acceptable protocols.
+ * @param string $context Optional. How the URL will be used. Default is 'display'.
+ * @return string The cleaned $url after the 'clean_url' filter is applied.
+ */
+function clean_url( $url, $protocols = null, $context = 'display' ) {
+       if ( $context == 'db' )
+               _deprecated_function( 'clean_url( $context = \'db\' )', '3.0', 'esc_url_raw()' );
+       else
+               _deprecated_function( __FUNCTION__, '3.0', 'esc_url()' );
+       return esc_url( $url, $protocols, $context );
+}
+
+/**
+ * Escape single quotes, specialchar double quotes, and fix line endings.
+ *
+ * The filter 'js_escape' is also applied by esc_js()
+ *
+ * @since 2.0.4
+ * @deprecated 2.8.0
+ * @deprecated Use esc_js()
+ * @see esc_js()
+ *
+ * @param string $text The text to be escaped.
+ * @return string Escaped text.
+ */
+function js_escape( $text ) {
+       _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' );
+       return esc_js( $text );
+}
+
+/**
+ * Escaping for HTML blocks.
+ *
+ * @deprecated 2.8.0
+ * @deprecated Use esc_html()
+ * @see esc_html()
+ */
+function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
+       _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' );
+       if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
+               $args = func_get_args();
+               return call_user_func_array( '_wp_specialchars', $args );
+       } else {
+               return esc_html( $string );
+       }
+}
+
+
+/**
+ * Escaping for HTML attributes.
+ *
+ * @since 2.0.6
+ * @deprecated 2.8.0
+ * @deprecated Use esc_attr()
+ * @see esc_attr()
+ *
+ * @param string $text
+ * @return string
+ */
+function attribute_escape( $text ) {
+       _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' );
+       return esc_attr( $text );
+}
+
+/**
+ * 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
+ * @deprecated 2.8.0
+ * @deprecated Use wp_register_sidebar_widget()
+ * @see wp_register_sidebar_widget()
+ *
+ * @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 = '') {
+       _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' );
+       // Compat
+       if ( is_array($name) ) {
+               if ( count($name) == 3 )
+                       $name = sprintf($name[0], $name[2]);
+               else
+                       $name = $name[0];
+       }
+
+       $id = sanitize_title($name);
+       $options = array();
+       if ( !empty($classname) && is_string($classname) )
+               $options['classname'] = $classname;
+       $params = array_slice(func_get_args(), 2);
+       $args = array($id, $name, $output_callback, $options);
+       if ( !empty($params) )
+               $args = array_merge($args, $params);
+
+       call_user_func_array('wp_register_sidebar_widget', $args);
+}
+
+/**
+ * Alias of {@link wp_unregister_sidebar_widget()}.
+ *
+ * @since 2.2.0
+ * @deprecated 2.8.0
+ * @deprecated Use wp_unregister_sidebar_widget()
+ * @see wp_unregister_sidebar_widget()
+ *
+ * @param int|string $id Widget ID.
+ */
+function unregister_sidebar_widget($id) {
+       _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' );
+       return wp_unregister_sidebar_widget($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
+ * @deprecated 2.8.0
+ * @deprecated Use wp_register_widget_control()
+ * @see wp_register_widget_control()
+ *
+ * @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 = '') {
+       _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' );
+       // Compat
+       if ( is_array($name) ) {
+               if ( count($name) == 3 )
+                       $name = sprintf($name[0], $name[2]);
+               else
+                       $name = $name[0];
+       }
+
+       $id = sanitize_title($name);
+       $options = array();
+       if ( !empty($width) )
+               $options['width'] = $width;
+       if ( !empty($height) )
+               $options['height'] = $height;
+       $params = array_slice(func_get_args(), 4);
+       $args = array($id, $name, $control_callback, $options);
+       if ( !empty($params) )
+               $args = array_merge($args, $params);
+
+       call_user_func_array('wp_register_widget_control', $args);
+}
+
+/**
+ * Alias of {@link wp_unregister_widget_control()}.
+ *
+ * @since 2.2.0
+ * @deprecated 2.8.0
+ * @deprecated Use wp_unregister_widget_control()
+ * @see wp_unregister_widget_control()
+ *
+ * @param int|string $id Widget ID.
+ */
+function unregister_widget_control($id) {
+       _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' );
+       return wp_unregister_widget_control($id);
+}
+
+/**
+ * Remove user meta data.
+ *
+ * @since 2.0.0
+ * @deprecated 3.0.0
+ * @deprecated Use delete_user_meta()
+ * @see delete_user_meta()
+ *
+ * @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 = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'delete_user_meta()' );
+       global $wpdb;
+       if ( !is_numeric( $user_id ) )
+               return false;
+       $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+       if ( is_array($meta_value) || is_object($meta_value) )
+               $meta_value = serialize($meta_value);
+       $meta_value = trim( $meta_value );
+
+       $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
+
+       if ( $cur && $cur->umeta_id )
+               do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $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", $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) );
+
+       wp_cache_delete($user_id, 'users');
+
+       if ( $cur && $cur->umeta_id )
+               do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
+
+       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
+ * @deprecated 3.0.0
+ * @deprecated Use get_user_meta()
+ * @see get_user_meta()
+ *
+ * @param int $user_id User ID
+ * @param string $meta_key Optional. Metadata key.
+ * @return mixed
+ */
+function get_usermeta( $user_id, $meta_key = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' );
+       global $wpdb;
+       $user_id = (int) $user_id;
+
+       if ( !$user_id )
+               return false;
+
+       if ( !empty($meta_key) ) {
+               $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+               $user = wp_cache_get($user_id, 'users');
+               // Check the cached user object
+               if ( false !== $user && isset($user->$meta_key) )
+                       $metas = array($user->$meta_key);
+               else
+                       $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
+       } else {
+               $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
+       }
+
+       if ( empty($metas) ) {
+               if ( empty($meta_key) )
+                       return array();
+               else
+                       return '';
+       }
+
+       $metas = array_map('maybe_unserialize', $metas);
+
+       if ( count($metas) == 1 )
+               return $metas[0];
+       else
+               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
+ * @deprecated 3.0.0
+ * @deprecated Use update_user_meta()
+ * @see update_user_meta()
+ *
+ * @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 ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'update_user_meta()' );
+       global $wpdb;
+       if ( !is_numeric( $user_id ) )
+               return false;
+       $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+       /** @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 (empty($meta_value)) {
+               return delete_usermeta($user_id, $meta_key);
+       }
+
+       $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
+
+       if ( $cur )
+               do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
+
+       if ( !$cur )
+               $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
+       else if ( $cur->meta_value != $meta_value )
+               $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
+       else
+               return false;
+
+       wp_cache_delete($user_id, 'users');
+
+       if ( !$cur )
+               do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
+       else
+               do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
+
+       return true;
+}
+
+/**
+ * Enable/disable automatic general feed link outputting.
+ *
+ * @since 2.8.0
+ * @deprecated 3.0.0
+ * @deprecated Use add_theme_support( 'automatic-feed-links' )
+ *
+ * @param boolean $add Optional, default is true. Add or remove links. Defaults to true.
+ */
+function automatic_feed_links( $add = true ) {
+       _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" );
+
+       if ( $add )
+               add_theme_support( 'automatic-feed-links' );
+       else
+               remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
+}
+
+/**
+ * Retrieve user data based on field.
+ *
+ * @since 1.5.0
+ * @deprecated 3.0.0
+ * @deprecated Use get_the_author_meta()
+ * @see get_the_author_meta()
+ */
+function get_profile( $field, $user = false ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'get_the_author_meta()' );
+       if ( $user ) {
+               $user = get_user_by( 'login', $user );
+               $user = $user->ID;
+       }
+       return get_the_author_meta( $field, $user );
+}
+
+/**
+ * Number of posts user has written.
+ *
+ * @since 0.71
+ * @deprecated 3.0.0
+ * @deprecated Use count_user_posts()
+ * @see count_user_posts()
+ */
+function get_usernumposts( $userid ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'count_user_posts()' );
+       return count_user_posts( $userid );
+}
+
+/**
+ * Callback used to change %uXXXX to &#YYY; syntax
+ *
+ * @since 2.8.0
+ * @access private
+ * @deprecated 3.0.0
+ *
+ * @param array $matches Single Match
+ * @return string An HTML entity
+ */
+function funky_javascript_callback($matches) {
+       return "&#".base_convert($matches[1],16,10).";";
+}
+
+/**
+ * Fixes javascript bugs in browsers.
+ *
+ * Converts unicode characters to HTML numbered entities.
+ *
+ * @since 1.5.0
+ * @uses $is_macIE
+ * @uses $is_winIE
+ * @deprecated 3.0.0
+ *
+ * @param string $text Text to be made safe.
+ * @return string Fixed text.
+ */
+function funky_javascript_fix($text) {
+       _deprecated_function( __FUNCTION__, '3.0' );
+       // Fixes for browsers' javascript bugs
+       global $is_macIE, $is_winIE;
+
+       if ( $is_winIE || $is_macIE )
+               $text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
+                                       "funky_javascript_callback",
+                                       $text);
+
+       return $text;
+}
+
+/**
+ * Generates and displays the RDF for the trackback information of current post.
+ *
+ * @since 0.71
+ * @deprecated 3.0.0
+ *
+ * @param int $deprecated Not used (Was $timezone = 0)
+ */
+function trackback_rdf($deprecated = '') {
+       _deprecated_function( __FUNCTION__, '3.0' );
+       return '';
+}
+
+/**
+ * Checks that the taxonomy name exists.
+ *
+ * @since 2.3.0
+ * @deprecated 3.0.0
+ * @deprecated Use taxonomy_exists()
+ * @see taxonomy_exists()
+ *
+ * @param string $taxonomy Name of taxonomy object
+ * @return bool Whether the taxonomy exists.
+ */
+function is_taxonomy( $taxonomy ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'taxonomy_exists()' );
+       return taxonomy_exists( $taxonomy );
+}
+
+/**
+ * Check if Term exists.
+ *
+ * @since 2.3.0
+ * @deprecated 3.0.0
+ * @deprecated Use term_exists()
+ * @see term_exists()
+ *
+ * @param int|string $term The term to check
+ * @param string $taxonomy The taxonomy name to use
+ * @param int $parent ID of parent term under which to confine the exists search.
+ * @return mixed Get the term id or Term Object, if exists.
+ */
+function is_term( $term, $taxonomy = '', $parent = 0 ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'term_exists()' );
+       return term_exists( $term, $taxonomy, $parent );
 }
-?>
\ No newline at end of file
index 7f7e6f511a4c4e636284f17ce8bd29a6450114af..e4a39d80bd9f0f14335cb1dbf33453b44f92f7c9 100644 (file)
@@ -16,27 +16,26 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
 >
        <title type="text"><?php
                if ( is_singular() )
-                       printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
+                       printf(ent2ncr(__('Comments on %s')), get_the_title_rss());
                elseif ( is_search() )
-                       printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), esc_attr(get_search_query()));
+                       printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), get_search_query() );
                else
                        printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
 
        <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
-       <?php the_generator( 'atom' ); ?>
 
 <?php if ( is_singular() ) { ?>
-       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link(); ?>" />
+       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
        <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
 <?php } elseif(is_search()) { ?>
-       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . esc_attr(get_search_query()); ?>" />
+       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
 <?php } else { ?>
-       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" />
+       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
        <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
        <id><?php bloginfo_rss('comments_atom_url'); ?></id>
 <?php } ?>
@@ -74,7 +73,7 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
 <?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'); ?>" />
+               <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
index da3eeb467d811799f1fc0af4999f435c27de7527..b23dffcd9b2403ae26fa7e89ce6f3c5cfa9e4a21 100644 (file)
@@ -13,16 +13,15 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:thr="http://purl.org/syndication/thread/1.0"
   xml:lang="<?php echo get_option('rss_language'); ?>"
-  xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php"
+  xml:base="<?php bloginfo_rss('url') ?>/wp-atom.php"
   <?php do_action('atom_ns'); ?>
  >
        <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
        <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 
        <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
-       <?php the_generator( 'atom' ); ?>
 
-       <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
+       <link rel="alternate" type="text/html" href="<?php bloginfo_rss('url') ?>" />
        <id><?php bloginfo('atom_url'); ?></id>
        <link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
 
@@ -37,7 +36,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
                </author>
                <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
                <link rel="alternate" type="text/html" href="<?php the_permalink_rss() ?>" />
-               <id><?php the_guid(); ?></id>
+               <id><?php the_guid() ; ?></id>
                <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
                <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
                <?php the_category_rss('atom') ?>
index 946f370a5189bb03c449f04c4b5ddf809ce8c963..3a0daf1fd63a7181e70c37c039d172d97a314b11 100644 (file)
@@ -23,9 +23,8 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss('description') ?></description>
        <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
-       <?php the_generator( 'rdf' ); ?>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
-       <sy:updateFrequency>1</sy:updateFrequency>
+       <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
        <?php do_action('rdf_header'); ?>
        <items>
index 90eeab05e1ff0f252fe988ea6bb3854f56f1da72..b26897d3e62973b15aa0a74ea6936938e8ce9d7c 100644 (file)
@@ -9,7 +9,6 @@ header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_opt
 $more = 1;
 
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-<?php the_generator( 'comment' ); ?>
 <rss version="0.92">
 <channel>
        <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
index 8232a0f1743a44d58e959cc7830143cb386fb36e..74715b80e1a91947af1226f81944a747bf893d7d 100644 (file)
@@ -29,7 +29,6 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
        <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
        <description><?php bloginfo_rss("description") ?></description>
        <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
-       <?php the_generator( 'rss2' ); ?>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <?php do_action('commentsrss2_head'); ?>
index 12286da287a61a710a18990f9683e21665f26f80..538f96b72755cfc208597992e98b2390505ae5d7 100644 (file)
@@ -26,7 +26,6 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss("description") ?></description>
        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
-       <?php the_generator( 'rss2' ); ?>
        <language><?php echo get_option('rss_language'); ?></language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
@@ -35,7 +34,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
        <item>
                <title><?php the_title_rss() ?></title>
                <link><?php the_permalink_rss() ?></link>
-               <comments><?php comments_link(); ?></comments>
+               <comments><?php comments_link_feed(); ?></comments>
                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
                <dc:creator><?php the_author() ?></dc:creator>
                <?php the_category_rss() ?>
@@ -51,7 +50,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
                <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
        <?php endif; ?>
 <?php endif; ?>
-               <wfw:commentRss><?php echo get_post_comments_feed_link(null, 'rss2'); ?></wfw:commentRss>
+               <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
                <slash:comments><?php echo get_comments_number(); ?></slash:comments>
 <?php rss_enclosure(); ?>
        <?php do_action('rss2_item'); ?>
index ebd392b116332a014acfb05c12ce6d093f5cc7b5..1be12a45293f7f7096d388e482590f1642372272 100644 (file)
@@ -186,7 +186,17 @@ function the_excerpt_rss() {
  * @uses apply_filters() Call 'the_permalink_rss' on the post permalink
  */
 function the_permalink_rss() {
-       echo apply_filters('the_permalink_rss', get_permalink());
+       echo esc_url( apply_filters('the_permalink_rss', get_permalink() ));
+}
+
+/**
+ * Outputs the link to the comments for the current post in an xml safe way
+ *
+ * @since 3.0.0
+ * @return none
+ */
+function comments_link_feed() {
+       echo esc_url( get_comments_link() );
 }
 
 /**
@@ -199,7 +209,7 @@ function the_permalink_rss() {
  * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
  */
 function comment_guid($comment_id = null) {
-       echo get_comment_guid($comment_id);
+       echo esc_url( get_comment_guid($comment_id) );
 }
 
 /**
@@ -475,7 +485,7 @@ function prep_atom_text_construct($data) {
  * @since 2.5
  */
 function self_link() {
-       $host = @parse_url(get_option('home'));
+       $host = @parse_url(home_url());
        $host = $host['host'];
        echo esc_url(
                'http'
@@ -524,7 +534,8 @@ function fetch_feed($url) {
        $feed->set_feed_url($url);
        $feed->set_cache_class('WP_Feed_Cache');
        $feed->set_file_class('WP_SimplePie_File');
-       $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200));
+       $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url));
+       do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
        $feed->init();
        $feed->handle_content_type();
 
index dc9ed2f6cc4663f81855690bcdb04fd91f147ad3..0004673c6baaf28f57aec0309c364f67afa90b7e 100644 (file)
@@ -33,8 +33,8 @@ function wptexturize($text) {
        $curl = '';
        $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
-       
-       // No need to setup these variables more than once
+
+       // No need to set up these variables more than once
        if (!$static_setup) {
                /* translators: opening curly quote */
                $opening_quote = _x('&#8220;', 'opening curly quote');
@@ -53,11 +53,11 @@ function wptexturize($text) {
                        $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
                }
 
-               $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
-               $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, '&#8217;s', $closing_quote, ' &#8482;'), $cockneyreplace);
+               $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'\'', ' (tm)'), $cockney);
+               $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace);
 
-               $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|[([{<]|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
-               $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
+               $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/\'(\d+)/', '/(\s|\A|[([{<]|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
+               $dynamic_replacements = array('&#8217;$1','&#8217;$1', '$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
 
                $static_setup = true;
        }
@@ -74,7 +74,7 @@ function wptexturize($text) {
                $curl = $textarr[$i];
 
                if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0}
-                               && empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) { 
+                               && empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) {
                        // This is not a tag, nor is the texturization disabled
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
@@ -120,7 +120,7 @@ function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $openi
                        /*
                         * This disables texturize until we find a closing tag of our type
                         * (e.g. <pre>) even if there was invalid nesting before that
-                        * 
+                        *
                         * Example: in the case <pre>sadsadasd</code>"baba"</pre>
                         *          "baba" won't be texturize
                         */
@@ -185,7 +185,7 @@ 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);
        // Space things out a little
-       $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend)';
+       $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
        $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
        $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
@@ -287,7 +287,7 @@ function seems_utf8($str) {
  * @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.
+ * @param boolean $double_encode Optional. Whether 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 ) {
@@ -334,6 +334,12 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
        // Handle double encoding ourselves
        if ( !$double_encode ) {
                $string = wp_specialchars_decode( $string, $_quote_style );
+
+               /* Critical */
+               // The previous line decodes &amp;phrase; into &phrase;  We must guarantee that &phrase; is valid before proceeding.
+               $string = wp_kses_normalize_entities($string);
+
+               // Now proceed with custom double-encoding silliness
                $string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
        }
 
@@ -690,7 +696,7 @@ function sanitize_file_name( $filename ) {
        // long alpha string not in the extension whitelist.
        foreach ( (array) $parts as $part) {
                $filename .= '.' . $part;
-               
+
                if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
                        $allowed = false;
                        foreach ( $mimes as $ext_preg => $mime_match ) {
@@ -729,19 +735,45 @@ function sanitize_file_name( $filename ) {
  */
 function sanitize_user( $username, $strict = false ) {
        $raw_username = $username;
-       $username = wp_strip_all_tags($username);
+       $username = wp_strip_all_tags( $username );
+       $username = remove_accents( $username );
        // Kill octets
-       $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
-       $username = preg_replace('/&.+?;/', '', $username); // Kill entities
+       $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
+       $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
 
        // If strict, reduce to ASCII for max portability.
        if ( $strict )
-               $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
+               $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
 
        // Consolidate contiguous whitespace
-       $username = preg_replace('|\s+|', ' ', $username);
+       $username = preg_replace( '|\s+|', ' ', $username );
 
-       return apply_filters('sanitize_user', $username, $raw_username, $strict);
+       return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
+}
+
+/**
+ * Sanitize a string key.
+ *
+ * Keys are used as internal identifiers. They should be lowercase ASCII.  Dashes and underscores are allowed.
+ *
+ * @since 3.0.0
+ *
+ * @param string $key String key
+ * @return string Sanitized key
+ */
+function sanitize_key( $key ) {
+       $raw_key = $key;
+       $key = wp_strip_all_tags($key);
+       // Kill octets
+       $key = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $key);
+       $key = preg_replace('/&.+?;/', '', $key); // Kill entities
+
+       $key = preg_replace('|[^a-z0-9 _.\-@]|i', '', $key);
+
+       // Consolidate contiguous whitespace
+       $key = preg_replace('|\s+|', ' ', $key);
+
+       return apply_filters('sanitize_key', $key, $raw_key);
 }
 
 /**
@@ -836,20 +868,21 @@ function sanitize_sql_orderby( $orderby ){
  * @since 2.8.0
  *
  * @param string $class The classname to be sanitized
- * @param string $fallback The value to return if the sanitization end's up as an empty string.
+ * @param string $fallback Optional. The value to return if the sanitization end's up as an empty string.
+ *     Defaults to an empty string.
  * @return string The sanitized value
  */
-function sanitize_html_class($class, $fallback){
+function sanitize_html_class( $class, $fallback = '' ) {
        //Strip out any % encoded octets
        $sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
 
        //Limit to A-Z,a-z,0-9,'-'
        $sanitized = preg_replace('/[^A-Za-z0-9-]/', '', $sanitized);
 
-       if ('' == $sanitized)
+       if ( '' == $sanitized )
                $sanitized = $fallback;
 
-       return apply_filters('sanitize_html_class',$sanitized, $class, $fallback);
+       return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
 }
 
 /**
@@ -866,6 +899,9 @@ function sanitize_html_class($class, $fallback){
  * @return string Converted string.
  */
 function convert_chars($content, $deprecated = '') {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '0.71' );
+
        // Translation of invalid Unicode references range to valid range
        $wp_htmltranswinuni = array(
        '&#128;' => '&#8364;', // the Euro sign
@@ -919,42 +955,6 @@ function convert_chars($content, $deprecated = '') {
        return $content;
 }
 
-/**
- * Callback used to change %uXXXX to &#YYY; syntax
- *
- * @since 2.8?
- *
- * @param array $matches Single Match
- * @return string An HTML entity
- */
-function funky_javascript_callback($matches) {
-       return "&#".base_convert($matches[1],16,10).";";
-}
-
-/**
- * Fixes javascript bugs in browsers.
- *
- * 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;
-
-       if ( $is_winIE || $is_macIE )
-               $text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
-                                              "funky_javascript_callback",
-                                              $text);
-
-       return $text;
-}
-
 /**
  * Will only balance the tags if forced to and the option is set to balance tags.
  *
@@ -993,19 +993,22 @@ function balanceTags( $text, $force = false ) {
  * @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
-       $nestable_tags = array('blockquote', 'div', 'span'); //Tags that can be immediately nested within themselves
-
-       # WP bug fix for comments - in case you REALLY meant to type '< !--'
+       $tagstack = array();
+       $stacksize = 0;
+       $tagqueue = '';
+       $newtext = '';
+       $single_tags = array('br', 'hr', 'img', 'input'); // Known single-entity/self-closing tags
+       $nestable_tags = array('blockquote', 'div', 'span'); // Tags that can be immediately nested within themselves
+
+       // WP bug fix for comments - in case you REALLY meant to type '< !--'
        $text = str_replace('< !--', '<    !--', $text);
-       # WP bug fix for LOVE <3 (and other situations with '<' before a number)
+       // WP bug fix for LOVE <3 (and other situations with '<' before a number)
        $text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
 
-       while (preg_match("/<(\/?\w*)\s*([^>]*)>/",$text,$regex)) {
+       while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
                $newtext .= $tagqueue;
 
-               $i = strpos($text,$regex[0]);
+               $i = strpos($text, $regex[0]);
                $l = strlen($regex[0]);
 
                // clear the shifter
@@ -1014,22 +1017,22 @@ function force_balance_tags( $text ) {
                if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
                        $tag = strtolower(substr($regex[1],1));
                        // if too many closing tags
-                       if($stacksize <= 0) {
+                       if( $stacksize <= 0 ) {
                                $tag = '';
-                               //or close to be safe $tag = '/' . $tag;
+                               // or close to be safe $tag = '/' . $tag;
                        }
                        // if stacktop value = tag close value then pop
-                       else if ($tagstack[$stacksize - 1] == $tag) { // found closing tag
+                       else if ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
                                $tag = '</' . $tag . '>'; // Close Tag
                                // Pop
-                               array_pop ($tagstack);
+                               array_pop( $tagstack );
                                $stacksize--;
                        } else { // closing tag not at top, search for it
-                               for ($j=$stacksize-1;$j>=0;$j--) {
-                                       if ($tagstack[$j] == $tag) {
+                               for ( $j = $stacksize-1; $j >= 0; $j-- ) {
+                                       if ( $tagstack[$j] == $tag ) {
                                        // add tag to tagqueue
-                                               for ($k=$stacksize-1;$k>=$j;$k--){
-                                                       $tagqueue .= '</' . array_pop ($tagstack) . '>';
+                                               for ( $k = $stacksize-1; $k >= $j; $k--) {
+                                                       $tagqueue .= '</' . array_pop( $tagstack ) . '>';
                                                        $stacksize--;
                                                }
                                                break;
@@ -1043,14 +1046,15 @@ function force_balance_tags( $text ) {
                        // Tag Cleaning
 
                        // If self-closing or '', don't do anything.
-                       if((substr($regex[2],-1) == '/') || ($tag == '')) {
+                       if ( substr($regex[2],-1) == '/' || $tag == '' ) {
+                               // do nothing
                        }
                        // ElseIf it's a known single-entity tag but it doesn't close itself, do so
                        elseif ( in_array($tag, $single_tags) ) {
                                $regex[2] .= '/';
                        } else {        // Push the tag onto the stack
                                // If the top of the stack is the same as the tag we want to push, close previous tag
-                               if (($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag)) {
+                               if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {
                                        $tagqueue = '</' . array_pop ($tagstack) . '>';
                                        $stacksize--;
                                }
@@ -1059,18 +1063,18 @@ function force_balance_tags( $text ) {
 
                        // Attributes
                        $attributes = $regex[2];
-                       if($attributes) {
+                       if( !empty($attributes) )
                                $attributes = ' '.$attributes;
-                       }
-                       $tag = '<'.$tag.$attributes.'>';
+
+                       $tag = '<' . $tag . $attributes . '>';
                        //If already queuing a close tag, then put this tag on, too
-                       if ($tagqueue) {
+                       if ( !empty($tagqueue) ) {
                                $tagqueue .= $tag;
                                $tag = '';
                        }
                }
-               $newtext .= substr($text,0,$i) . $tag;
-               $text = substr($text,$i+$l);
+               $newtext .= substr($text, 0, $i) . $tag;
+               $text = substr($text, $i + $l);
        }
 
        // Clear Tag Queue
@@ -1080,9 +1084,8 @@ function force_balance_tags( $text ) {
        $newtext .= $text;
 
        // Empty Stack
-       while($x = array_pop($tagstack)) {
+       while( $x = array_pop($tagstack) )
                $newtext .= '</' . $x . '>'; // Add remaining tags to close
-       }
 
        // WP fix for the bug with HTML comments
        $newtext = str_replace("< !--","<!--",$newtext);
@@ -1101,7 +1104,7 @@ function force_balance_tags( $text ) {
  * @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.
+ * @param bool $richedit Whether 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) {
@@ -1205,11 +1208,8 @@ function untrailingslashit($string) {
  * @return string Returns a string escaped with slashes.
  */
 function addslashes_gpc($gpc) {
-       global $wpdb;
-
-       if (get_magic_quotes_gpc()) {
+       if ( get_magic_quotes_gpc() )
                $gpc = stripslashes($gpc);
-       }
 
        return esc_sql($gpc);
 }
@@ -1226,7 +1226,17 @@ function addslashes_gpc($gpc) {
  * @return array|string Stripped array (or string in the callback).
  */
 function stripslashes_deep($value) {
-       $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+       if ( is_array($value) ) {
+               $value = array_map('stripslashes_deep', $value);
+       } elseif ( is_object($value) ) {
+               $vars = get_object_vars( $value );
+               foreach ($vars as $key=>$data) {
+                       $value->{$key} = stripslashes_deep( $data );
+               }
+       } else {
+               $value = stripslashes($value);
+       }
+
        return $value;
 }
 
@@ -1371,7 +1381,6 @@ function make_clickable($ret) {
  * @return string Converted content.
  */
 function wp_rel_nofollow( $text ) {
-       global $wpdb;
        // This is a pre save filter, so text is already escaped.
        $text = stripslashes($text);
        $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
@@ -1396,7 +1405,6 @@ function wp_rel_nofollow_callback( $matches ) {
        return "<a $text rel=\"nofollow\">";
 }
 
-
 /**
  * Convert one smiley code to the icon graphic file equivalent.
  *
@@ -1427,7 +1435,6 @@ function translate_smiley($smiley) {
        return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";
 }
 
-
 /**
  * Convert text equivalent of smilies to images.
  *
@@ -1469,10 +1476,13 @@ function convert_smilies($text) {
  * @since 0.71
  *
  * @param string $email Email address to verify.
- * @param boolean $check_dns Whether to check the DNS for the domain using checkdnsrr().
+ * @param boolean $deprecated. Deprecated.
  * @return string|bool Either false or the valid email address.
  */
-function is_email( $email, $check_dns = false ) {
+function is_email( $email, $deprecated = false ) {
+       if ( ! empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '3.0' );
+
        // Test for the minimum length the email can be
        if ( strlen( $email ) < 3 ) {
                return apply_filters( 'is_email', false, $email, 'email_too_short' );
@@ -1524,12 +1534,6 @@ function is_email( $email, $check_dns = false ) {
                }
        }
 
-       // DNS
-       // Check the domain has a valid MX and A resource record
-       if ( $check_dns && function_exists( 'checkdnsrr' ) && !( checkdnsrr( $domain . '.', 'MX' ) || checkdnsrr( $domain . '.', 'A' ) ) ) {
-               return apply_filters( 'is_email', false, $email, 'dns_no_rr' );
-       }
-
        // Congratulations your email made it!
        return apply_filters( 'is_email', $email, $email, null );
 }
@@ -1559,7 +1563,8 @@ function wp_iso_descrambler($string) {
  *
  * Requires and returns a date in the Y-m-d H:i:s format. Simply subtracts the
  * value of the 'gmt_offset' option. Return format can be overridden using the
- * $format parameter
+ * $format parameter. If PHP5 is supported, the function uses the DateTime and
+ * DateTimeZone objects to respect time zone differences in DST.
  *
  * @since 1.2.0
  *
@@ -1570,8 +1575,23 @@ function wp_iso_descrambler($string) {
  */
 function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') {
        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($format, $string_time - get_option('gmt_offset') * 3600);
+       $tz = get_option('timezone_string');
+       if( class_exists('DateTime') && $tz ) {
+               //PHP5
+               date_default_timezone_set( $tz );
+               $datetime = new DateTime( $string );
+               $datetime->setTimezone( new DateTimeZone('UTC') );
+               $offset = $datetime->getOffset();
+               $datetime->modify( '+' . $offset / 3600 . ' hours');
+               $string_gmt = gmdate($format, $datetime->format('U'));
+
+               date_default_timezone_set('UTC');
+       }
+       else {
+               //PHP4
+               $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
+               $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * 3600);
+       }
        return $string_gmt;
 }
 
@@ -1767,6 +1787,7 @@ function human_time_diff( $from, $to = '' ) {
                if ($mins <= 1) {
                        $mins = 1;
                }
+               /* translators: min=minute */
                $since = sprintf(_n('%s min', '%s mins', $mins), $mins);
        } else if (($diff <= 86400) && ($diff > 3600)) {
                $hours = round($diff / 3600);
@@ -1811,11 +1832,13 @@ function wp_trim_excerpt($text) {
                $text = strip_tags($text);
                $excerpt_length = apply_filters('excerpt_length', 55);
                $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
-               $words = explode(' ', $text, $excerpt_length + 1);
-               if (count($words) > $excerpt_length) {
+               $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
+               if ( count($words) > $excerpt_length ) {
                        array_pop($words);
                        $text = implode(' ', $words);
                        $text = $text . $excerpt_more;
+               } else {
+                       $text = implode(' ', $words);
                }
        }
        return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
@@ -2133,53 +2156,6 @@ function wp_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 'esc_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;
-       $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
-       $strip = array('%0d', '%0a', '%0D', '%0A');
-       $url = _deep_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 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
-               $url = 'http://' . $url;
-
-       // Replace ampersands and single quotes only when displaying.
-       if ( 'display' == $context ) {
-               $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 ( wp_kses_bad_protocol( $url, $protocols ) != $url )
-               return '';
-
-       return apply_filters('clean_url', $url, $original_url, $context);
-}
-
 /**
  * Perform a deep string replace operation to ensure the values in $search are no longer present
  *
@@ -2194,14 +2170,15 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
  * @param string $subject
  * @return string The processed string
  */
-function _deep_replace($search, $subject){
+function _deep_replace( $search, $subject ) {
        $found = true;
-       while($found) {
+       $subject = (string) $subject;
+       while ( $found ) {
                $found = false;
-               foreach( (array) $search as $val ) {
-                       while(strpos($subject, $val) !== false) {
+               foreach ( (array) $search as $val ) {
+                       while ( strpos( $subject, $val ) !== false ) {
                                $found = true;
-                               $subject = str_replace($val, '', $subject);
+                               $subject = str_replace( $val, '', $subject );
                        }
                }
        }
@@ -2223,58 +2200,66 @@ function esc_sql( $sql ) {
        return $wpdb->escape( $sql );
 }
 
-
 /**
  * Checks and cleans a URL.
  *
  * A number of characters are removed from the URL. If the URL is for displaying
- * (the default behaviour) amperstands are also replaced. The 'esc_url' filter
+ * (the default behaviour) amperstands are also replaced. The 'clean_url' filter
  * is applied to the returned cleaned URL.
  *
  * @since 2.8.0
- * @uses esc_url()
  * @uses wp_kses_bad_protocol() To only permit protocols in the URL set
  *             via $protocols or the common ones set in the function.
  *
  * @param string $url The URL to be cleaned.
  * @param array $protocols Optional. An array of acceptable protocols.
  *             Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
- * @return string The cleaned $url after the 'cleaned_url' filter is applied.
+ * @param string $_context Private. Use esc_url_raw() for database usage.
+ * @return string The cleaned $url after the 'clean_url' filter is applied.
  */
-function esc_url( $url, $protocols = null ) {
-       return clean_url( $url, $protocols, 'display' );
+function esc_url( $url, $protocols = null, $_context = 'display' ) {
+       $original_url = $url;
+
+       if ( '' == $url )
+               return $url;
+       $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
+       $strip = array('%0d', '%0a', '%0D', '%0A');
+       $url = _deep_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 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
+               $url = 'http://' . $url;
+
+       // Replace ampersands and single quotes only when displaying.
+       if ( 'display' == $_context ) {
+               $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', 'mms', 'rtsp', 'svn');
+       if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
+               return '';
+
+       return apply_filters('clean_url', $url, $original_url, $_context);
 }
 
 /**
  * Performs esc_url() for database usage.
  *
- * @see esc_url()
- * @see esc_url()
- *
  * @since 2.8.0
+ * @uses esc_url()
  *
  * @param string $url The URL to be cleaned.
  * @param array $protocols An array of acceptable protocols.
  * @return string The cleaned URL.
  */
 function esc_url_raw( $url, $protocols = null ) {
-       return clean_url( $url, $protocols, 'db' );
-}
-
-/**
- * Performs esc_url() for database or redirect usage.
- *
- * @see esc_url()
- * @deprecated 2.8.0
- *
- * @since 2.3.1
- *
- * @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 ) {
-       return clean_url( $url, $protocols, 'db' );
+       return esc_url( $url, $protocols, 'db' );
 }
 
 /**
@@ -2296,9 +2281,9 @@ function htmlentities2($myHTML) {
 /**
  * Escape single quotes, htmlspecialchar " < > &, and fix line endings.
  *
- * Escapes text strings for echoing in JS, both inline (for example in onclick="...")
- * and inside <script> tag. Note that the strings have to be in single quotes.
- * The filter 'js_escape' is also applied here.
+ * Escapes text strings for echoing in JS. It is intended to be used for inline JS
+ * (in a tag attribute, for example onclick="..."). Note that the strings have to
+ * be in single quotes. The filter 'js_escape' is also applied here.
  *
  * @since 2.8.0
  *
@@ -2314,23 +2299,6 @@ function esc_js( $text ) {
        return apply_filters( 'js_escape', $safe_text, $text );
 }
 
-/**
- * Escape single quotes, specialchar double quotes, and fix line endings.
- *
- * The filter 'js_escape' is also applied by esc_js()
- *
- * @since 2.0.4
- *
- * @deprecated 2.8.0
- * @see esc_js()
- *
- * @param string $text The text to be escaped.
- * @return string Escaped text.
- */
-function js_escape( $text ) {
-       return esc_js( $text );
-}
-
 /**
  * Escaping for HTML blocks.
  *
@@ -2345,20 +2313,6 @@ function esc_html( $text ) {
        return apply_filters( 'esc_html', $safe_text, $text );
 }
 
-/**
- * Escaping for HTML blocks
- * @deprecated 2.8.0
- * @see esc_html()
- */
-function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
-       if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
-               $args = func_get_args();
-               return call_user_func_array( '_wp_specialchars', $args );
-       } else {
-               return esc_html( $string );
-       }
-}
-
 /**
  * Escaping for HTML attributes.
  *
@@ -2373,21 +2327,6 @@ function esc_attr( $text ) {
        return apply_filters( 'attribute_escape', $safe_text, $text );
 }
 
-/**
- * Escaping for HTML attributes.
- *
- * @since 2.0.6
- *
- * @deprecated 2.8.0
- * @see esc_attr()
- *
- * @param string $text
- * @return string
- */
-function attribute_escape( $text ) {
-       return esc_attr( $text );
-}
-
 /**
  * Escape a HTML tag name.
  *
@@ -2442,9 +2381,14 @@ function wp_make_link_relative( $link ) {
  */
 function sanitize_option($option, $value) {
 
-       switch ($option) {
+       switch ( $option ) {
                case 'admin_email':
                        $value = sanitize_email($value);
+                       if ( !is_email($value) ) {
+                               $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
+                               if ( function_exists('add_settings_error') )
+                                       add_settings_error('admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.'));
+                       }
                        break;
 
                case 'thumbnail_size_w':
@@ -2458,6 +2402,7 @@ function sanitize_option($option, $value) {
                case 'mailserver_port':
                case 'comment_max_links':
                case 'page_on_front':
+               case 'page_for_posts':
                case 'rss_excerpt_length':
                case 'default_category':
                case 'default_email_category':
@@ -2466,6 +2411,7 @@ function sanitize_option($option, $value) {
                case 'comments_per_page':
                case 'thread_comments_depth':
                case 'users_can_register':
+               case 'start_of_week':
                        $value = absint( $value );
                        break;
 
@@ -2477,8 +2423,10 @@ function sanitize_option($option, $value) {
                case 'posts_per_page':
                case 'posts_per_rss':
                        $value = (int) $value;
-                       if ( empty($value) ) $value = 1;
-                       if ( $value < -1 ) $value = abs($value);
+                       if ( empty($value) )
+                               $value = 1;
+                       if ( $value < -1 )
+                               $value = abs($value);
                        break;
 
                case 'default_ping_status':
@@ -2518,10 +2466,25 @@ function sanitize_option($option, $value) {
                        break;
 
                case 'siteurl':
+                       if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) {
+                               $value = esc_url_raw($value);
+                       } else {
+                               $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
+                               if ( function_exists('add_settings_error') )
+                                       add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.'));
+                       }
+                       break;
+
                case 'home':
-                       $value = stripslashes($value);
-                       $value = esc_url($value);
+                       if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) {
+                               $value = esc_url_raw($value);
+                       } else {
+                               $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
+                               if ( function_exists('add_settings_error') )
+                                       add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.'));
+                       }
                        break;
+
                default :
                        $value = apply_filters("sanitize_option_{$option}", $value, $option);
                        break;
@@ -2821,10 +2784,10 @@ function wp_strip_all_tags($string, $remove_breaks = false) {
  * check for invalid UTF-8,
  * Convert single < characters to entity,
  * strip all tags,
- * remove line breaks, tabs and extra whitre space,
+ * remove line breaks, tabs and extra white space,
  * strip octets.
  *
- * @since 2.9
+ * @since 2.9.0
  *
  * @param string $str
  * @return string
@@ -2834,16 +2797,36 @@ function sanitize_text_field($str) {
 
        if ( strpos($filtered, '<') !== false ) {
                $filtered = wp_pre_kses_less_than( $filtered );
+               // This will strip extra whitespace for us.
                $filtered = wp_strip_all_tags( $filtered, true );
        } else {
-                $filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
+               $filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
        }
 
        $match = array();
-       while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) )
+       $found = false;
+       while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
                $filtered = str_replace($match[0], '', $filtered);
+               $found = true;
+       }
+
+       if ( $found ) {
+               // Strip out the whitespace that may now exist after removing the octets.
+               $filtered = trim( preg_replace('/ +/', ' ', $filtered) );
+       }
 
        return apply_filters('sanitize_text_field', $filtered, $str);
 }
 
+/**
+ * Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
+ *
+ * Violating our coding standards for a good function name.
+ *
+ * @since 3.0.0
+ */
+function capital_P_dangit( $text ) {
+       return str_replace( 'Wordpress', 'WordPress', $text );
+}
+
 ?>
index 1df479e683425af16125f2b055b5fdaaebcc0731..9606f01646f4fff6900329093e51ed86032a1920 100644 (file)
  * @return string Date formated by $dateformatstring or locale (if available).
  */
 function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
-       global $wp_locale;
        $m = $mysqlstring;
        if ( empty( $m ) )
                return false;
 
-       if( 'G' == $dateformatstring ) {
+       if ( 'G' == $dateformatstring ) {
                return strtotime( $m . ' +0000' );
        }
 
        $i = strtotime( $m );
 
-       if( 'U' == $dateformatstring )
+       if ( 'U' == $dateformatstring )
                return $i;
 
        if ( $translate)
@@ -127,23 +126,18 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
 }
 
 /**
- * Convert number to format based on the locale.
+ * Convert integer number to format based on the locale.
  *
  * @since 2.3.0
  *
- * @param mixed $number The number to convert based on locale.
+ * @param int $number The number to convert based on locale.
  * @param int $decimals Precision of the number of decimal places.
  * @return string Converted number in string format.
  */
-function number_format_i18n( $number, $decimals = null ) {
+function number_format_i18n( $number, $decimals = 0 ) {
        global $wp_locale;
-       // let the user override the precision only
-       $decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals );
-
-       $num = number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
-
-       // let the user translate digits from latin to localized language
-       return apply_filters( 'number_format_i18n', $num );
+       $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
+       return apply_filters( 'number_format_i18n', $formatted );
 }
 
 /**
@@ -164,10 +158,10 @@ function number_format_i18n( $number, $decimals = null ) {
  * @since 2.3.0
  *
  * @param int|string $bytes Number of bytes. Note max integer size for integers.
- * @param int $decimals Precision of number of decimal places.
+ * @param int $decimals Precision of number of decimal places. Deprecated.
  * @return bool|string False on failure. Number string on success.
  */
-function size_format( $bytes, $decimals = null ) {
+function size_format( $bytes, $decimals = 0 ) {
        $quant = array(
                // ========================= Origin ====
                'TB' => 1099511627776,  // pow( 1024, 4)
@@ -176,7 +170,6 @@ function size_format( $bytes, $decimals = null ) {
                'kB' => 1024,           // pow( 1024, 1)
                'B ' => 1,              // pow( 1024, 0)
        );
-
        foreach ( $quant as $unit => $mag )
                if ( doubleval($bytes) >= $mag )
                        return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
@@ -199,24 +192,15 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
        $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) )
+       if ( !is_numeric($start_of_week) )
                $start_of_week = get_option( 'start_of_week' );
 
        if ( $weekday < $start_of_week )
-               $weekday = 7 - $start_of_week - $weekday;
+               $weekday += 7;
 
-       while ( $weekday > $start_of_week ) {
-               $weekday = date( 'w', $day );
-               if ( $weekday < $start_of_week )
-                       $weekday = 7 - $start_of_week - $weekday;
-
-               $day -= 86400;
-               $i = 0;
-       }
-       $week['start'] = $day + 86400 - $i;
-       $week['end'] = $week['start'] + 604799;
-       return $week;
+       $start = $day - 86400 * ( $weekday - $start_of_week ); // The most recent week start day on or before $day
+       $end = $start + 604799; // $start + 7 days - 1 second
+       return compact( 'start', 'end' );
 }
 
 /**
@@ -289,82 +273,88 @@ function is_serialized_string( $data ) {
 }
 
 /**
- * Retrieve option value based on setting name.
+ * Retrieve option value based on name of option.
  *
  * If the option does not exist or does not have a value, then the return value
  * will be false. This is useful to check whether you need to install an option
  * and is commonly used during installation of plugin options and to test
  * whether upgrading is required.
  *
- * You can "short-circuit" the retrieval of the option from the database for
- * your plugin or core options that aren't protected. You can do so by hooking
- * into the 'pre_option_$option' with the $option being replaced by the option
- * name. You should not try to override special options, but you will not be
- * prevented from doing so.
- *
- * 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.
+ * If the option was serialized then it will be unserialized when it is returned.
  *
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
- * @uses apply_filters() Calls 'pre_option_$optionname' false to allow
- *             overwriting the option value in a plugin.
- * @uses apply_filters() Calls 'option_$optionname' with the option name value.
- *
- * @param string $setting Name of option to retrieve. Should already be SQL-escaped
+ * @uses apply_filters() Calls 'pre_option_$option' before checking the option.
+ *     Any value other than false will "short-circuit" the retrieval of the option
+ *     and return the returned value. You should not try to override special options,
+ *     but you will not be prevented from doing so.
+ * @uses apply_filters() Calls 'option_$option', after checking the option, with
+ *     the option value.
+ *
+ * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
  * @return mixed Value set for the option.
  */
-function get_option( $setting, $default = false ) {
+function get_option( $option, $default = false ) {
        global $wpdb;
 
        // Allow plugins to short-circuit options.
-       $pre = apply_filters( 'pre_option_' . $setting, false );
+       $pre = apply_filters( 'pre_option_' . $option, false );
        if ( false !== $pre )
                return $pre;
 
-       // prevent non-existent options from triggering multiple queries
-       $notoptions = wp_cache_get( 'notoptions', 'options' );
-       if ( isset( $notoptions[$setting] ) )
-               return $default;
+       $option = trim($option);
+       if ( empty($option) )
+               return false;
 
-       $alloptions = wp_load_alloptions();
+       if ( defined( 'WP_SETUP_CONFIG' ) )
+               return false;
 
-       if ( isset( $alloptions[$setting] ) ) {
-               $value = $alloptions[$setting];
-       } else {
-               $value = wp_cache_get( $setting, 'options' );
-
-               if ( false === $value ) {
-                       if ( defined( 'WP_INSTALLING' ) )
-                               $suppress = $wpdb->suppress_errors();
-                       // expected_slashed ($setting)
-                       $row = $wpdb->get_row( "SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1" );
-                       if ( defined( 'WP_INSTALLING' ) )
-                               $wpdb->suppress_errors($suppress);
-
-                       if ( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
-                               $value = $row->option_value;
-                               wp_cache_add( $setting, $value, 'options' );
-                       } else { // option does not exist, so we must cache its non-existence
-                               $notoptions[$setting] = true;
-                               wp_cache_set( 'notoptions', $notoptions, 'options' );
-                               return $default;
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               // prevent non-existent options from triggering multiple queries
+               $notoptions = wp_cache_get( 'notoptions', 'options' );
+               if ( isset( $notoptions[$option] ) )
+                       return $default;
+
+               $alloptions = wp_load_alloptions();
+
+               if ( isset( $alloptions[$option] ) ) {
+                       $value = $alloptions[$option];
+               } else {
+                       $value = wp_cache_get( $option, 'options' );
+
+                       if ( false === $value ) {
+                               $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
+
+                               // Has to be get_row instead of get_var because of funkiness with 0, false, null values
+                               if ( is_object( $row ) ) {
+                                       $value = $row->option_value;
+                                       wp_cache_add( $option, $value, 'options' );
+                               } else { // option does not exist, so we must cache its non-existence
+                                       $notoptions[$option] = true;
+                                       wp_cache_set( 'notoptions', $notoptions, 'options' );
+                                       return $default;
+                               }
                        }
                }
+       } else {
+               $suppress = $wpdb->suppress_errors();
+               $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
+               $wpdb->suppress_errors( $suppress );
+               if ( is_object( $row ) )
+                       $value = $row->option_value;
+               else
+                       return $default;
        }
 
        // If home is not set use siteurl.
-       if ( 'home' == $setting && '' == $value )
+       if ( 'home' == $option && '' == $value )
                return get_option( 'siteurl' );
 
-       if ( in_array( $setting, array('siteurl', 'home', 'category_base', 'tag_base') ) )
+       if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) )
                $value = untrailingslashit( $value );
 
-       return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) );
+       return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
 }
 
 /**
@@ -382,7 +372,7 @@ function get_option( $setting, $default = false ) {
 function wp_protect_special_option( $option ) {
        $protected = array( 'alloptions', 'notoptions' );
        if ( in_array( $option, $protected ) )
-               die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
+               wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
 }
 
 /**
@@ -396,59 +386,25 @@ function wp_protect_special_option( $option ) {
  * @param string $option Option name.
  */
 function form_option( $option ) {
-       echo esc_attr(get_option( $option ) );
-}
-
-/**
- * Retrieve all autoload options or all options, if no autoloaded ones exist.
- *
- * 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
- * @package WordPress
- * @subpackage Option
- * @uses apply_filters() Calls 'pre_option_$optionname' hook with option value as parameter.
- * @uses apply_filters() Calls 'all_options' on options list.
- *
- * @return array List of all options.
- */
-function get_alloptions() {
-       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);
-
-       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' ) ) )
-                       $option->option_value = untrailingslashit( $option->option_value );
-               $value = maybe_unserialize( $option->option_value );
-               $all_options->{$option->option_name} = apply_filters( 'pre_option_' . $option->option_name, $value );
-       }
-       return apply_filters( 'all_options', $all_options );
+       echo esc_attr( get_option( $option ) );
 }
 
 /**
  * Loads and caches all autoloaded options, if available or all options.
  *
- * This is different from get_alloptions(), in that this function will cache the
- * options and will return the cached options when called again.
- *
  * @since 2.2.0
  * @package WordPress
  * @subpackage Option
  *
- * @return array List all options.
+ * @return array List of all options.
  */
 function wp_load_alloptions() {
        global $wpdb;
 
-       $alloptions = wp_cache_get( 'alloptions', 'options' );
+       if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+               $alloptions = wp_cache_get( 'alloptions', 'options' );
+       else
+               $alloptions = false;
 
        if ( !$alloptions ) {
                $suppress = $wpdb->suppress_errors();
@@ -458,84 +414,117 @@ function wp_load_alloptions() {
                $alloptions = array();
                foreach ( (array) $alloptions_db as $o )
                        $alloptions[$o->option_name] = $o->option_value;
-               wp_cache_add( 'alloptions', $alloptions, 'options' );
+                       if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+                               wp_cache_add( 'alloptions', $alloptions, 'options' );
        }
+
        return $alloptions;
 }
 
+/**
+ * Loads and caches certain often requested site options if is_multisite() and a peristent cache is not being used.
+ *
+ * @since 3.0.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param int $site_id Optional site ID for which to query the options. Defaults to the current site.
+ */
+function wp_load_core_site_options( $site_id = null ) {
+       global $wpdb, $_wp_using_ext_object_cache;
+
+       if ( !is_multisite() || $_wp_using_ext_object_cache || defined( 'WP_INSTALLING' ) )
+               return;
+
+       if ( empty($site_id) )
+               $site_id = $wpdb->siteid;
+
+       $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'dashboard_blog', 'can_compress_scripts', 'global_terms_enabled' );
+
+       $core_options_in = "'" . implode("', '", $core_options) . "'";
+       $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
+
+       foreach ( $options as $option ) {
+               $key = $option->meta_key;
+               $cache_key = "{$site_id}:$key";
+               $option->meta_value = maybe_unserialize( $option->meta_value );
+
+               wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
+       }
+}
+
 /**
  * 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
+ * You do not need to serialize values. If the value needs to be serialized, 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().
- *
- * Before the option is updated, then the filter named
- * 'pre_update_option_$option_name', with the $option_name as the $option_name
- * parameter value, will be called. The hook should accept two parameters, the
- * first is the new value and the second is the old value.  Whatever is
- * returned will be used as the new value.
- *
- * After the value has been updated the action named 'update_option_$option_name'
- * will be called.  This action receives two parameters the first being the old
- * value and the second the new value.
+ * to set whether an option is autoloaded, then you need to use the add_option().
  *
  * @since 1.0.0
  * @package WordPress
  * @subpackage Option
  *
- * @param string $option_name Option name. Expected to not be SQL-escaped
- * @param mixed $newvalue Option value.
+ * @uses apply_filters() Calls 'pre_update_option_$option' hook to allow overwriting the
+ *     option value to be stored.
+ * @uses do_action() Calls 'update_option' hook before updating the option.
+ * @uses do_action() Calls 'update_option_$option' and 'updated_option' hooks on success.
+ *
+ * @param string $option Option name. Expected to not be SQL-escaped.
+ * @param mixed $newvalue Option value. Expected to not be SQL-escaped.
  * @return bool False if value was not updated and true if value was updated.
  */
-function update_option( $option_name, $newvalue ) {
+function update_option( $option, $newvalue ) {
        global $wpdb;
 
-       wp_protect_special_option( $option_name );
+       $option = trim($option);
+       if ( empty($option) )
+               return false;
 
-       $safe_option_name = esc_sql( $option_name );
-       $newvalue = sanitize_option( $option_name, $newvalue );
+       wp_protect_special_option( $option );
 
-       $oldvalue = get_option( $safe_option_name );
+       if ( is_object($newvalue) )
+               $newvalue = wp_clone($newvalue);
 
-       $newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue );
+       $newvalue = sanitize_option( $option, $newvalue );
+       $oldvalue = get_option( $option );
+       $newvalue = apply_filters( 'pre_update_option_' . $option, $newvalue, $oldvalue );
 
        // If the new and old values are the same, no need to update.
        if ( $newvalue === $oldvalue )
                return false;
 
-       if ( false === $oldvalue ) {
-               add_option( $option_name, $newvalue );
-               return true;
-       }
+       if ( false === $oldvalue )
+               return add_option( $option, $newvalue );
 
        $notoptions = wp_cache_get( 'notoptions', 'options' );
-       if ( is_array( $notoptions ) && isset( $notoptions[$option_name] ) ) {
-               unset( $notoptions[$option_name] );
+       if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+               unset( $notoptions[$option] );
                wp_cache_set( 'notoptions', $notoptions, 'options' );
        }
 
        $_newvalue = $newvalue;
        $newvalue = maybe_serialize( $newvalue );
 
-       do_action( 'update_option', $option_name, $oldvalue, $newvalue );
-       $alloptions = wp_load_alloptions();
-       if ( isset( $alloptions[$option_name] ) ) {
-               $alloptions[$option_name] = $newvalue;
-               wp_cache_set( 'alloptions', $alloptions, 'options' );
-       } else {
-               wp_cache_set( $option_name, $newvalue, 'options' );
+       do_action( 'update_option', $option, $oldvalue, $_newvalue );
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               $alloptions = wp_load_alloptions();
+               if ( isset( $alloptions[$option] ) ) {
+                       $alloptions[$option] = $_newvalue;
+                       wp_cache_set( 'alloptions', $alloptions, 'options' );
+               } else {
+                       wp_cache_set( $option, $_newvalue, 'options' );
+               }
        }
 
-       $wpdb->update($wpdb->options, array('option_value' => $newvalue), array('option_name' => $option_name) );
+       $result = $wpdb->update( $wpdb->options, array( 'option_value' => $newvalue ), array( 'option_name' => $option ) );
 
-       if ( $wpdb->rows_affected == 1 ) {
-               do_action( "update_option_{$option_name}", $oldvalue, $_newvalue );
-               do_action( 'updated_option', $option_name, $oldvalue, $_newvalue );
+       if ( $result ) {
+               do_action( "update_option_{$option}", $oldvalue, $_newvalue );
+               do_action( 'updated_option', $option, $oldvalue, $_newvalue );
                return true;
        }
        return false;
@@ -544,104 +533,125 @@ function update_option( $option_name, $newvalue ) {
 /**
  * Add a new option.
  *
- * You do not need to serialize values, if the value needs to be serialize, then
+ * You do not need to serialize values. If the value needs to be serialized, 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
- * options, the same as the ones which are protected and to not add options
+ * options the same as the ones which are protected and to not add options
  * that were already added.
  *
- * The filter named 'add_option_$optionname', with the $optionname being
- * replaced with the option's name, will be called. The hook should accept two
- * parameters, the first is the option name, and the second is the value.
- *
  * @package WordPress
  * @subpackage Option
  * @since 1.0.0
  * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton
  *
- * @param string $name Option name to add. Expects to NOT be SQL escaped.
- * @param mixed $value Optional. Option value, can be anything.
+ * @uses do_action() Calls 'add_option' hook before adding the option.
+ * @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success.
+ *
+ * @param string $option Name of option to add. Expected to not be SQL-escaped.
+ * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped.
  * @param mixed $deprecated Optional. Description. Not used anymore.
  * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up.
  * @return null returns when finished.
  */
-function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
+function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
        global $wpdb;
 
-       wp_protect_special_option( $name );
-       $safe_name = esc_sql( $name );
-       $value = sanitize_option( $name, $value );
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.3' );
+
+       $option = trim($option);
+       if ( empty($option) )
+               return false;
+
+       wp_protect_special_option( $option );
+
+       if ( is_object($value) )
+               $value = wp_clone($value);
+
+       $value = sanitize_option( $option, $value );
 
        // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
        $notoptions = wp_cache_get( 'notoptions', 'options' );
-       if ( !is_array( $notoptions ) || !isset( $notoptions[$name] ) )
-               if ( false !== get_option( $safe_name ) )
+       if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
+               if ( false !== get_option( $option ) )
                        return;
 
+       $_value = $value;
        $value = maybe_serialize( $value );
        $autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
-       do_action( 'add_option', $name, $value );
-       if ( 'yes' == $autoload ) {
-               $alloptions = wp_load_alloptions();
-               $alloptions[$name] = $value;
-               wp_cache_set( 'alloptions', $alloptions, 'options' );
-       } else {
-               wp_cache_set( $name, $value, 'options' );
+       do_action( 'add_option', $option, $_value );
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               if ( 'yes' == $autoload ) {
+                       $alloptions = wp_load_alloptions();
+                       $alloptions[$option] = $value;
+                       wp_cache_set( 'alloptions', $alloptions, 'options' );
+               } else {
+                       wp_cache_set( $option, $value, 'options' );
+               }
        }
 
        // This option exists now
        $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh
-       if ( is_array( $notoptions ) && isset( $notoptions[$name] ) ) {
-               unset( $notoptions[$name] );
+       if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+               unset( $notoptions[$option] );
                wp_cache_set( 'notoptions', $notoptions, 'options' );
        }
 
-       $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $name, $value, $autoload ) );
+       $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $value, $autoload ) );
 
-       do_action( "add_option_{$name}", $name, $value );
-       do_action( 'added_option', $name, $value );
-       
-       return;
+       if ( $result ) {
+               do_action( "add_option_{$option}", $option, $_value );
+               do_action( 'added_option', $option, $_value );
+               return true;
+       }
+       return false;
 }
 
 /**
- * Removes option by name and prevents removal of protected WordPress options.
+ * Removes option by name. Prevents removal of protected WordPress options.
  *
  * @package WordPress
  * @subpackage Option
  * @since 1.2.0
  *
- * @param string $name Option name to remove.
- * @return bool True, if succeed. False, if failure.
+ * @uses do_action() Calls 'delete_option' hook before option is deleted.
+ * @uses do_action() Calls 'deleted_option' and 'delete_option_$option' hooks on success.
+ *
+ * @param string $option Name of option to remove. Expected to not be SQL-escaped.
+ * @return bool True, if option is successfully deleted. False on failure.
  */
-function delete_option( $name ) {
+function delete_option( $option ) {
        global $wpdb;
 
-       wp_protect_special_option( $name );
+       wp_protect_special_option( $option );
 
        // Get the ID, if no ID then return
-       // expected_slashed ($name)
-       $option = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name = '$name'" );
-       if ( is_null($option) )
+       $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
+       if ( is_null( $row ) )
                return false;
-       do_action( 'delete_option', $name );
-       // expected_slashed ($name)
-       $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$name'" );
-       if ( 'yes' == $option->autoload ) {
-               $alloptions = wp_load_alloptions();
-               if ( isset( $alloptions[$name] ) ) {
-                       unset( $alloptions[$name] );
-                       wp_cache_set( 'alloptions', $alloptions, 'options' );
+       do_action( 'delete_option', $option );
+       $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $option) );
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               if ( 'yes' == $row->autoload ) {
+                       $alloptions = wp_load_alloptions();
+                       if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) {
+                               unset( $alloptions[$option] );
+                               wp_cache_set( 'alloptions', $alloptions, 'options' );
+                       }
+               } else {
+                       wp_cache_delete( $option, 'options' );
                }
-       } else {
-               wp_cache_delete( $name, 'options' );
        }
-       do_action( 'deleted_option', $name );
-       return true;
+       if ( $result ) {
+               do_action( "delete_option_$option", $option );
+               do_action( 'deleted_option', $option );
+               return true;
+       }
+       return false;
 }
 
 /**
@@ -651,18 +661,30 @@ function delete_option( $name ) {
  * @package WordPress
  * @subpackage Transient
  *
- * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @uses do_action() Calls 'delete_transient_$transient' hook before transient is deleted.
+ * @uses do_action() Calls 'deleted_transient' hook on success.
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
  * @return bool true if successful, false otherwise
  */
-function delete_transient($transient) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function delete_transient( $transient ) {
+       global $_wp_using_ext_object_cache;
+
+    do_action( 'delete_transient_' . $transient, $transient );
 
        if ( $_wp_using_ext_object_cache ) {
-               return wp_cache_delete($transient, 'transient');
+               $result = wp_cache_delete( $transient, 'transient' );
        } else {
-               $transient = '_transient_' . esc_sql($transient);
-               return delete_option($transient);
+               $option_timeout = '_transient_timeout_' . $transient;
+               $option = '_transient_' . $transient;
+               $result = delete_option( $option );
+               if ( $result )
+                       delete_option( $option_timeout );
        }
+
+       if ( $result )
+               do_action( 'deleted_transient', $transient );
+       return $result;
 }
 
 /**
@@ -671,6 +693,12 @@ function delete_transient($transient) {
  * If the transient does not exist or does not have a value, then the return value
  * will be false.
  *
+ * @uses apply_filters() Calls 'pre_transient_$transient' hook before checking the transient.
+ *     Any value other than false will "short-circuit" the retrieval of the transient
+ *     and return the returned value.
+ * @uses apply_filters() Calls 'transient_$option' hook, after checking the transient, with
+ *     the transient value.
+ *
  * @since 2.8.0
  * @package WordPress
  * @subpackage Transient
@@ -678,71 +706,83 @@ function delete_transient($transient) {
  * @param string $transient Transient name. Expected to not be SQL-escaped
  * @return mixed Value of transient
  */
-function get_transient($transient) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function get_transient( $transient ) {
+       global $_wp_using_ext_object_cache;
 
        $pre = apply_filters( 'pre_transient_' . $transient, false );
        if ( false !== $pre )
                return $pre;
 
        if ( $_wp_using_ext_object_cache ) {
-               $value = wp_cache_get($transient, 'transient');
+               $value = wp_cache_get( $transient, 'transient' );
        } else {
-               $transient_option = '_transient_' . esc_sql($transient);
-               // If option is not in alloptions, it is not autoloaded and thus has a timeout
-               $alloptions = wp_load_alloptions();
-               if ( !isset( $alloptions[$transient_option] ) ) {
-                       $transient_timeout = '_transient_timeout_' . esc_sql($transient);
-                       if ( get_option($transient_timeout) < time() ) {
-                               delete_option($transient_option);
-                               delete_option($transient_timeout);
-                               return false;
+               $transient_option = '_transient_' . $transient;
+               if ( ! defined( 'WP_INSTALLING' ) ) {
+                       // If option is not in alloptions, it is not autoloaded and thus has a timeout
+                       $alloptions = wp_load_alloptions();
+                       if ( !isset( $alloptions[$transient_option] ) ) {
+                               $transient_timeout = '_transient_timeout_' . $transient;
+                               if ( get_option( $transient_timeout ) < time() ) {
+                                       delete_option( $transient_option  );
+                                       delete_option( $transient_timeout );
+                                       return false;
+                               }
                        }
                }
 
-               $value = get_option($transient_option);
+               $value = get_option( $transient_option );
        }
 
-       return apply_filters('transient_' . $transient, $value);
+       return apply_filters( 'transient_' . $transient, $value );
 }
 
 /**
  * Set/update the value of a transient
  *
- * You do not need to serialize values, if the value needs to be serialize, then
+ * You do not need to serialize values. If the value needs to be serialized, then
  * it will be serialized before it is set.
  *
  * @since 2.8.0
  * @package WordPress
  * @subpackage Transient
  *
- * @param string $transient Transient name. Expected to not be SQL-escaped
- * @param mixed $value Transient value.
+ * @uses apply_filters() Calls 'pre_set_transient_$transient' hook to allow overwriting the
+ *     transient value to be stored.
+ * @uses do_action() Calls 'set_transient_$transient' and 'setted_transient' hooks on success.
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @param mixed $value Transient value. Expected to not be SQL-escaped.
  * @param int $expiration Time until expiration in seconds, default 0
  * @return bool False if value was not set and true if value was set.
  */
-function set_transient($transient, $value, $expiration = 0) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function set_transient( $transient, $value, $expiration = 0 ) {
+       global $_wp_using_ext_object_cache;
+
+    $value = apply_filters( 'pre_set_transient_' . $transient, $value );
 
        if ( $_wp_using_ext_object_cache ) {
-               return wp_cache_set($transient, $value, 'transient', $expiration);
+               $result = wp_cache_set( $transient, $value, 'transient', $expiration );
        } else {
                $transient_timeout = '_transient_timeout_' . $transient;
                $transient = '_transient_' . $transient;
-               $safe_transient = esc_sql($transient);
-               if ( false === get_option( $safe_transient ) ) {
+               if ( false === get_option( $transient ) ) {
                        $autoload = 'yes';
-                       if ( 0 != $expiration ) {
+                       if ( $expiration ) {
                                $autoload = 'no';
-                               add_option($transient_timeout, time() + $expiration, '', 'no');
+                               add_option( $transient_timeout, time() + $expiration, '', 'no' );
                        }
-                       return add_option($transient, $value, '', $autoload);
+                       $result = add_option( $transient, $value, '', $autoload );
                } else {
-                       if ( 0 != $expiration )
-                               update_option($transient_timeout, time() + $expiration);
-                       return update_option($transient, $value);
+                       if ( $expiration )
+                               update_option( $transient_timeout, time() + $expiration );
+                       $result = update_option( $transient, $value );
                }
        }
+       if ( $result ) {
+               do_action( 'set_transient_' . $transient );
+               do_action( 'setted_transient', $transient );
+       }
+       return $result;
 }
 
 /**
@@ -767,7 +807,7 @@ function wp_user_settings() {
        if ( ! $user = wp_get_current_user() )
                return;
 
-       $settings = get_user_option( 'user-settings', $user->ID, false );
+       $settings = get_user_option( 'user-settings', $user->ID );
 
        if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) {
                $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] );
@@ -776,7 +816,7 @@ function wp_user_settings() {
                        if ( $cookie == $settings )
                                return;
 
-                       $last_time = (int) get_user_option( 'user-settings-time', $user->ID, false );
+                       $last_time = (int) get_user_option( 'user-settings-time', $user->ID );
                        $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0;
 
                        if ( $saved > $last_time ) {
@@ -915,6 +955,8 @@ function get_all_user_settings() {
  * @subpackage Option
  * @since 2.8.0
  *
+ * @param unknown $all
+ * @return bool
  */
 function wp_set_all_user_settings($all) {
        global $_updated_user_settings;
@@ -1143,14 +1185,16 @@ function do_enclose( $content, $post_ID ) {
                if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
                        $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
                        do_action( 'delete_postmeta', $mid );
-                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id IN(%s)", implode( ',', $mid ) ) );
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $mid ) ) );
                        do_action( 'deleted_postmeta', $mid );
                }
        }
 
        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 );
+                       $test = @parse_url( $link_test );
+                       if ( false === $test )
+                               continue;
                        if ( isset( $test['query'] ) )
                                $post_links[] = $link_test;
                        elseif ( $test['path'] != '/' && $test['path'] != '' )
@@ -1160,10 +1204,27 @@ function do_enclose( $content, $post_ID ) {
 
        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'];
                                $type = $headers['content-type'];
                                $allowed_types = array( 'video', 'audio' );
+
+                               // Check to see if we can figure out the mime type from
+                               // the extension
+                               $url_parts = @parse_url( $url );
+                               if ( false !== $url_parts ) {
+                                       $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
+                                       if ( !empty( $extension ) ) {
+                                               foreach ( get_allowed_mime_types( ) as $exts => $mime ) {
+                                                       if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
+                                                               $type = $mime;
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                               }
+
                                if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
                                        $meta_value = "$url\n$len\n$type\n";
                                        $wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) );
@@ -1184,12 +1245,15 @@ function do_enclose( $content, $post_ID ) {
  *
  * @param string $url URL to fetch.
  * @param string|bool $file_path Optional. File path to write request to.
- * @param bool $deprecated Deprecated. Not used.
+ * @param int $red (private) The number of Redirects followed, Upon 5 being hit, returns false.
  * @return bool|string False on failure and string of headers if HEAD request.
  */
-function wp_get_http( $url, $file_path = false, $deprecated = false ) {
+function wp_get_http( $url, $file_path = false, $red = 1 ) {
        @set_time_limit( 60 );
 
+       if ( $red > 5 )
+               return false;
+
        $options = array();
        $options['redirection'] = 5;
 
@@ -1206,6 +1270,11 @@ function wp_get_http( $url, $file_path = false, $deprecated = false ) {
        $headers = wp_remote_retrieve_headers( $response );
        $headers['response'] = $response['response']['code'];
 
+       // WP_HTTP no longer follows redirects for HEAD requests.
+       if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
+               return wp_get_http( $headers['location'], $file_path, ++$red );
+       }
+
        if ( false == $file_path )
                return $headers;
 
@@ -1216,6 +1285,7 @@ function wp_get_http( $url, $file_path = false, $deprecated = false ) {
 
        fwrite( $out_fp,  $response['body']);
        fclose($out_fp);
+       clearstatcache();
 
        return $headers;
 }
@@ -1230,6 +1300,9 @@ function wp_get_http( $url, $file_path = false, $deprecated = false ) {
  * @return bool|string False on failure, headers on success.
  */
 function wp_get_http_headers( $url, $deprecated = false ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.7' );
+
        $response = wp_remote_head( $url );
 
        if ( is_wp_error( $response ) )
@@ -1377,20 +1450,17 @@ function remove_query_arg( $key, $query=false ) {
 /**
  * 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.
  */
 function add_magic_quotes( $array ) {
-       global $wpdb;
-
        foreach ( (array) $array as $k => $v ) {
                if ( is_array( $v ) ) {
                        $array[$k] = add_magic_quotes( $v );
                } else {
-                       $array[$k] = esc_sql( $v );
+                       $array[$k] = addslashes( $v );
                }
        }
        return $array;
@@ -1423,7 +1493,7 @@ function wp_remote_fopen( $uri ) {
 }
 
 /**
- * Setup the WordPress query.
+ * Set up the WordPress query.
  *
  * @since 2.0.0
  *
@@ -1433,7 +1503,7 @@ function wp( $query_vars = '' ) {
        global $wp, $wp_query, $wp_the_query;
        $wp->main( $query_vars );
 
-       if( !isset($wp_the_query) )
+       if ( !isset($wp_the_query) )
                $wp_the_query = $wp_query;
 }
 
@@ -1525,7 +1595,7 @@ function get_status_header_desc( $code ) {
  *             parameters.
  *
  * @param int $header HTTP status code
- * @return null Does not return anything.
+ * @return unknown
  */
 function status_header( $header ) {
        $text = get_status_header_desc( $header );
@@ -1644,8 +1714,8 @@ function do_feed() {
 
        $hook = 'do_feed_' . $feed;
        if ( !has_action($hook) ) {
-               $message = sprintf( __( 'ERROR: %s is not a valid feed template' ), esc_html($feed));
-               wp_die($message);
+               $message = sprintf( __( 'ERROR: %s is not a valid feed template.' ), esc_html($feed));
+               wp_die( $message, '', array( 'response' => 404 ) );
        }
 
        do_action( $hook, $wp_query->is_comment_feed );
@@ -1711,13 +1781,17 @@ function do_robots() {
 
        do_action( 'do_robotstxt' );
 
-       if ( '0' == get_option( 'blog_public' ) ) {
-               echo "User-agent: *\n";
-               echo "Disallow: /\n";
+       $output = '';
+       $public = get_option( 'blog_public' );
+       if ( '0' ==  $public ) {
+               $output .= "User-agent: *\n";
+               $output .= "Disallow: /\n";
        } else {
-               echo "User-agent: *\n";
-               echo "Disallow:\n";
+               $output .= "User-agent: *\n";
+               $output .= "Disallow:\n";
        }
+
+       echo apply_filters('robots_txt', $output, $public);
 }
 
 /**
@@ -1742,7 +1816,9 @@ function is_blog_installed() {
                return true;
 
        $suppress = $wpdb->suppress_errors();
-       $alloptions = wp_load_alloptions();
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               $alloptions = wp_load_alloptions();
+       }
        // If siteurl is not set to autoload, check it specifically
        if ( !isset( $alloptions['siteurl'] ) )
                $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
@@ -1760,17 +1836,24 @@ function is_blog_installed() {
        $tables = $wpdb->get_col('SHOW TABLES');
        $wpdb->suppress_errors( $suppress );
 
+       $wp_tables = $wpdb->tables();
        // Loop over the WP tables.  If none exist, then scratch install is allowed.
        // If one or more exist, suggest table repair since we got here because the options
        // table could not be accessed.
-       foreach ($wpdb->tables as $table) {
+       foreach ( $wp_tables as $table ) {
                // If one of the WP tables exist, then we are in an insane state.
-               if ( in_array($wpdb->prefix . $table, $tables) ) {
+               if ( in_array( $table, $tables ) ) {
+                       // The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
+                       if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
+                               continue;
+                       if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
+                               continue;
+
                        // If visiting repair.php, return true and let it take over.
                        if ( defined('WP_REPAIRING') )
                                return true;
                        // Die with a DB error.
-                       $wpdb->error = __('One or more database tables are unavailable.  The database may need to be <a href="maint/repair.php?referrer=is_blog_installed">repaired</a>.');
+                       $wpdb->error = sprintf( /*WP_I18N_NO_TABLES*/'One or more database tables are unavailable.  The database may need to be <a href="%s">repaired</a>.'/*/WP_I18N_NO_TABLES*/, 'maint/repair.php?referrer=is_blog_installed' );
                        dead_db();
                }
        }
@@ -1836,7 +1919,7 @@ function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $ec
                echo $nonce_field;
 
        if ( $referer )
-               wp_referer_field( $echo, 'previous' );
+               wp_referer_field( $echo );
 
        return $nonce_field;
 }
@@ -1854,7 +1937,7 @@ function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $ec
  * @param bool $echo Whether to echo or return the referer field.
  * @return string Referer field.
  */
-function wp_referer_field( $echo = true) {
+function wp_referer_field( $echo = true ) {
        $ref = esc_attr( $_SERVER['REQUEST_URI'] );
        $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
 
@@ -1931,11 +2014,17 @@ function wp_get_original_referer() {
  * @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.
+ * @return bool Whether the path was created. True if path already exists.
  */
 function wp_mkdir_p( $target ) {
        // from php.net/mkdir user contributed notes
        $target = str_replace( '//', '/', $target );
+
+       // safe mode fails with a trailing slash under certain PHP versions.
+       $target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
+       if ( empty($target) )
+               $target = '/';
+
        if ( file_exists( $target ) )
                return @is_dir( $target );
 
@@ -2032,9 +2121,11 @@ function path_join( $base, $path ) {
  * @return array See above for description.
  */
 function wp_upload_dir( $time = null ) {
+       global $switched;
        $siteurl = get_option( 'siteurl' );
        $upload_path = get_option( 'upload_path' );
        $upload_path = trim($upload_path);
+       $main_override = defined( 'MULTISITE' ) && is_main_site();
        if ( empty($upload_path) ) {
                $dir = WP_CONTENT_DIR . '/uploads';
        } else {
@@ -2054,11 +2145,17 @@ function wp_upload_dir( $time = null ) {
                        $url = trailingslashit( $siteurl ) . $upload_path;
        }
 
-       if ( defined('UPLOADS') ) {
+       if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
                $dir = ABSPATH . UPLOADS;
                $url = trailingslashit( $siteurl ) . UPLOADS;
        }
 
+       if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
+               if ( defined( 'BLOGUPLOADDIR' ) )
+                       $dir = untrailingslashit(BLOGUPLOADDIR);
+               $url = str_replace( UPLOADS, 'files', $url );
+       }
+
        $bdir = $dir;
        $burl = $url;
 
@@ -2113,11 +2210,11 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
        $name = basename($filename, $ext);
 
        // edge case: if file is named '.ext', treat as an empty name
-       if( $name === $ext )
+       if ( $name === $ext )
                $name = '';
 
        // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
-       if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) {
+       if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
                $filename = $unique_filename_callback( $dir, $name );
        } else {
                $number = '';
@@ -2166,12 +2263,15 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
  * @since 2.0.0
  *
  * @param string $name
- * @param null $deprecated Not used. Set to null.
+ * @param null $deprecated Never 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( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.0' );
+
        if ( empty( $name ) )
                return array( 'error' => __( 'Empty filename' ) );
 
@@ -2184,6 +2284,12 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
        if ( $upload['error'] !== false )
                return $upload;
 
+       $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
+       if ( !is_array( $upload_bits_error ) ) {
+               $upload[ 'error' ] = $upload_bits_error;
+               return $upload;
+       }
+
        $filename = wp_unique_filename( $upload['path'], $name );
 
        $new_file = $upload['path'] . "/$filename";
@@ -2198,11 +2304,14 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
 
        @fwrite( $ifp, $bits );
        fclose( $ifp );
+       clearstatcache();
+
        // Set correct file permissions
        $stat = @ stat( dirname( $new_file ) );
        $perms = $stat['mode'] & 0007777;
        $perms = $perms & 0000666;
        @ chmod( $new_file, $perms );
+       clearstatcache();
 
        // Compute the URL
        $url = $upload['url'] . "/$filename";
@@ -2221,18 +2330,18 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
  * @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', 'm4v'),
-               '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'),
+       $ext2type = apply_filters( 'ext2type', array(
+               'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b', 'mka', 'mp1', 'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
+               'video'       => array( 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
+               'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf', 'rtf', 'wp',  'wpd' ),
+               'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsb',  'xlsm' ),
+               'interactive' => array( 'key', 'ppt',  'pptx', 'pptm', 'odp',  'swf' ),
+               'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
+               'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit', 'sqx', 'tar', 'tgz',  'zip' ),
+               'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
        ));
        foreach ( $ext2type as $type => $exts )
-               if ( in_array($ext, $exts) )
+               if ( in_array( $ext, $exts ) )
                        return $type;
 }
 
@@ -2265,6 +2374,74 @@ function wp_check_filetype( $filename, $mimes = null ) {
        return compact( 'ext', 'type' );
 }
 
+/**
+ * Attempt to determine the real file type of a file.
+ * If unable to, the file name extension will be used to determine type.
+ *
+ * If it's determined that the extension does not match the file's real type,
+ * then the "proper_filename" value will be set with a proper filename and extension.
+ *
+ * Currently this function only supports validating images known to getimagesize().
+ *
+ * @since 3.0.0
+ *
+ * @param string $file Full path to the image.
+ * @param string $filename The filename of the image (may differ from $file due to $file being in a tmp directory)
+ * @param array $mimes Optional. Key is the file extension with value as the mime type.
+ * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid
+ */
+function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
+
+       $proper_filename = false;
+
+       // Do basic extension validation and MIME mapping
+       $wp_filetype = wp_check_filetype( $filename, $mimes );
+       extract( $wp_filetype );
+
+       // We can't do any further validation without a file to work with
+       if ( ! file_exists( $file ) )
+               return compact( 'ext', 'type', 'proper_filename' );
+
+       // We're able to validate images using GD
+       if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
+
+               // Attempt to figure out what type of image it actually is
+               $imgstats = @getimagesize( $file );
+
+               // If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
+               if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
+                       // This is a simplified array of MIMEs that getimagesize() can detect and their extensions
+                       // You shouldn't need to use this filter, but it's here just in case
+                       $mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
+                               'image/jpeg' => 'jpg',
+                               'image/png'  => 'png',
+                               'image/gif'  => 'gif',
+                               'image/bmp'  => 'bmp',
+                               'image/tiff' => 'tif',
+                       ) );
+
+                       // Replace whatever is after the last period in the filename with the correct extension
+                       if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
+                               $filename_parts = explode( '.', $filename );
+                               array_pop( $filename_parts );
+                               $filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
+                               $new_filename = implode( '.', $filename_parts );
+
+                               if ( $new_filename != $filename )
+                                       $proper_filename = $new_filename; // Mark that it changed
+
+                               // Redefine the extension / MIME
+                               $wp_filetype = wp_check_filetype( $new_filename, $mimes );
+                               extract( $wp_filetype );
+                       }
+               }
+       }
+
+       // Let plugins try and validate other types of files
+       // Should return an array in the style of array( 'ext' => $ext, 'type' => $type, 'proper_filename' => $proper_filename )
+       return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
+}
+
 /**
  * Retrieve list of allowed mime types and file extensions.
  *
@@ -2290,26 +2467,36 @@ function get_allowed_mime_types() {
                'flv' => 'video/x-flv',
                'mov|qt' => 'video/quicktime',
                'mpeg|mpg|mpe' => 'video/mpeg',
-               'txt|c|cc|h' => 'text/plain',
+               'txt|asc|c|cc|h' => 'text/plain',
+               'csv' => 'text/csv',
+               'tsv' => 'text/tab-separated-values',
                'rtx' => 'text/richtext',
                'css' => 'text/css',
                'htm|html' => 'text/html',
-               'mp3|m4a' => 'audio/mpeg',
+               'mp3|m4a|m4b' => 'audio/mpeg',
                'mp4|m4v' => 'video/mp4',
                'ra|ram' => 'audio/x-realaudio',
                'wav' => 'audio/wav',
-               'ogg' => 'audio/ogg',
+               'ogg|oga' => 'audio/ogg',
+               'ogv' => 'video/ogg',
                'mid|midi' => 'audio/midi',
                'wma' => 'audio/wma',
+               'mka' => 'audio/x-matroska',
+               'mkv' => 'video/x-matroska',
                'rtf' => 'application/rtf',
                'js' => 'application/javascript',
                'pdf' => 'application/pdf',
                'doc|docx' => 'application/msword',
-               'pot|pps|ppt|pptx' => 'application/vnd.ms-powerpoint',
+               'pot|pps|ppt|pptx|ppam|pptm|sldm|ppsm|potm' => 'application/vnd.ms-powerpoint',
                'wri' => 'application/vnd.ms-write',
-               'xla|xls|xlsx|xlt|xlw' => 'application/vnd.ms-excel',
+               'xla|xls|xlsx|xlt|xlw|xlam|xlsb|xlsm|xltm' => 'application/vnd.ms-excel',
                'mdb' => 'application/vnd.ms-access',
                'mpp' => 'application/vnd.ms-project',
+               'docm|dotm' => 'application/vnd.ms-word',
+               'pptx|sldx|ppsx|potx' => 'application/vnd.openxmlformats-officedocument.presentationml',
+               'xlsx|xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml',
+               'docx|dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml',
+               'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
                'swf' => 'application/x-shockwave-flash',
                'class' => 'application/java',
                'tar' => 'application/x-tar',
@@ -2324,6 +2511,8 @@ function get_allowed_mime_types() {
                'odc' => 'application/vnd.oasis.opendocument.chart',
                'odb' => 'application/vnd.oasis.opendocument.database',
                'odf' => 'application/vnd.oasis.opendocument.formula',
+               // wordperfect formats
+               'wp|wpd' => 'application/wordperfect',
                ) );
        }
 
@@ -2451,10 +2640,11 @@ function wp_nonce_ays( $action ) {
        wp_die( $html, $title, array('response' => 403) );
 }
 
+
 /**
  * Kill WordPress execution and display HTML message with error message.
  *
- * Call this function complements the die() PHP function. The difference is that
+ * 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
@@ -2467,8 +2657,29 @@ function wp_nonce_ays( $action ) {
  * @param string|array $args Optional arguements to control behaviour.
  */
 function wp_die( $message, $title = '', $args = array() ) {
-       global $wp_locale;
+       if ( function_exists( 'apply_filters' ) ) {
+               $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler');
+       }else {
+               $function = '_default_wp_die_handler';
+       }
 
+       call_user_func( $function, $message, $title, $args );
+}
+
+/**
+ * Kill WordPress execution and display HTML message with error message.
+ *
+ * This is the default handler for wp_die if you want a custom one for your
+ * site then you can overload using the wp_die_handler filter in wp_die
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param string $message Error message.
+ * @param string $title Error title.
+ * @param string|array $args Optional arguements to control behaviour.
+ */
+function _default_wp_die_handler( $message, $title = '', $args = array() ) {
        $defaults = array( 'response' => 500 );
        $r = wp_parse_args($args, $defaults);
 
@@ -2511,19 +2722,20 @@ function wp_die( $message, $title = '', $args = array() ) {
                $admin_dir = 'wp-admin/';
 
        if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) :
-       if( !headers_sent() ){
+       if ( !headers_sent() ) {
                status_header( $r['response'] );
                nocache_headers();
                header( 'Content-Type: text/html; charset=utf-8' );
        }
 
-       if ( empty($title) ) {
-               $title = $have_gettext? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
-       }
+       if ( empty($title) )
+               $title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
 
        $text_direction = 'ltr';
-       if ( isset($r['text_direction']) && $r['text_direction'] == 'rtl' ) $text_direction = 'rtl';
-       if ( ( $wp_locale ) && ( 'rtl' == $wp_locale->text_direction ) ) $text_direction = 'rtl';
+       if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
+               $text_direction = 'rtl';
+       elseif ( function_exists( 'is_rtl' ) && is_rtl() )
+               $text_direction = 'rtl';
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono -->
@@ -2604,9 +2816,7 @@ function _config_wp_siteurl( $url = '' ) {
  * @return array Direction set for 'rtl', if needed by locale.
  */
 function _mce_set_direction( $input ) {
-       global $wp_locale;
-
-       if ( 'rtl' == $wp_locale->text_direction ) {
+       if ( is_rtl() ) {
                $input['directionality'] = 'rtl';
                $input['plugins'] .= ',directionality';
                $input['theme_advanced_buttons1'] .= ',ltr';
@@ -2752,13 +2962,67 @@ function wp_parse_args( $args, $defaults = '' ) {
        return $r;
 }
 
+/**
+ * Clean up an array, comma- or space-separated list of IDs
+ *
+ * @since 3.0.0
+ *
+ * @param array|string $list
+ * @return array Sanitized array of IDs
+ */
+function wp_parse_id_list( $list ) {
+       if ( !is_array($list) )
+               $list = preg_split('/[\s,]+/', $list);
+
+       return array_unique(array_map('absint', $list));
+}
+
+/**
+ * Filters a list of objects, based on a set of key => value arguments
+ *
+ * @since 3.0.0
+ *
+ * @param array $list An array of objects to filter
+ * @param array $args An array of key => value arguments to match against each object
+ * @param string $operator The logical operation to perform. 'or' means only one element
+ *     from the array needs to match; 'and' means all elements must match. The default is 'and'.
+ * @param bool|string $field A field from the object to place instead of the entire object
+ * @return array A list of objects or object fields
+ */
+function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
+       if ( !is_array($list) )
+               return array();
+
+       if ( empty($args) )
+               $args = array();
+
+       if ( empty($args) && !$field )
+               return $list;   // nothing to do
+
+       $count = count($args);
+
+       $filtered = array();
+
+       foreach ( $list as $key => $obj ) {
+               $matched = count(array_intersect_assoc(get_object_vars($obj), $args));
+               if ( ('and' == $operator && $matched == $count) || ('or' == $operator && $matched <= $count) ) {
+                       if ( $field )
+                               $filtered[] = $obj->$field;
+                       else
+                               $filtered[$key] = $obj;
+               }
+       }
+
+       return $filtered;
+}
+
 /**
  * Determines if default embed handlers should be loaded.
  *
  * Checks to make sure that the embeds library hasn't already been loaded. If
  * it hasn't, then it will load the embeds library.
  *
- * @since 2.9
+ * @since 2.9.0
  */
 function wp_maybe_load_embeds() {
        if ( ! apply_filters('load_default_embeds', true) )
@@ -2790,7 +3054,7 @@ function wp_maybe_load_widgets() {
  */
 function wp_widgets_add_menu() {
        global $submenu;
-       $submenu['themes.php'][7] = array( __( 'Widgets' ), 'switch_themes', 'widgets.php' );
+       $submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
        ksort( $submenu['themes.php'], SORT_NUMERIC );
 }
 
@@ -2895,7 +3159,8 @@ function absint( $maybeint ) {
  *
  * @since 2.5.0
  *
- * @return bool Whether or not SSL access is available
+ * @param string $url
+ * @return bool Whether SSL access is available
  */
 function url_is_accessable_via_ssl($url)
 {
@@ -2949,24 +3214,26 @@ function atom_service_url_filter($url)
  * This function is to be used in every function in depreceated.php
  *
  * @package WordPress
- * @package Debug
+ * @subpackage Debug
  * @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.
+ * @uses do_action() Calls 'deprecated_function_run' and passes the function name, what to use instead,
+ *   and the version the function was deprecated in.
+ * @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 deprecated the function
  * @param string $replacement Optional. The function that should have been called
  */
-function _deprecated_function($function, $version, $replacement=null) {
+function _deprecated_function( $function, $version, $replacement=null ) {
 
-       do_action('deprecated_function_run', $function, $replacement);
+       do_action( 'deprecated_function_run', $function, $replacement, $version );
 
        // Allow plugin to filter the output error trigger
-       if( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true )) {
-               if( !is_null($replacement) )
+       if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
+               if ( ! is_null($replacement) )
                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
                else
                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
@@ -2985,27 +3252,75 @@ function _deprecated_function($function, $version, $replacement=null) {
  * This function is to be used in every file that is depreceated
  *
  * @package WordPress
- * @package Debug
+ * @subpackage Debug
  * @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.
+ * @uses do_action() Calls 'deprecated_file_included' and passes the file name, what to use instead,
+ *   the version in which the file was deprecated, and any message regarding the change.
+ * @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 deprecated the function
- * @param string $replacement Optional. The function that should have been called
+ * @param string $version The version of WordPress that deprecated the file
+ * @param string $replacement Optional. The file that should have been included based on ABSPATH
+ * @param string $message Optional. A message regarding the change
+ */
+function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
+
+       do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
+
+       // Allow plugin to filter the output error trigger
+       if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
+               $message = empty( $message ) ? '' : ' ' . $message;
+               if ( ! is_null( $replacement ) )
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
+               else
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
+       }
+}
+/**
+ * Marks a function argument as deprecated and informs when it has been used.
+ *
+ * This function is to be used whenever a deprecated function argument is used.
+ * Before this function is called, the argument must be checked for whether it was
+ * used by comparing it to its default value or evaluating whether it is empty.
+ * For example:
+ * <code>
+ * if ( !empty($deprecated) )
+ *     _deprecated_argument( __FUNCTION__, '3.0' );
+ * </code>
+ *
+ * There is a hook deprecated_argument_run that will be called that can be used
+ * to get the backtrace up to what file and function used the deprecated
+ * argument.
+ *
+ * The current behavior is to trigger an user error if WP_DEBUG is true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since 3.0.0
+ * @access private
+ *
+ * @uses do_action() Calls 'deprecated_argument_run' and passes the function name, a message on the change,
+ *   and the version in which the argument was deprecated.
+ * @uses apply_filters() Calls 'deprecated_argument_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 deprecated the argument used
+ * @param string $message Optional. A message regarding the change.
  */
-function _deprecated_file($file, $version, $replacement=null) {
+function _deprecated_argument( $function, $version, $message = null ) {
 
-       do_action('deprecated_file_included', $file, $replacement);
+       do_action( 'deprecated_argument_run', $function, $message, $version );
 
        // Allow plugin to filter the output error trigger
-       if( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
-               if( !is_null($replacement) )
-                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
+       if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
+               if ( ! is_null( $message ) )
+                       trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
                else
-                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) );
+                       trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
        }
 }
 
@@ -3154,7 +3469,7 @@ function wp_guess_url() {
        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
                $url = WP_SITEURL;
        } else {
-               $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+               $schema = is_ssl() ? 'https://' : 'http://';
                $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        }
        return $url;
@@ -3180,59 +3495,222 @@ function wp_suspend_cache_invalidation($suspend = true) {
        return $current_suspend;
 }
 
-function get_site_option( $key, $default = false, $use_cache = true ) {
+/**
+ * Retrieve site option value based on name of option.
+ *
+ * @see get_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ * @uses apply_filters() Calls 'pre_site_option_$option' before checking the option.
+ *     Any value other than false will "short-circuit" the retrieval of the option
+ *     and return the returned value.
+ * @uses apply_filters() Calls 'site_option_$option', after checking the  option, with
+ *     the option value.
+ *
+ * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
+ * @param mixed $default Optional value to return if option doesn't exist. Default false.
+ * @param bool $use_cache Whether to use cache. Multisite only. Default true.
+ * @return mixed Value set for the option.
+ */
+function get_site_option( $option, $default = false, $use_cache = true ) {
+       global $wpdb;
+
        // Allow plugins to short-circuit site options.
-       $pre = apply_filters( 'pre_site_option_' . $key, false );
+       $pre = apply_filters( 'pre_site_option_' . $option, false );
        if ( false !== $pre )
                return $pre;
 
-       $value = get_option($key, $default);
+       if ( !is_multisite() ) {
+               $value = get_option($option, $default);
+       } else {
+               $cache_key = "{$wpdb->siteid}:$option";
+               if ( $use_cache )
+                       $value = wp_cache_get($cache_key, 'site-options');
+
+               if ( !isset($value) || (false === $value) ) {
+                       $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
 
-       return apply_filters( 'site_option_' . $key, $value );
+                       // Has to be get_row instead of get_var because of funkiness with 0, false, null values
+                       if ( is_object( $row ) )
+                               $value = $row->meta_value;
+                       else
+                               $value = $default;
+
+                       $value = maybe_unserialize( $value );
+
+                       wp_cache_set( $cache_key, $value, 'site-options' );
+               }
+       }
+
+       return apply_filters( 'site_option_' . $option, $value );
 }
 
-// expects $key, $value not to be SQL escaped
-function add_site_option( $key, $value ) {
-       $value = apply_filters( 'pre_add_site_option_' . $key, $value );
-       $result =  add_option($key, $value);
-       do_action( "add_site_option_{$key}", $key, $value );
+/**
+ * Add a new site option.
+ *
+ * @see add_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ * @uses apply_filters() Calls 'pre_add_site_option_$option' hook to allow overwriting the
+ *     option value to be stored.
+ * @uses do_action() Calls 'add_site_option_$option' and 'add_site_option' hooks on success.
+ *
+ * @param string $option Name of option to add. Expected to not be SQL-escaped.
+ * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped.
+ * @return bool False if option was not added and true if option was added.
+ */
+function add_site_option( $option, $value ) {
+       global $wpdb;
+
+       $value = apply_filters( 'pre_add_site_option_' . $option, $value );
+
+       if ( !is_multisite() ) {
+               $result = add_option( $option, $value );
+       } else {
+               $cache_key = "{$wpdb->siteid}:$option";
+
+               if ( $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) )
+                       return update_site_option( $option, $value );
+
+               $value = sanitize_option( $option, $value );
+               wp_cache_set( $cache_key, $value, 'site-options' );
+
+               $_value = $value;
+               $value = maybe_serialize($value);
+               $result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $value ) );
+               $value = $_value;
+       }
+
+       do_action( "add_site_option_{$option}", $option, $value );
+       do_action( "add_site_option", $option, $value );
+
        return $result;
 }
 
-function delete_site_option( $key ) {
-       $result = delete_option($key);
-       do_action( "delete_site_option_{$key}", $key );
-       return $result;
+/**
+ * Removes site option by name.
+ *
+ * @see delete_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ * @uses do_action() Calls 'pre_delete_site_option_$option' hook before option is deleted.
+ * @uses do_action() Calls 'delete_site_option' and 'delete_site_option_$option'
+ *     hooks on success.
+ *
+ * @param string $option Name of option to remove. Expected to not be SQL-escaped.
+ * @return bool True, if succeed. False, if failure.
+ */
+function delete_site_option( $option ) {
+       global $wpdb;
+
+       // ms_protect_special_option( $option ); @todo
+
+       do_action( 'pre_delete_site_option_' . $option );
+
+       if ( !is_multisite() ) {
+               $result = delete_option( $option );
+       } else {
+               $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
+               if ( is_null( $row ) || !$row->meta_id )
+                       return false;
+               $cache_key = "{$wpdb->siteid}:$option";
+               wp_cache_delete( $cache_key, 'site-options' );
+
+               $result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
+       }
+
+       if ( $result ) {
+               do_action( "delete_site_option_{$option}", $option );
+               do_action( "delete_site_option", $option );
+               return true;
+       }
+       return false;
 }
 
-// expects $key, $value not to be SQL escaped
-function update_site_option( $key, $value ) {
-       $oldvalue = get_site_option( $key );
-       $value = apply_filters( 'pre_update_site_option_' . $key, $value, $oldvalue );
-       $result = update_option($key, $value);
-       do_action( "update_site_option_{$key}", $key, $value );
-       return $result;
+/**
+ * Update the value of a site option that was already added.
+ *
+ * @see update_option()
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @uses apply_filters() Calls 'pre_update_site_option_$option' hook to allow overwriting the
+ *     option value to be stored.
+ * @uses do_action() Calls 'update_site_option_$option' and 'update_site_option' hooks on success.
+ *
+ * @param string $option Name of option. Expected to not be SQL-escaped.
+ * @param mixed $value Option value. Expected to not be SQL-escaped.
+ * @return bool False if value was not updated and true if value was updated.
+ */
+function update_site_option( $option, $value ) {
+       global $wpdb;
+
+       $oldvalue = get_site_option( $option );
+       $value = apply_filters( 'pre_update_site_option_' . $option, $value, $oldvalue );
+
+       if ( $value === $oldvalue )
+               return false;
+
+       if ( !is_multisite() ) {
+               $result = update_option( $option, $value );
+       } else {
+               $cache_key = "{$wpdb->siteid}:$option";
+
+               if ( $value && !$wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) )
+                       return add_site_option( $option, $value );
+               $value = sanitize_option( $option, $value );
+               wp_cache_set( $cache_key, $value, 'site-options' );
+
+               $_value = $value;
+               $value = maybe_serialize( $value );
+               $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $value ), array( 'site_id' => $wpdb->siteid, 'meta_key' => $option ) );
+               $value = $_value;
+       }
+
+       if ( $result ) {
+               do_action( "update_site_option_{$option}", $option, $value );
+               do_action( "update_site_option", $option, $value );
+               return true;
+       }
+       return false;
 }
 
 /**
  * Delete a site transient
  *
- * @since 2.890
+ * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
  *
- * @param string $transient Transient name. Expected to not be SQL-escaped
- * @return bool true if successful, false otherwise
+ * @uses do_action() Calls 'delete_site_transient_$transient' hook before transient is deleted.
+ * @uses do_action() Calls 'deleted_site_transient' hook on success.
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return bool True if successful, false otherwise
  */
-function delete_site_transient($transient) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function delete_site_transient( $transient ) {
+       global $_wp_using_ext_object_cache;
 
+       do_action( 'delete_site_transient_' . $transient, $transient );
        if ( $_wp_using_ext_object_cache ) {
-               return wp_cache_delete($transient, 'site-transient');
+               $result = wp_cache_delete( $transient, 'site-transient' );
        } else {
-               $transient = '_site_transient_' . esc_sql($transient);
-               return delete_site_option($transient);
+               $option_timeout = '_site_transient_timeout_' . $transient;
+               $option = '_site_transient_' . $transient;
+               $result = delete_site_option( $option );
+               if ( $result )
+                       delete_site_option( $option_timeout );
        }
+       if ( $result )
+               do_action( 'deleted_site_transient', $transient );
+       return $result;
 }
 
 /**
@@ -3240,36 +3718,48 @@ function delete_site_transient($transient) {
  *
  * If the transient does not exist or does not have a value, then the return value
  * will be false.
- * 
+ *
+ * @see get_transient()
  * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
  *
- * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @uses apply_filters() Calls 'pre_site_transient_$transient' hook before checking the transient.
+ *     Any value other than false will "short-circuit" the retrieval of the transient
+ *     and return the returned value.
+ * @uses apply_filters() Calls 'site_transient_$option' hook, after checking the transient, with
+ *     the transient value.
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
  * @return mixed Value of transient
  */
-function get_site_transient($transient) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function get_site_transient( $transient ) {
+       global $_wp_using_ext_object_cache;
 
        $pre = apply_filters( 'pre_site_transient_' . $transient, false );
        if ( false !== $pre )
                return $pre;
 
        if ( $_wp_using_ext_object_cache ) {
-               $value = wp_cache_get($transient, 'site-transient');
+               $value = wp_cache_get( $transient, 'site-transient' );
        } else {
-               $transient_option = '_site_transient_' . esc_sql($transient);
-               $transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
-               if ( get_site_option($transient_timeout) < time() ) {
-                       delete_site_option($transient_option);
-                       delete_site_option($transient_timeout);
-                       return false;
+               // Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
+               $no_timeout = array('update_core', 'update_plugins', 'update_themes');
+               $transient_option = '_site_transient_' . $transient;
+               if ( ! in_array( $transient, $no_timeout ) ) {
+                       $transient_timeout = '_site_transient_timeout_' . $transient;
+                       $timeout = get_site_option( $transient_timeout );
+                       if ( false !== $timeout && $timeout < time() ) {
+                               delete_site_option( $transient_option  );
+                               delete_site_option( $transient_timeout );
+                               return false;
+                       }
                }
 
-               $value = get_site_option($transient_option);
+               $value = get_site_option( $transient_option );
        }
 
-       return apply_filters('site_transient_' . $transient, $value);
+       return apply_filters( 'site_transient_' . $transient, $value );
 }
 
 /**
@@ -3278,40 +3768,101 @@ function get_site_transient($transient) {
  * You do not need to serialize values, if the value needs to be serialize, then
  * it will be serialized before it is set.
  *
+ * @see set_transient()
  * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
  *
- * @param string $transient Transient name. Expected to not be SQL-escaped
- * @param mixed $value Transient value.
+ * @uses apply_filters() Calls 'pre_set_site_transient_$transient' hook to allow overwriting the
+ *     transient value to be stored.
+ * @uses do_action() Calls 'set_site_transient_$transient' and 'setted_site_transient' hooks on success.
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @param mixed $value Transient value. Expected to not be SQL-escaped.
  * @param int $expiration Time until expiration in seconds, default 0
  * @return bool False if value was not set and true if value was set.
  */
-function set_site_transient($transient, $value, $expiration = 0) {
-       global $_wp_using_ext_object_cache, $wpdb;
+function set_site_transient( $transient, $value, $expiration = 0 ) {
+       global $_wp_using_ext_object_cache;
+
+    $value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
 
        if ( $_wp_using_ext_object_cache ) {
-               return wp_cache_set($transient, $value, 'site-transient', $expiration);
+               $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
        } else {
                $transient_timeout = '_site_transient_timeout_' . $transient;
                $transient = '_site_transient_' . $transient;
-               $safe_transient = esc_sql($transient);
-               if ( false === get_site_option( $safe_transient ) ) {
-                       if ( 0 != $expiration )
-                               add_site_option($transient_timeout, time() + $expiration);
-                       return add_site_option($transient, $value);
+               if ( false === get_site_option( $transient ) ) {
+                       if ( $expiration )
+                               add_site_option( $transient_timeout, time() + $expiration );
+                       $result = add_site_option( $transient, $value );
                } else {
-                       if ( 0 != $expiration )
-                               update_site_option($transient_timeout, time() + $expiration);
-                       return update_site_option($transient, $value);
+                       if ( $expiration )
+                               update_site_option( $transient_timeout, time() + $expiration );
+                       $result = update_site_option( $transient, $value );
                }
        }
+       if ( $result ) {
+               do_action( 'set_site_transient_' . $transient );
+               do_action( 'setted_site_transient', $transient );
+       }
+       return $result;
+}
+
+/**
+ * is main site
+ *
+ *
+ * @since 3.0.0
+ * @package WordPress
+ *
+ * @param int $blog_id optional blog id to test (default current blog)
+ * @return bool True if not multisite or $blog_id is main site
+ */
+function is_main_site( $blog_id = '' ) {
+       global $current_site, $current_blog;
+
+       if ( !is_multisite() )
+               return true;
+
+       if ( !$blog_id )
+               $blog_id = $current_blog->blog_id;
+
+       return $blog_id == $current_site->blog_id;
+}
+
+/**
+ * Whether global terms are enabled.
+ *
+ *
+ * @since 3.0.0
+ * @package WordPress
+ *
+ * @return bool True if multisite and global terms enabled
+ */
+function global_terms_enabled() {
+       if ( ! is_multisite() )
+               return false;
+
+       static $global_terms = null;
+       if ( is_null( $global_terms ) ) {
+               $filter = apply_filters( 'global_terms_enabled', null );
+               if ( ! is_null( $filter ) )
+                       $global_terms = (bool) $filter;
+               else
+                       $global_terms = (bool) get_site_option( 'global_terms_enabled', false );
+       }
+       return $global_terms;
 }
 
 /**
  * gmt_offset modification for smart timezone handling
  *
  * Overrides the gmt_offset option if we have a timezone_string available
+ *
+ * @since 2.8.0
+ *
+ * @return float|bool
  */
 function wp_timezone_override_offset() {
        if ( !wp_timezone_supported() ) {
@@ -3321,7 +3872,6 @@ function wp_timezone_override_offset() {
                return false;
        }
 
-       @date_default_timezone_set( $timezone_string );
        $timezone_object = timezone_open( $timezone_string );
        $datetime_object = date_create();
        if ( false === $timezone_object || false === $datetime_object ) {
@@ -3332,10 +3882,15 @@ function wp_timezone_override_offset() {
 
 /**
  * Check for PHP timezone support
+ *
+ * @since 2.9.0
+ *
+ * @return bool
  */
 function wp_timezone_supported() {
        $support = false;
        if (
+               function_exists( 'date_create' ) &&
                function_exists( 'date_default_timezone_set' ) &&
                function_exists( 'timezone_identifiers_list' ) &&
                function_exists( 'timezone_open' ) &&
@@ -3346,6 +3901,15 @@ function wp_timezone_supported() {
        return apply_filters( 'timezone_support', $support );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.9.0
+ *
+ * @param unknown_type $a
+ * @param unknown_type $b
+ * @return int
+ */
 function _wp_timezone_choice_usort_callback( $a, $b ) {
        // Don't use translated versions of Etc
        if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
@@ -3387,8 +3951,10 @@ function _wp_timezone_choice_usort_callback( $a, $b ) {
 /**
  * Gives a nicely formatted list of timezone strings // temporary! Not in final
  *
- * @param $selected_zone string Selected Zone
+ * @since 2.9.0
  *
+ * @param string $selected_zone Selected Zone
+ * @return string
  */
 function wp_timezone_choice( $selected_zone ) {
        static $mo_loaded = false;
@@ -3412,13 +3978,13 @@ function wp_timezone_choice( $selected_zone ) {
 
                // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
                $exists = array(
-                       0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
-                       1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
-                       2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
+                       0 => ( isset( $zone[0] ) && $zone[0] ),
+                       1 => ( isset( $zone[1] ) && $zone[1] ),
+                       2 => ( isset( $zone[2] ) && $zone[2] ),
                );
-               $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
-               $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
-               $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
+               $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
+               $exists[4] = ( $exists[1] && $exists[3] );
+               $exists[5] = ( $exists[2] && $exists[3] );
 
                $zonen[] = array(
                        'continent'   => ( $exists[0] ? $zone[0] : '' ),
@@ -3504,7 +4070,7 @@ function wp_timezone_choice( $selected_zone ) {
                if ( $offset_value === $selected_zone )
                        $selected = 'selected="selected" ';
                $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
-               
+
        }
        $structure[] = '</optgroup>';
 
@@ -3515,8 +4081,11 @@ function wp_timezone_choice( $selected_zone ) {
  * Strip close comment and close php tags from file headers used by WP
  * See http://core.trac.wordpress.org/ticket/8497
  *
- * @since 2.8
-**/
+ * @since 2.8.0
+ *
+ * @param string $str
+ * @return string
+ */
 function _cleanup_header_comment($str) {
        return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
 }
@@ -3525,8 +4094,6 @@ function _cleanup_header_comment($str) {
  * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
  *
  * @since 2.9.0
- *
- * @return void
  */
 function wp_scheduled_delete() {
        global $wpdb;
@@ -3571,7 +4138,7 @@ function wp_scheduled_delete() {
 /**
  * Parse the file contents to retrieve its metadata.
  *
- * Searches for metadata for a file, such as a plugin or theme.  Each piece of 
+ * Searches for metadata for a file, such as a plugin or theme.  Each piece of
  * metadata must be on its own line. For a field spanning multple lines, it
  * must not have any newlines or only parts of it will be displayed.
  *
@@ -3591,7 +4158,7 @@ function wp_scheduled_delete() {
  *
  * @param string $file Path to the file
  * @param bool $markup If the returned data should have HTML markup applied
- * @param string $context If specified adds filter hook "extra_<$context>_headers" 
+ * @param string $context If specified adds filter hook "extra_<$context>_headers"
  */
 function get_file_data( $file, $default_headers, $context = '' ) {
        // We don't need to write to the file, so just open for reading.
@@ -3603,7 +4170,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
        // PHP will close file handle, but we are good citizens.
        fclose( $fp );
 
-       if( $context != '' ) {
+       if ( $context != '' ) {
                $extra_headers = apply_filters( "extra_$context".'_headers', array() );
 
                $extra_headers = array_flip( $extra_headers );
@@ -3615,7 +4182,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
                $all_headers = $default_headers;
        }
 
-       
+
        foreach ( $all_headers as $field => $regex ) {
                preg_match( '/' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});
                if ( !empty( ${$field} ) )
@@ -3625,16 +4192,109 @@ function get_file_data( $file, $default_headers, $context = '' ) {
        }
 
        $file_data = compact( array_keys( $all_headers ) );
-       
+
        return $file_data;
 }
 /*
  * Used internally to tidy up the search terms
- * 
- * @private
+ *
+ * @access private
  * @since 2.9.0
+ *
+ * @param string $t
+ * @return string
  */
 function _search_terms_tidy($t) {
        return trim($t, "\"'\n\r ");
 }
+
+/**
+ * Returns true
+ *
+ * Useful for returning true to filters easily
+ *
+ * @since 3.0.0
+ * @see __return_false()
+ * @return bool true
+ */
+function __return_true() {
+       return true;
+}
+
+/**
+ * Returns false
+ *
+ * Useful for returning false to filters easily
+ *
+ * @since 3.0.0
+ * @see __return_true()
+ * @return bool false
+ */
+function __return_false() {
+       return false;
+}
+
+/**
+ * Returns 0
+ *
+ * Useful for returning 0 to filters easily
+ *
+ * @since 3.0.0
+ * @see __return_zero()
+ * @return int 0
+ */
+function __return_zero() {
+       return 0;
+}
+
+/**
+ * Returns an empty array
+ *
+ * Useful for returning an empty array to filters easily
+ *
+ * @since 3.0.0
+ * @see __return_zero()
+ * @return array Empty array
+ */
+function __return_empty_array() {
+       return array();
+}
+
+/**
+ * Send a HTTP header to disable content type sniffing in browsers which support it.
+ *
+ * @link http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
+ * @link http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
+ *
+ * @since 3.0.0
+ * @return none
+ */
+function send_nosniff_header() {
+       @header( 'X-Content-Type-Options: nosniff' );
+}
+
+/**
+ * Returns a MySQL expression for selecting the week number based on the start_of_week option.
+ *
+ * @internal
+ * @since 3.0.0
+ * @param string $column
+ * @return string
+ */
+function _wp_mysql_week( $column ) {
+       switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
+       default :
+       case 0 :
+               return "WEEK( $column, 0 )";
+       case 1 :
+               return "WEEK( $column, 1 )";
+       case 2 :
+       case 3 :
+       case 4 :
+       case 5 :
+       case 6 :
+               return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
+       }
+}
+
 ?>
index 0a60c96878c85fa2c798ef543c8dc5931304d797..f284435efd75c270668220250f0cb4c0c3bc040f 100644 (file)
@@ -38,7 +38,12 @@ function wp_print_scripts( $handles = false ) {
  * Register new JavaScript file.
  *
  * @since r16
- * @see WP_Dependencies::add() For parameter information.
+ * @param string $handle Script name
+ * @param string $src Script url
+ * @param array $deps (optional) Array of script names on which this script depends
+ * @param string|bool $ver (optional) Script version (used for cache busting), set to NULL to disable
+ * @param bool (optional) Wether to enqueue the script before </head> or before </body>
+ * @return null
  */
 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
        global $wp_scripts;
@@ -56,7 +61,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f
  * Localizes only if script has already been added.
  *
  * @since r16
- * @see WP_Script::localize()
+ * @see WP_Scripts::localize()
  */
 function wp_localize_script( $handle, $object_name, $l10n ) {
        global $wp_scripts;
@@ -86,8 +91,8 @@ function wp_deregister_script( $handle ) {
  * Registers the script if src provided (does NOT overwrite) and enqueues.
  *
  * @since r16
- * @see WP_Script::add(), WP_Script::enqueue()
-*/
+ * @see wp_register_script() For parameter information.
+ */
 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
index 5251bdaab34232466e03bb9ef5cede10108c87cd..df4bd5ac4217be3c3901569baecc7e47e6bcd19b 100644 (file)
@@ -13,7 +13,8 @@
  * @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.
+ * @param array|bool $handles Styles to be printed. An empty array prints the queue,
+ *  an array with one string prints that style, and an array of strings prints those styles.
  * @return bool True on success, false on failure.
  */
 function wp_print_styles( $handles = false ) {
@@ -36,7 +37,17 @@ function wp_print_styles( $handles = false ) {
  * Register CSS style file.
  *
  * @since r79
- * @see WP_Styles::add() For parameter and additional information.
+ * @see WP_Styles::add() For additional information.
+ * @global object $wp_styles The WP_Styles object for printing styles.
+ * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
+ * @param array $deps Array of handles of any stylesheet that this stylesheet depends on.
+ *  (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
+ * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable.
+ *  Used to ensure that the correct version is sent to the client regardless of caching.
+ * @param string $media The media for which this stylesheet has been defined.
  */
 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
        global $wp_styles;
@@ -50,7 +61,10 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media
  * Remove a registered CSS file.
  *
  * @since r79
- * @see WP_Styles::remove() For parameter and additional information.
+ * @see WP_Styles::remove() For additional information.
+ * @global object $wp_styles The WP_Styles object for printing styles.
+ *
+ * @param string $handle Name of the stylesheet.
  */
 function wp_deregister_style( $handle ) {
        global $wp_styles;
@@ -63,10 +77,23 @@ function wp_deregister_style( $handle ) {
 /**
  * Enqueue a CSS style file.
  *
+ * Registers the style if src provided (does NOT overwrite) and enqueues.
+ *
  * @since r79
  * @see WP_Styles::add(), WP_Styles::enqueue()
+ * @global object $wp_styles The WP_Styles object for printing styles.
+ * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
+ * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on.
+ *  (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
+ * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter
+ *  is used to ensure that the correct version is sent to the client regardless of caching, and so should be included
+ *  if a version number is available and makes sense for the stylesheet.
+ * @param string $media The media for which this stylesheet has been defined.
  */
-function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
+function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
                $wp_styles = new WP_Styles();
@@ -81,14 +108,14 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false,
 /**
  * Check whether style has been added to WordPress Styles.
  *
- * The values for list defaults to 'queue', which is the same as enqueue for
- * styles.
+ * The values for list defaults to 'queue', which is the same as wp_enqueue_style().
  *
  * @since WP unknown; BP unknown
+ * @global object $wp_styles The WP_Styles object for printing styles.
  *
- * @param string $handle Handle used to add style.
- * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
- * @return bool
+ * @param string $handle Name of the stylesheet.
+ * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'.
+ * @return bool True on success, false on failure.
  */
 function wp_style_is( $handle, $list = 'queue' ) {
        global $wp_styles;
index e6166874bd0d8a2f3e50541b26fc1159952d90b2..b3712425d9d57d37c5b3ce73f2dd4123ea730d56 100644 (file)
@@ -10,8 +10,7 @@
  * 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.
+ * specialised header will be included.
  *
  * For the parameter, if the file is called "header-special.php" then specify
  * "special".
@@ -31,16 +30,16 @@ function get_header( $name = null ) {
 
        $templates[] = "header.php";
 
+       // Backward compat code will be removed in a future release
        if ('' == locate_template($templates, true))
-               load_template( get_theme_root() . '/default/header.php');
+               load_template( WPINC . '/theme-compat/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.
+ * specialised footer will be included.
  *
  * For the parameter, if the file is called "footer-special.php" then specify
  * "special".
@@ -60,16 +59,16 @@ function get_footer( $name = null ) {
 
        $templates[] = "footer.php";
 
+       // Backward compat code will be removed in a future release
        if ('' == locate_template($templates, true))
-               load_template( get_theme_root() . '/default/footer.php');
+               load_template( WPINC . '/theme-compat/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.
+ * specialised sidebar will be included.
  *
  * For the parameter, if the file is called "sidebar-special.php" then specify
  * "special".
@@ -89,8 +88,44 @@ function get_sidebar( $name = null ) {
 
        $templates[] = "sidebar.php";
 
+       // Backward compat code will be removed in a future release
        if ('' == locate_template($templates, true))
-               load_template( get_theme_root() . '/default/sidebar.php');
+               load_template( WPINC . '/theme-compat/sidebar.php');
+}
+
+/**
+ * Load a template part into a template
+ *
+ * Makes it easy for a theme to reuse sections of code in a easy to overload way
+ * for child themes.
+ *
+ * Includes the named template part for a theme or if a name is specified then a
+ * specialised part will be included. If the theme contains no {slug}.php file
+ * then no template will be included.
+ *
+ * The template is included using require, not require_once, so you may include the
+ * same template part multiple times.
+ *
+ * For the parameter, if the file is called "{slug}-special.php" then specify
+ * "special".
+ *
+ * @uses locate_template()
+ * @since 3.0.0
+ * @uses do_action() Calls 'get_template_part{$slug}' action.
+ *
+ * @param string $slug The slug name for the generic template.
+ * @param string $name The name of the specialised template.
+ */
+function get_template_part( $slug, $name = null ) {
+       do_action( "get_template_part_{$slug}", $slug, $name );
+
+       $templates = array();
+       if ( isset($name) )
+               $templates[] = "{$slug}-{$name}.php";
+
+       $templates[] = "{$slug}.php";
+
+       locate_template($templates, true, false);
 }
 
 /**
@@ -111,8 +146,9 @@ function get_sidebar( $name = null ) {
  * search. To give a few examples of what it can be used for.
  *
  * @since 2.7.0
+ * @param boolean $echo Default to echo and not return the form.
  */
-function get_search_form() {
+function get_search_form($echo = true) {
        do_action( 'get_search_form' );
 
        $search_form_template = locate_template(array('searchform.php'));
@@ -121,34 +157,41 @@ function get_search_form() {
                return;
        }
 
-       $form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
+       $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
        <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
-       <input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
+       <input type="text" value="' . get_search_query() . '" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
        </div>
        </form>';
 
-       echo apply_filters('get_search_form', $form);
+       if ( $echo )
+               echo apply_filters('get_search_form', $form);
+       else
+               return 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.
+ * Displays a link, which allows users to navigate to the Log In page to log in
+ * or log out depending on whether they are currently logged in.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'loginout' hook on HTML link content.
  *
  * @param string $redirect Optional path to redirect to on login/logout.
+ * @param boolean $echo Default to echo and not return the link.
  */
-function wp_loginout($redirect = '') {
+function wp_loginout($redirect = '', $echo = true) {
        if ( ! is_user_logged_in() )
                $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
        else
                $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
 
-       echo apply_filters('loginout', $link);
+       if ( $echo )
+               echo apply_filters('loginout', $link);
+       else
+               return apply_filters('loginout', $link);
 }
 
 /**
@@ -185,17 +228,73 @@ function wp_logout_url($redirect = '') {
  * @uses apply_filters() calls 'login_url' hook on final login url
  *
  * @param string $redirect Path to redirect to on login.
+ * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
+ * @return string A log in url
  */
-function wp_login_url($redirect = '') {
+function wp_login_url($redirect = '', $force_reauth = false) {
        $login_url = site_url('wp-login.php', 'login');
 
-       if ( !empty($redirect) ) {
+       if ( !empty($redirect) )
                $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
-       }
+
+       if ( $force_reauth )
+               $login_url = add_query_arg('reauth', '1', $login_url);
 
        return apply_filters('login_url', $login_url, $redirect);
 }
 
+/**
+ * Provides a simple login form for use anywhere within WordPress. By default, it echoes
+ * the HTML immediately. Pass array('echo'=>false) to return the string instead.
+ *
+ * @since 3.0.0
+ * @param array $args Configuration options to modify the form output
+ * @return Void, or string containing the form
+ */
+function wp_login_form( $args = array() ) {
+       $defaults = array( 'echo' => true,
+                                               'redirect' => site_url( $_SERVER['REQUEST_URI'] ), // Default redirect is back to the current page
+                                               'form_id' => 'loginform',
+                                               'label_username' => __( 'Username' ),
+                                               'label_password' => __( 'Password' ),
+                                               'label_remember' => __( 'Remember Me' ),
+                                               'label_log_in' => __( 'Log In' ),
+                                               'id_username' => 'user_login',
+                                               'id_password' => 'user_pass',
+                                               'id_remember' => 'rememberme',
+                                               'id_submit' => 'wp-submit',
+                                               'remember' => true,
+                                               'value_username' => '',
+                                               'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked
+                                       );
+       $args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
+
+       $form = '
+               <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post">
+                       ' . apply_filters( 'login_form_top', '' ) . '
+                       <p class="login-username">
+                               <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
+                               <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" tabindex="10" />
+                       </p>
+                       <p class="login-password">
+                               <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
+                               <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" tabindex="20" />
+                       </p>
+                       ' . apply_filters( 'login_form_middle', '' ) . '
+                       ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever" tabindex="90"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
+                       <p class="login-submit">
+                               <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" tabindex="100" />
+                               <input type="hidden" name="redirect_to" value="' . esc_attr( $args['redirect'] ) . '" />
+                       </p>
+                       ' . apply_filters( 'login_form_bottom', '' ) . '
+               </form>';
+
+       if ( $args['echo'] )
+               echo $form;
+       else
+               return $form;
+}
+
 /**
  * Returns the Lost Password URL.
  *
@@ -228,8 +327,9 @@ function wp_lostpassword_url($redirect = '') {
  *
  * @param string $before Text to output before the link (defaults to <li>).
  * @param string $after Text to output after the link (defaults to </li>).
+ * @param boolean $echo Default to echo and not return the link.
  */
-function wp_register( $before = '<li>', $after = '</li>' ) {
+function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
 
        if ( ! is_user_logged_in() ) {
                if ( get_option('users_can_register') )
@@ -240,7 +340,10 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
                $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
        }
 
-       echo apply_filters('register', $link);
+       if ( $echo )
+               echo apply_filters('register', $link);
+       else
+               return apply_filters('register', $link);
 }
 
 /**
@@ -265,17 +368,16 @@ function wp_meta() {
  *
  * @param string $show What to display.
  */
-function bloginfo($show='') {
-       echo get_bloginfo($show, 'display');
+function bloginfo( $show='' ) {
+       echo get_bloginfo( $show, 'display' );
 }
 
 /**
  * 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.
+ * versions. These options will trigger the _deprecated_argument() function.
+ * The deprecated blog info options are listed in the function contents.
  *
  * The possible values for the 'show' parameter are listed below.
  * <ol>
@@ -289,25 +391,23 @@ function bloginfo($show='') {
  * 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' ) {
 
-       switch($show) {
-               case 'url' :
+       switch( $show ) {
                case 'home' : // DEPRECATED
                case 'siteurl' : // DEPRECATED
-                       $output = get_option('home');
+                       _deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> option instead.' ), 'url'  ) );
+               case 'url' :
+                       $output = home_url();
                        break;
                case 'wpurl' :
-                       $output = get_option('siteurl');
+                       $output = site_url();
                        break;
                case 'description':
                        $output = get_option('blogdescription');
@@ -362,8 +462,12 @@ function get_bloginfo($show = '', $filter = 'raw') {
                        $output = str_replace('_', '-', $output);
                        break;
                case 'text_direction':
-                       global $wp_locale;
-                       $output = $wp_locale->text_direction;
+                       //_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> function instead.' ), 'is_rtl()'  ) );
+                       if ( function_exists( 'is_rtl' ) ) {
+                               $output = is_rtl() ? 'rtl' : 'ltr';
+                       } else {
+                               $output = 'ltr';
+                       }
                        break;
                case 'name':
                default:
@@ -467,31 +571,30 @@ 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));
-               $title = "$my_year" . ($my_month ? "$t_sep$my_month" : "") . ($my_day ? "$t_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) )
-                       $title .= "$t_sep" . $wp_locale->get_month($monthnum);
+                       $title .= $t_sep . $wp_locale->get_month($monthnum);
                if ( !empty($day) )
-                       $title .= "$t_sep" . zeroise($day, 2);
+                       $title .= $t_sep . zeroise($day, 2);
        }
 
        // If there is a post
        if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
                $post = $wp_query->get_queried_object();
-               $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
+               $title = apply_filters( 'single_post_title', $post->post_title );
        }
 
        // If there's a taxonomy
        if ( is_tax() ) {
                $taxonomy = get_query_var( 'taxonomy' );
                $tax = get_taxonomy( $taxonomy );
-               $tax = $tax->label;
                $term = $wp_query->get_queried_object();
                $term = $term->name;
-               $title = "$tax$t_sep$term";
+               $title = $tax->labels->name . $t_sep . $term;
        }
 
        //If it's a search
@@ -547,21 +650,21 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
  * @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');
-       $name = get_query_var('name');
-
-       if ( intval($p) || '' != $name ) {
-               if ( !$p )
-                       $p = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $name));
-               $post = & get_post($p);
-               $title = $post->post_title;
-               $title = apply_filters('single_post_title', $title);
-               if ( $display )
-                       echo $prefix.strip_tags($title);
-               else
-                       return strip_tags($title);
-       }
+       global $wp_query, $post;
+
+       if ( ! $post )
+               $_post = $wp_query->get_queried_object();
+       else
+               $_post = $post;
+
+       if ( !isset($_post->post_title) )
+               return;
+
+       $title = apply_filters('single_post_title', $_post->post_title, $_post);
+       if ( $display )
+               echo $prefix . $title;
+       else
+               return $title;
 }
 
 /**
@@ -582,17 +685,21 @@ function single_post_title($prefix = '', $display = true) {
  * @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') ) {
-               $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
-               if ( !empty($my_cat_name) ) {
-                       if ( $display )
-                               echo $prefix.strip_tags($my_cat_name);
-                       else
-                               return strip_tags($my_cat_name);
-               }
-       } else if ( is_tag() ) {
+       global $wp_query;
+
+       if ( is_tag() )
                return single_tag_title($prefix, $display);
+
+       if ( !is_category() )
+               return;
+
+       $cat = $wp_query->get_queried_object();
+       $my_cat_name = apply_filters('single_cat_title', $cat->name);
+       if ( !empty($my_cat_name) ) {
+               if ( $display )
+                       echo $prefix . $my_cat_name;
+               else
+                       return $my_cat_name;
        }
 }
 
@@ -614,22 +721,21 @@ function single_cat_title($prefix = '', $display = true ) {
  * @return string|null Title when retrieving, null when displaying or failure.
  */
 function single_tag_title($prefix = '', $display = true ) {
+       global $wp_query;
        if ( !is_tag() )
                return;
 
-       $tag_id = intval( get_query_var('tag_id') );
-
-       if ( !empty($tag_id) ) {
-               $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
-               if ( is_wp_error( $my_tag ) )
-                       return false;
-               $my_tag_name = apply_filters('single_tag_title', $my_tag->name);
-               if ( !empty($my_tag_name) ) {
-                       if ( $display )
-                               echo $prefix . $my_tag_name;
-                       else
-                               return $my_tag_name;
-               }
+       $tag = $wp_query->get_queried_object();
+
+       if ( ! $tag )
+               return;
+
+       $my_tag_name = apply_filters('single_tag_title', $tag->name);
+       if ( !empty($my_tag_name) ) {
+               if ( $display )
+                       echo $prefix . $my_tag_name;
+               else
+                       return $my_tag_name;
        }
 }
 
@@ -701,8 +807,6 @@ function single_month_title($prefix = '', $display = true ) {
  * 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.
@@ -809,7 +913,7 @@ function wp_get_archives($args = '') {
                if ( !isset( $cache[ $key ] ) ) {
                        $arcresults = $wpdb->get_results($query);
                        $cache[ $key ] = $arcresults;
-                       wp_cache_add( 'wp_get_archives', $cache, 'general' );
+                       wp_cache_set( 'wp_get_archives', $cache, 'general' );
                } else {
                        $arcresults = $cache[ $key ];
                }
@@ -831,7 +935,7 @@ function wp_get_archives($args = '') {
                if ( !isset( $cache[ $key ] ) ) {
                        $arcresults = $wpdb->get_results($query);
                        $cache[ $key ] = $arcresults;
-                       wp_cache_add( 'wp_get_archives', $cache, 'general' );
+                       wp_cache_set( 'wp_get_archives', $cache, 'general' );
                } else {
                        $arcresults = $cache[ $key ];
                }
@@ -852,7 +956,7 @@ function wp_get_archives($args = '') {
                if ( !isset( $cache[ $key ] ) ) {
                        $arcresults = $wpdb->get_results($query);
                        $cache[ $key ] = $arcresults;
-                       wp_cache_add( 'wp_get_archives', $cache, 'general' );
+                       wp_cache_set( 'wp_get_archives', $cache, 'general' );
                } else {
                        $arcresults = $cache[ $key ];
                }
@@ -868,14 +972,14 @@ function wp_get_archives($args = '') {
                        }
                }
        } elseif ( 'weekly' == $type ) {
-               $start_of_week = get_option('start_of_week');
-               $query = "SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC $limit";
+               $week = _wp_mysql_week( '`post_date`' );
+               $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` DESC $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
                        $arcresults = $wpdb->get_results($query);
                        $cache[ $key ] = $arcresults;
-                       wp_cache_add( 'wp_get_archives', $cache, 'general' );
+                       wp_cache_set( 'wp_get_archives', $cache, 'general' );
                } else {
                        $arcresults = $cache[ $key ];
                }
@@ -889,7 +993,7 @@ function wp_get_archives($args = '') {
                                                $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
                                                $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
                                                $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
-                                               $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
+                                               $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
                                                if ($show_post_count)
                                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
@@ -905,7 +1009,7 @@ function wp_get_archives($args = '') {
                if ( !isset( $cache[ $key ] ) ) {
                        $arcresults = $wpdb->get_results($query);
                        $cache[ $key ] = $arcresults;
-                       wp_cache_add( 'wp_get_archives', $cache, 'general' );
+                       wp_cache_set( 'wp_get_archives', $cache, 'general' );
                } else {
                        $arcresults = $cache[ $key ];
                }
@@ -952,16 +1056,21 @@ function calendar_week_mod($num) {
  * @since 1.0.0
  *
  * @param bool $initial Optional, default is true. Use initial calendar names.
+ * @param bool $echo Optional, default is true. Set to false for return.
  */
-function get_calendar($initial = true) {
+function get_calendar($initial = true, $echo = true) {
        global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
 
        $cache = array();
        $key = md5( $m . $monthnum . $year );
        if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
                if ( is_array($cache) && isset( $cache[ $key ] ) ) {
-                       echo $cache[ $key ];
-                       return;
+                       if ( $echo ) {
+                               echo apply_filters( 'get_calendar',  $cache[$key] );
+                               return;
+                       } else {
+                               return apply_filters( 'get_calendar',  $cache[$key] );
+                       }
                }
        }
 
@@ -978,7 +1087,6 @@ function get_calendar($initial = true) {
                }
        }
 
-       ob_start();
        if ( isset($_GET['w']) )
                $w = ''.intval($_GET['w']);
 
@@ -1024,7 +1132,7 @@ function get_calendar($initial = true) {
 
        /* translators: Calendar caption: 1: month name, 2: 4-digit year */
        $calendar_caption = _x('%1$s %2$s', 'calendar caption');
-       echo '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">
+       $calendar_output = '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">
        <caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
        <thead>
        <tr>';
@@ -1038,10 +1146,10 @@ function get_calendar($initial = true) {
        foreach ( $myweek as $wd ) {
                $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
                $wd = esc_attr($wd);
-               echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";
+               $calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
        }
 
-       echo '
+       $calendar_output .= '
        </tr>
        </thead>
 
@@ -1049,24 +1157,20 @@ function get_calendar($initial = true) {
        <tr>';
 
        if ( $previous ) {
-               echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($previous->month) . '" colspan="3" id="prev"><a href="' .
-               get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month),
-                       date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
+               $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
        } else {
-               echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
+               $calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
        }
 
-       echo "\n\t\t".'<td class="pad">&nbsp;</td>';
+       $calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
 
        if ( $next ) {
-               echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($next->month) . '" colspan="3" id="next"><a href="' .
-               get_month_link($next->year, $next->month) . '" title="' . esc_attr( sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month) ,
-                       date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
+               $calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link($next->year, $next->month) . '" title="' . esc_attr( sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
        } else {
-               echo "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
+               $calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
        }
 
-       echo '
+       $calendar_output .= '
        </tr>
        </tfoot>
 
@@ -1087,13 +1191,13 @@ function get_calendar($initial = true) {
                $daywithpost = array();
        }
 
-       if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
+       if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)
                $ak_title_separator = "\n";
        else
                $ak_title_separator = ', ';
 
        $ak_titles_for_day = array();
-       $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
+       $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "
                ."FROM $wpdb->posts "
                ."WHERE YEAR(post_date) = '$thisyear' "
                ."AND MONTH(post_date) = '$thismonth' "
@@ -1103,7 +1207,7 @@ function get_calendar($initial = true) {
        if ( $ak_post_titles ) {
                foreach ( (array) $ak_post_titles as $ak_post_title ) {
 
-                               $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title ) );
+                               $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) );
 
                                if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
                                        $ak_titles_for_day['day_'.$ak_post_title->dom] = '';
@@ -1118,24 +1222,24 @@ function get_calendar($initial = true) {
        // See how much we should pad in the beginning
        $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins);
        if ( 0 != $pad )
-               echo "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad">&nbsp;</td>';
+               $calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad">&nbsp;</td>';
 
        $daysinmonth = intval(date('t', $unixmonth));
        for ( $day = 1; $day <= $daysinmonth; ++$day ) {
                if ( isset($newrow) && $newrow )
-                       echo "\n\t</tr>\n\t<tr>\n\t\t";
+                       $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
                $newrow = false;
 
-               if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )
-                       echo '<td id="today">';
+               if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) )
+                       $calendar_output .= '<td id="today">';
                else
-                       echo '<td>';
+                       $calendar_output .= '<td>';
 
                if ( in_array($day, $daywithpost) ) // any posts today?
-                               echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
+                               $calendar_output .= '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
                else
-                       echo $day;
-               echo '</td>';
+                       $calendar_output .= $day;
+               $calendar_output .= '</td>';
 
                if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) )
                        $newrow = true;
@@ -1143,15 +1247,18 @@ function get_calendar($initial = true) {
 
        $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins);
        if ( $pad != 0 && $pad != 7 )
-               echo "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
+               $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
 
-       echo "\n\t</tr>\n\t</tbody>\n\t</table>";
+       $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
 
-       $output = ob_get_contents();
-       ob_end_clean();
-       echo $output;
-       $cache[ $key ] = $output;
+       $cache[ $key ] = $calendar_output;
        wp_cache_set( 'get_calendar', $cache, 'calendar' );
+
+       if ( $echo )
+               echo apply_filters( 'get_calendar',  $calendar_output );
+       else
+               return apply_filters( 'get_calendar',  $calendar_output );
+
 }
 
 /**
@@ -1207,37 +1314,66 @@ function the_date_xml() {
 }
 
 /**
- * Display or Retrieve the date the post was written.
+ * Display or Retrieve the date the current $post was written (once per date)
  *
  * Will only output the date if the current post's date is different from the
  * previous one output.
+
+ * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
+ * function is called several times for each post.
  *
- * @since 0.71
+ * HTML output can be filtered with 'the_date'.
+ * Date string output can be filtered with 'get_the_date'.
  *
+ * @since 0.71
+ * @uses get_the_date()
  * @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;
+function the_date( $d = '', $before = '', $after = '', $echo = true ) {
+       global $day, $previousday;
        $the_date = '';
        if ( $day != $previousday ) {
                $the_date .= $before;
-               if ( $d=='' )
-                       $the_date .= mysql2date(get_option('date_format'), $post->post_date);
-               else
-                       $the_date .= mysql2date($d, $post->post_date);
+               $the_date .= get_the_date( $d );
                $the_date .= $after;
                $previousday = $day;
 
-       $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
-       if ( $echo )
-               echo $the_date;
-       else
-               return $the_date;
+               $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
+
+               if ( $echo )
+                       echo $the_date;
+               else
+                       return $the_date;
        }
+
+       return null;
+}
+
+/**
+ * Retrieve the date the current $post was written.
+ *
+ * Unlike the_date() this function will always return the date.
+ * Modify output with 'get_the_date' filter.
+ *
+ * @since 3.0.0
+ *
+ * @param string $d Optional. PHP date format defaults to the date_format option if not specified.
+ * @return string|null Null if displaying, string if retrieving.
+ */
+function get_the_date( $d = '' ) {
+       global $post;
+       $the_date = '';
+
+       if ( '' == $d )
+               $the_date .= mysql2date(get_option('date_format'), $post->post_date);
+       else
+               $the_date .= mysql2date($d, $post->post_date);
+
+       return apply_filters('get_the_date', $the_date, $d);
 }
 
 /**
@@ -1245,11 +1381,22 @@ function the_date($d='', $before='', $after='', $echo = true) {
  *
  * @since 2.1.0
  *
- * @param string $d Optional. PHP date format.
- * @return string
+ * @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_modified_date($d = '') {
-       echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
+function the_modified_date($d = '', $before='', $after='', $echo = true) {
+
+       $the_modified_date = $before . get_the_modified_date($d) . $after;
+       $the_modified_date = apply_filters('the_modified_date', $the_modified_date, $d, $before, $after);
+
+       if ( $echo )
+               echo $the_modified_date;
+       else
+               return $the_modified_date;
+
 }
 
 /**
@@ -1284,7 +1431,7 @@ function the_time( $d = '' ) {
  *
  * @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 string $d Optional 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
  */
@@ -1303,10 +1450,10 @@ function get_the_time( $d = '', $post = null ) {
  *
  * @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 string $d Optional Either 'G', 'U', or php date format.
+ * @param bool $gmt Optional, default is false. Whether to return the gmt time.
  * @param int|object $post Optional post ID or object. Default is global $post object.
- * @param bool $translate Whether to translate the time string or not
+ * @param bool $translate Whether to translate the time string
  * @return string
  */
 function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { // returns timestamp
@@ -1326,7 +1473,7 @@ function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false
  *
  * @since 2.0.0
  *
- * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
+ * @param string $d Optional 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);
@@ -1337,7 +1484,7 @@ function the_modified_time($d = '') {
  *
  * @since 2.0.0
  *
- * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
+ * @param string $d Optional 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 = '') {
@@ -1353,10 +1500,10 @@ function get_the_modified_time($d = '') {
  *
  * @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 A post_id or post object
- * @param bool translate Whether to translate the result or not
+ * @param string $d Optional, default is 'U'. Either 'G', 'U', or php date format.
+ * @param bool $gmt Optional, default is false. Whether to return the gmt time.
+ * @param int|object $post Optional, default is global post object. A post_id or post object
+ * @param bool $translate Optional, default is false. Whether to translate the result
  * @return string Returns timestamp
  */
 function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
@@ -1393,8 +1540,8 @@ function the_weekday() {
  *
  * @since 0.71
  *
- * @param string $before output before the date.
- * @param string $after output after the date.
+ * @param string $before Optional Output before the date.
+ * @param string $after Optional Output after the date.
   */
 function the_weekday_date($before='',$after='') {
        global $wp_locale, $post, $day, $previousweekday;
@@ -1429,22 +1576,6 @@ function wp_footer() {
        do_action('wp_footer');
 }
 
-/**
- * Enable/disable automatic general feed link outputting.
- *
- * @since 2.8.0
- *
- * @param boolean $add Add or remove links. Defaults to true.
- */
-function automatic_feed_links( $add = true ) {
-       if ( $add )
-               add_action( 'wp_head', 'feed_links', 2 );
-       else {
-               remove_action( 'wp_head', 'feed_links', 2 );
-               remove_action( 'wp_head', 'feed_links_extra', 3 );
-       }
-}
-
 /**
  * Display the links to the general feeds.
  *
@@ -1452,7 +1583,10 @@ function automatic_feed_links( $add = true ) {
  *
  * @param array $args Optional arguments.
  */
-function feed_links( $args ) {
+function feed_links( $args = array() ) {
+       if ( !current_theme_supports('automatic-feed-links') )
+               return;
+
        $defaults = array(
                /* translators: Separator between blog name and feed type in feed links */
                'separator'     => _x('&raquo;', 'feed link'),
@@ -1475,7 +1609,7 @@ function feed_links( $args ) {
  *
  * @param array $args Optional arguments.
  */
-function feed_links_extra( $args ) {
+function feed_links_extra( $args = array() ) {
        $defaults = array(
                /* translators: Separator between blog name and feed type in feed links */
                'separator'   => _x('&raquo;', 'feed link'),
@@ -1517,7 +1651,7 @@ function feed_links_extra( $args ) {
                $title = esc_attr(sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ));
                $href = get_author_feed_link( $author_id );
        } elseif ( is_search() ) {
-               $title = esc_attr(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query() ));
+               $title = esc_attr(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) ));
                $href = get_search_feed_link();
        }
 
@@ -1567,7 +1701,7 @@ function noindex() {
  *
  * @since 2.1.0
  *
- * @return bool Whether of not TinyMCE exists.
+ * @return bool Whether TinyMCE exists.
  */
 function rich_edit_exists() {
        global $wp_rich_edit_exists;
@@ -1577,7 +1711,7 @@ function rich_edit_exists() {
 }
 
 /**
- * Whether or not the user should have a WYSIWIG editor.
+ * Whether 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.
@@ -1635,8 +1769,8 @@ function wp_default_editor() {
  * @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 string $id Optional, default is 'content'. HTML ID attribute value.
+ * @param string $prev_id Optional, default is 'title'. 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.
  */
@@ -1700,12 +1834,21 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
 /**
  * Retrieve the contents of the search WordPress query variable.
  *
+ * The search query string is passed through {@link esc_attr()}
+ * to ensure that it is safe for placing in an html attribute.
+ *
  * @since 2.3.0
+ * @uses esc_attr()
  *
+ * @param bool $escaped Whether the result is escaped. Default true.
+ *     Only use when you are later escaping it. Do not use unescaped.
  * @return string
  */
-function get_search_query() {
-       return apply_filters( 'get_search_query', get_query_var( 's' ) );
+function get_search_query( $escaped = true ) {
+       $query = apply_filters( 'get_search_query', get_query_var( 's' ) );
+       if ( $escaped )
+               $query = esc_attr( $query );
+       return $query;
 }
 
 /**
@@ -1714,11 +1857,11 @@ function get_search_query() {
  * The search query string is passed through {@link esc_attr()}
  * to ensure that it is safe for placing in an html attribute.
  *
- * @uses attr
+ * @uses esc_attr()
  * @since 2.1.0
  */
 function the_search_query() {
-       echo esc_attr( apply_filters( 'the_search_query', get_search_query() ) );
+       echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
 }
 
 /**
@@ -1735,8 +1878,8 @@ function language_attributes($doctype = 'html') {
        $attributes = array();
        $output = '';
 
-       if ( $dir = get_bloginfo('text_direction') )
-               $attributes[] = "dir=\"$dir\"";
+       if ( function_exists( 'is_rtl' ) )
+               $attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"';
 
        if ( $lang = get_bloginfo('language') ) {
                if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
@@ -1835,7 +1978,7 @@ function paginate_links( $args = '' ) {
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
-               $page_links[] = "<a class='prev page-numbers' href='" . esc_url($link) . "'>$prev_text</a>";
+               $page_links[] = "<a class='prev page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$prev_text</a>";
        endif;
        for ( $n = 1; $n <= $total; $n++ ) :
                $n_display = number_format_i18n($n);
@@ -1849,7 +1992,7 @@ function paginate_links( $args = '' ) {
                                if ( $add_args )
                                        $link = add_query_arg( $add_args, $link );
                                $link .= $add_fragment;
-                               $page_links[] = "<a class='page-numbers' href='" . esc_url($link) . "'>$n_display</a>";
+                               $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$n_display</a>";
                                $dots = true;
                        elseif ( $dots && !$show_all ) :
                                $page_links[] = "<span class='page-numbers dots'>...</span>";
@@ -1863,7 +2006,7 @@ function paginate_links( $args = '' ) {
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
-               $page_links[] = "<a class='next page-numbers' href='" . esc_url($link) . "'>$next_text</a>";
+               $page_links[] = "<a class='next page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$next_text</a>";
        endif;
        switch ( $type ) :
                case 'array' :
@@ -1895,7 +2038,7 @@ function paginate_links( $args = '' ) {
  * @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.
+ * @param array @colors Optional 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;
@@ -1906,6 +2049,15 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
        $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
 }
 
+/**
+ * Registers the default Admin color schemes
+ *
+ * @since 3.0.0
+ */
+function register_admin_color_schemes() {
+       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'));}
+
 /**
  * Display the URL of a WordPress admin CSS file.
  *
@@ -1964,7 +2116,7 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
        }
 
        echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
-       if ( 'rtl' == get_bloginfo( 'text_direction' ) )
+       if ( is_rtl() )
                echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
 }
 
@@ -2019,8 +2171,34 @@ function the_generator( $type ) {
  * @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 ) {
-       switch ($type) {
+function get_the_generator( $type = '' ) {
+       if ( empty( $type ) ) {
+
+               $current_filter = current_filter();
+               if ( empty( $current_filter ) )
+                       return;
+
+               switch ( $current_filter ) {
+                       case 'rss2_head' :
+                       case 'commentsrss2_head' :
+                               $type = 'rss2';
+                               break;
+                       case 'rss_head' :
+                       case 'opml_head' :
+                               $type = 'comment';
+                               break;
+                       case 'rdf_header' :
+                               $type = 'rdf';
+                               break;
+                       case 'atom_head' :
+                       case 'comments_atom_head' :
+                       case 'app_head' :
+                               $type = 'atom';
+                               break;
+               }
+       }
+
+       switch ( $type ) {
                case 'html':
                        $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
                        break;
@@ -2046,4 +2224,78 @@ function get_the_generator( $type ) {
        return apply_filters( "get_the_generator_{$type}", $gen, $type );
 }
 
-?>
\ No newline at end of file
+/**
+ * Outputs the html checked attribute.
+ *
+ * Compares the first two arguments and if identical marks as checked
+ *
+ * @since 1.0
+ *
+ * @param mixed $checked One of the values to compare
+ * @param mixed $current (true) The other value to compare if not just true
+ * @param bool $echo Whether to echo or just return the string
+ * @return string html attribute or empty string
+ */
+function checked( $checked, $current = true, $echo = true ) {
+       return __checked_selected_helper( $checked, $current, $echo, 'checked' );
+}
+
+/**
+ * Outputs the html selected attribute.
+ *
+ * Compares the first two arguments and if identical marks as selected
+ *
+ * @since 1.0
+ *
+ * @param mixed selected One of the values to compare
+ * @param mixed $current (true) The other value to compare if not just true
+ * @param bool $echo Whether to echo or just return the string
+ * @return string html attribute or empty string
+ */
+function selected( $selected, $current = true, $echo = true ) {
+       return __checked_selected_helper( $selected, $current, $echo, 'selected' );
+}
+
+/**
+ * Outputs the html disabled attribute.
+ *
+ * Compares the first two arguments and if identical marks as disabled
+ *
+ * @since 3.0.0
+ *
+ * @param mixed $disabled One of the values to compare
+ * @param mixed $current (true) The other value to compare if not just true
+ * @param bool $echo Whether to echo or just return the string
+ * @return string html attribute or empty string
+ */
+function disabled( $disabled, $current = true, $echo = true ) {
+       return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
+}
+
+/**
+ * Private helper function for checked, selected, and disabled.
+ *
+ * Compares the first two arguments and if identical marks as $type
+ *
+ * @since 2.8
+ * @access private
+ *
+ * @param any $helper One of the values to compare
+ * @param any $current (true) The other value to compare if not just true
+ * @param bool $echo Whether to echo or just return the string
+ * @param string $type The type of checked|selected|disabled we are doing
+ * @return string html attribute or empty string
+ */
+function __checked_selected_helper( $helper, $current, $echo, $type ) {
+       if ( (string) $helper === (string) $current )
+               $result = " $type='$type'";
+       else
+               $result = '';
+
+       if ( $echo )
+               echo $result;
+
+       return $result;
+}
+
+?>
index e8d1344ccd14192330b8a8d3817cb6afb7b27dd9..63cf97d1f9c4846b456762574556de2139a9ebe5 100644 (file)
  * @package WordPress
  * @subpackage HTTP
  * @since 2.7.0
- * @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.
- *
- * Debugging includes several actions, which pass different variables for debugging the HTTP API.
- *
- * <strong>http_transport_get_debug</strong> - gives working, nonblocking, and blocking transports.
- *
- * <strong>http_transport_post_debug</strong> - gives working, nonblocking, and blocking transports.
- *
- * @package WordPress
- * @subpackage HTTP
- * @since 2.7.0
- */
-class WP_Http {
-
-       /**
-        * PHP4 style Constructor - Calls PHP5 Style Constructor
-        *
-        * @since 2.7.0
-        * @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.0
-        * @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.0
-        * @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($args) ) {
-                               $working_transport['exthttp'] = new WP_Http_ExtHttp();
-                               $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Curl::test($args) ) {
-                               $working_transport['curl'] = new WP_Http_Curl();
-                               $blocking_transport[] = &$working_transport['curl'];
-                       } else if ( true === WP_Http_Streams::test($args) ) {
-                               $working_transport['streams'] = new WP_Http_Streams();
-                               $blocking_transport[] = &$working_transport['streams'];
-                       } else if ( true === WP_Http_Fopen::test($args) ) {
-                               $working_transport['fopen'] = new WP_Http_Fopen();
-                               $blocking_transport[] = &$working_transport['fopen'];
-                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
-                               $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];
-                       }
-               }
-
-               do_action( 'http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_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.0
-        * @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($args) ) {
-                               $working_transport['exthttp'] = new WP_Http_ExtHttp();
-                               $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Curl::test($args) ) {
-                               $working_transport['curl'] = new WP_Http_Curl();
-                               $blocking_transport[] = &$working_transport['curl'];
-                       } else if ( true === WP_Http_Streams::test($args) ) {
-                               $working_transport['streams'] = new WP_Http_Streams();
-                               $blocking_transport[] = &$working_transport['streams'];
-                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
-                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
-                               $blocking_transport[] = &$working_transport['fsockopen'];
-                       }
-
-                       foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {
-                               if ( isset($working_transport[$transport]) )
-                                       $nonblocking_transport[] = &$working_transport[$transport];
-                       }
-               }
-
-               do_action( 'http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_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.0
-        * @todo Refactor this code. The code in this method extends the scope of its original purpose
-        *              and should be refactored to allow for cleaner abstraction and reduce duplication of the
-        *              code. One suggestion is to create a class specifically for the arguments, however
-        *              preliminary refactoring to this affect has affect more than just the scope of the
-        *              arguments. Something to ponder at least.
-        *
-        * @param string $url URI resource.
-        * @param str|array $args Optional. Override the defaults.
-        * @return array containing 'headers', 'body', 'response', 'cookies'
-        */
-       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 . '; ' . get_bloginfo( 'url' )  ),
-                       'blocking' => true,
-                       'headers' => array(),
-                       'cookies' => array(),
-                       'body' => null,
-                       'compress' => false,
-                       'decompress' => true,
-                       'sslverify' => true
-               );
-
-               $r = wp_parse_args( $args, $defaults );
-               $r = apply_filters( 'http_request_args', $r, $url );
-
-               // Allow plugins to short-circuit the request
-               $pre = apply_filters( 'pre_http_request', false, $r, $url );
-               if ( false !== $pre )
-                       return $pre;
-
-               $arrURL = parse_url($url);
-
-               if ( $this->block_request( $url ) )
-                       return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
-
-               // Determine if this is a https call and pass that on to the transport functions
-               // so that we can blacklist the transports that do not support ssl verification
-               $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
-
-               // Determine if this request is to OUR install of WordPress
-               $homeURL = parse_url(get_bloginfo('url'));
-               $r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
-               unset($homeURL);
-
-               if ( is_null( $r['headers'] ) )
-                       $r['headers'] = array();
-
-               if ( ! is_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']);
-               }
-
-               // Construct Cookie: header if any cookies are set
-               WP_Http::buildCookieHeader( $r );
-
-               if ( WP_Http_Encoding::is_available() )
-                       $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
-
-               if ( empty($r['body']) ) {
-                       // Some servers fail when sending content without the content-length header being set.
-                       // Also, to fix another bug, we only send when doing POST and PUT and the content-length
-                       // header isn't already set.
-                       if( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset($r['headers']['Content-Length']) )
-                               $r['headers']['Content-Length'] = 0;
-
-                       // The method is ambiguous, because we aren't talking about HTTP methods, the "get" in
-                       // this case is simply that we aren't sending any bodies and to get the transports that
-                       // don't support sending bodies along with those which do.
-                       $transports = WP_Http::_getTransport($r);
-               } else {
-                       if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
-                               if ( ! version_compare(phpversion(), '5.1.2', '>=') )
-                                       $r['body'] = _http_build_query($r['body'], null, '&');
-                               else
-                                       $r['body'] = http_build_query($r['body'], null, '&');
-                               $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
-                               $r['headers']['Content-Length'] = strlen($r['body']);
-                       }
-
-                       if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
-                               $r['headers']['Content-Length'] = strlen($r['body']);
-
-                       // The method is ambiguous, because we aren't talking about HTTP methods, the "post" in
-                       // this case is simply that we are sending HTTP body and to get the transports that do
-                       // support sending the body. Not all do, depending on the limitations of the PHP core
-                       // limitations.
-                       $transports = WP_Http::_postTransport($r);
-               }
-
-               do_action( 'http_api_debug', $transports, 'transports_list' );
-
-               $response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
-               foreach ( (array) $transports as $transport ) {
-                       $response = $transport->request($url, $r);
-
-                       do_action( 'http_api_debug', $response, 'response', get_class($transport) );
-
-                       if ( ! is_wp_error($response) )
-                               return apply_filters( 'http_response', $response, $r, $url );
-               }
-
-               return $response;
-       }
-
-       /**
-        * Uses the POST HTTP method.
-        *
-        * Used for sending data that is expected to be in the body.
-        *
-        * @access public
-        * @since 2.7.0
-        *
-        * @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.0
-        *
-        * @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.0
-        *
-        * @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.0
-        *
-        * @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.0
-        *
-        * @param string|array $headers
-        * @return array Processed string headers. If duplicate headers are encountered,
-        *                                      Then a numbered array is returned as the value of that header-key.
-        */
-       function processHeaders($headers) {
-               // split headers, one per array element
-               if ( is_string($headers) ) {
-                       // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
-                       $headers = str_replace("\r\n", "\n", $headers);
-                       // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
-                       $headers = preg_replace('/\n[ \t]/', ' ', $headers);
-                       // create the headers array
-                       $headers = explode("\n", $headers);
-               }
-
-               $response = array('code' => 0, 'message' => '');
-
-               $cookies = array();
-               $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 ) ) {
-                               $key = strtolower( $key );
-                               if ( isset( $newheaders[$key] ) ) {
-                                       $newheaders[$key] = array( $newheaders[$key], trim( $value ) );
-                               } else {
-                                       $newheaders[$key] = trim( $value );
-                               }
-                               if ( 'set-cookie' == strtolower( $key ) )
-                                       $cookies[] = new WP_Http_Cookie( $value );
-                       }
-               }
-
-               return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies);
-       }
-
-       /**
-        * Takes the arguments for a ::request() and checks for the cookie array.
-        *
-        * If it's found, then it's assumed to contain WP_Http_Cookie objects, which are each parsed
-        * into strings and added to the Cookie: header (within the arguments array). Edits the array by
-        * reference.
-        *
-        * @access public
-        * @version 2.8.0
-        * @static
-        *
-        * @param array $r Full array of args passed into ::request()
-        */
-       function buildCookieHeader( &$r ) {
-               if ( ! empty($r['cookies']) ) {
-                       $cookies_header = '';
-                       foreach ( (array) $r['cookies'] as $cookie ) {
-                               $cookies_header .= $cookie->getHeaderValue() . '; ';
-                       }
-                       $cookies_header = substr( $cookies_header, 0, -2 );
-                       $r['headers']['cookie'] = $cookies_header;
-               }
-       }
-
-       /**
-        * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
-        *
-        * 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.0
-        * @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;
-                       }
-               }
-       }
-
-       /**
-        * Block requests through the proxy.
-        *
-        * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will
-        * prevent plugins from working and core functionality, if you don't include api.wordpress.org.
-        *
-        * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL in your wp-config.php file
-        * and this will only allow localhost and your blog to make requests. The constant
-        * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
-        * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow.
-        *
-        * @since 2.8.0
-        * @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
-        *
-        * @param string $uri URI of url.
-        * @return bool True to block, false to allow.
-        */
-       function block_request($uri) {
-               // We don't need to block requests, because nothing is blocked.
-               if ( ! defined('WP_HTTP_BLOCK_EXTERNAL') || ( defined('WP_HTTP_BLOCK_EXTERNAL') && WP_HTTP_BLOCK_EXTERNAL == false ) )
-                       return false;
-
-               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
-               // This will be displayed on blogs, which is not reasonable.
-               $check = @parse_url($uri);
-
-               /* Malformed URL, can not process, but this could mean ssl, so let through anyway.
-                *
-                * This isn't very security sound. There are instances where a hacker might attempt
-                * to bypass the proxy and this check. However, the reason for this behavior is that
-                * WordPress does not do any checking currently for non-proxy requests, so it is keeps with
-                * the default unsecure nature of the HTTP request.
-                */
-               if ( $check === false )
-                       return false;
-
-               $home = parse_url( get_option('siteurl') );
-
-               // Don't block requests back to ourselves by default
-               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
-                       return apply_filters('block_local_requests', false);
-
-               if ( !defined('WP_ACCESSIBLE_HOSTS') )
-                       return true;
-
-               static $accessible_hosts;
-               if ( null == $accessible_hosts )
-                       $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
-
-               return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
-       }
-}
-
-/**
- * HTTP request method uses fsockopen function to retrieve the url.
- *
- * 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.0
- */
-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', 'cookies' 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, 'cookies' => array()
-               );
-
-               $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']);
-               }
-
-               // Construct Cookie: header if any cookies are set
-               WP_Http::buildCookieHeader( $r );
-
-               $iError = null; // Store error number
-               $strError = null; // Store error string
-
-               $arrURL = parse_url($url);
-
-               $fsockopen_host = $arrURL['host'];
-
-               $secure_transport = false;
-
-               if ( ! isset( $arrURL['port'] ) ) {
-                       if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
-                               $fsockopen_host = "ssl://$fsockopen_host";
-                               $arrURL['port'] = 443;
-                               $secure_transport = true;
-                       } else {
-                               $arrURL['port'] = 80;
-                       }
-               }
-
-               //fsockopen has issues with 'localhost' with IPv6 with certain versions of PHP, It attempts to connect to ::1,
-               // which fails when the server is not setup for it. For compatibility, always connect to the IPv4 address.
-               if ( 'localhost' == strtolower($fsockopen_host) )
-                       $fsockopen_host = '127.0.0.1';
-
-               // 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();
-
-               $proxy = new WP_HTTP_Proxy();
-
-               if ( !WP_DEBUG ) {
-                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
-                               $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
-                       else
-                               $handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
-               } else {
-                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
-                               $handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
-                       else
-                               $handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
-               }
-
-               $endDelay = time();
-
-               // 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);
-
-               $timeout = (int) floor( $r['timeout'] );
-               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
-               stream_set_timeout( $handle, $timeout, $utimeout );
-
-               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field.
-                       $requestPath = $url;
-               else
-                       $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
-
-               if ( empty($requestPath) )
-                       $requestPath .= '/';
-
-               $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
-
-               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
-                       $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
-               else
-                       $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
-
-               if ( isset($r['user-agent']) )
-                       $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
-
-               if ( is_array($r['headers']) ) {
-                       foreach ( (array) $r['headers'] as $header => $headerValue )
-                               $strHeaders .= $header . ': ' . $headerValue . "\r\n";
-               } else {
-                       $strHeaders .= $r['headers'];
-               }
-
-               if ( $proxy->use_authentication() )
-                       $strHeaders .= $proxy->authentication_header() . "\r\n";
-
-               $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' => false, 'message' => false), 'cookies' => array() );
-               }
-
-               $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']);
-
-               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) )
-                       $process['body'] = WP_Http_Encoding::decompress( $process['body'] );
-
-               return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies']);
-       }
-
-       /**
-        * Whether this class can be used for retrieving an URL.
-        *
-        * @since 2.7.0
-        * @static
-        * @return boolean False means this class can not be used, true means it can.
-        */
-       function test( $args = array() ) {
-               if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
-                       return false;
-
-               $is_ssl = isset($args['ssl']) && $args['ssl'];
-
-               if ( ! $is_ssl && function_exists( 'fsockopen' ) )
-                       $use = true;
-               elseif ( $is_ssl && extension_loaded('openssl') && function_exists( 'fsockopen' ) )
-                       $use = true;
-               else
-                       $use = false;
-
-               return apply_filters('use_fsockopen_transport', $use, $args);
-       }
-}
-
-/**
- * HTTP request method uses fopen function to retrieve the url.
- *
- * 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.0
- */
-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.0
-        *
-        * @param string $url URI resource.
-        * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', 'cookies' and 'response' keys.
-        */
-       function request($url, $args = array()) {
-               $defaults = array(
-                       'method' => 'GET', 'timeout' => 5,
-                       'redirection' => 5, 'httpversion' => '1.0',
-                       'blocking' => true,
-                       'headers' => array(), 'body' => null, 'cookies' => array()
-               );
-
-               $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 ( !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));
-
-               $timeout = (int) floor( $r['timeout'] );
-               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
-               stream_set_timeout( $handle, $timeout, $utimeout );
-
-               if ( ! $r['blocking'] ) {
-                       fclose($handle);
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
-               }
-
-               $strResponse = '';
-               while ( ! feof($handle) )
-                       $strResponse .= fread($handle, 4096);
-
-               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 {
-                       //$http_response_header is a PHP reserved variable which is set in the current-scope when using the HTTP Wrapper
-                       //see http://php.oregonstate.edu/manual/en/reserved.variables.httpresponseheader.php
-                       $theHeaders = $http_response_header;
-               }
-
-               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);
-
-               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
-                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
-
-               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
-       }
-
-       /**
-        * Whether this class can be used for retrieving an URL.
-        *
-        * @since 2.7.0
-        * @static
-        * @return boolean False means this class can not be used, true means it can.
-        */
-       function test($args = array()) {
-               if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
-                       return false;
-
-               $use = true;
-
-               //PHP does not verify SSL certs, We can only make a request via this transports if SSL Verification is turned off.
-               $is_ssl = isset($args['ssl']) && $args['ssl'];
-               if ( $is_ssl ) {
-                       $is_local = isset($args['local']) && $args['local'];
-                       $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
-                       if ( $is_local && true != apply_filters('https_local_ssl_verify', true) )
-                               $use = true;
-                       elseif ( !$is_local && true != apply_filters('https_ssl_verify', true) )
-                               $use = true;
-                       elseif ( !$ssl_verify )
-                               $use = true;
-                       else
-                               $use = false;
-               }
-
-               return apply_filters('use_fopen_transport', $use, $args);
-       }
-}
-
-/**
- * HTTP request method uses Streams to retrieve the url.
- *
- * 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.0
- */
-class WP_Http_Streams {
-       /**
-        * Send a HTTP request to a URI using streams with fopen().
-        *
-        * @access public
-        * @since 2.7.0
-        *
-        * @param string $url
-        * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', 'cookies' and 'response' keys.
-        */
-       function request($url, $args = array()) {
-               $defaults = array(
-                       'method' => 'GET', 'timeout' => 5,
-                       'redirection' => 5, 'httpversion' => '1.0',
-                       'blocking' => true,
-                       'headers' => array(), 'body' => null, 'cookies' => array()
-               );
-
-               $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']);
-               }
-
-               // Construct Cookie: header if any cookies are set
-               WP_Http::buildCookieHeader( $r );
-
-               $arrURL = parse_url($url);
-
-               if ( false === $arrURL )
-                       return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
-
-               if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
-                       $url = preg_replace('|^' . preg_quote($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'];
-
-               $is_local = isset($args['local']) && $args['local'];
-               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
-               if ( $is_local )
-                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
-               elseif ( ! $is_local )
-                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
-
-               $arrContext = array('http' =>
-                       array(
-                               'method' => strtoupper($r['method']),
-                               'user_agent' => $r['user-agent'],
-                               'max_redirects' => $r['redirection'],
-                               'protocol_version' => (float) $r['httpversion'],
-                               'header' => $strHeaders,
-                               'timeout' => $r['timeout'],
-                               'ssl' => array(
-                                               'verify_peer' => $ssl_verify,
-                                               'verify_host' => $ssl_verify
-                               )
-                       )
-               );
-
-               $proxy = new WP_HTTP_Proxy();
-
-               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
-                       $arrContext['http']['proxy'] = 'tcp://' . $proxy->host() . ':' . $proxy->port();
-                       $arrContext['http']['request_fulluri'] = true;
-
-                       // We only support Basic authentication so this will only work if that is what your proxy supports.
-                       if ( $proxy->use_authentication() )
-                               $arrContext['http']['header'] .= $proxy->authentication_header() . "\r\n";
-               }
-
-               if ( ! is_null($r['body']) && ! empty($r['body'] ) )
-                       $arrContext['http']['content'] = $r['body'];
-
-               $context = stream_context_create($arrContext);
-
-               if ( !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));
-
-               $timeout = (int) floor( $r['timeout'] );
-               $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
-               stream_set_timeout( $handle, $timeout, $utimeout );
-
-               if ( ! $r['blocking'] ) {
-                       stream_set_blocking($handle, 0);
-                       fclose($handle);
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
-               }
-
-               $strResponse = stream_get_contents($handle);
-               $meta = stream_get_meta_data($handle);
-
-               fclose($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);
-
-               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
-                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
-
-               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
-       }
-
-       /**
-        * Whether this class can be used for retrieving an URL.
-        *
-        * @static
-        * @access public
-        * @since 2.7.0
-        *
-        * @return boolean False means this class can not be used, true means it can.
-        */
-       function test($args = array()) {
-               if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
-                       return false;
-
-               if ( version_compare(PHP_VERSION, '5.0', '<') )
-                       return false;
-
-               //HTTPS via Proxy was added in 5.1.0
-               $is_ssl = isset($args['ssl']) && $args['ssl'];
-               if ( $is_ssl && version_compare(PHP_VERSION, '5.1.0', '<') ) {
-                       $proxy = new WP_HTTP_Proxy();
-                       /**
-                        * No URL check, as its not currently passed to the ::test() function
-                        * In the case where a Proxy is in use, Just bypass this transport for HTTPS.
-                        */
-                       if ( $proxy->is_enabled() )
-                               return false;
-               }
-
-               return apply_filters('use_streams_transport', true, $args);
-       }
-}
-
-/**
- * HTTP request method uses HTTP extension to retrieve the url.
- *
- * 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.0
- */
-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', 'cookies' 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, 'cookies' => array()
-               );
-
-               $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']);
-               }
-
-               // Construct Cookie: header if any cookies are set
-               WP_Http::buildCookieHeader( $r );
-
-               switch ( $r['method'] ) {
-                       case 'POST':
-                               $r['method'] = HTTP_METH_POST;
-                               break;
-                       case 'HEAD':
-                               $r['method'] = HTTP_METH_HEAD;
-                               break;
-                       case 'PUT':
-                               $r['method'] =  HTTP_METH_PUT;
-                               break;
-                       case 'GET':
-                       default:
-                               $r['method'] = HTTP_METH_GET;
-               }
-
-               $arrURL = parse_url($url);
-
-               if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
-                       $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
-
-               $is_local = isset($args['local']) && $args['local'];
-               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
-               if ( $is_local )
-                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
-               elseif ( ! $is_local )
-                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
-
-               $r['timeout'] = (int) ceil( $r['timeout'] );
-
-               $options = array(
-                       'timeout' => $r['timeout'],
-                       'connecttimeout' => $r['timeout'],
-                       'redirect' => $r['redirection'],
-                       'useragent' => $r['user-agent'],
-                       'headers' => $r['headers'],
-                       'ssl' => array(
-                               'verifypeer' => $ssl_verify,
-                               'verifyhost' => $ssl_verify
-                       )
-               );
-
-               // The HTTP extensions offers really easy proxy support.
-               $proxy = new WP_HTTP_Proxy();
-
-               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
-                       $options['proxyhost'] = $proxy->host();
-                       $options['proxyport'] = $proxy->port();
-                       $options['proxytype'] = HTTP_PROXY_HTTP;
-
-                       if ( $proxy->use_authentication() ) {
-                               $options['proxyauth'] = $proxy->authentication();
-                               $options['proxyauthtype'] = HTTP_AUTH_BASIC;
-                       }
-               }
-
-               if ( !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
-
-               // Error may still be set, Response may return headers or partial document, and error
-               // contains a reason the request was aborted, eg, timeout expired or max-redirects reached.
-               if ( false === $strResponse || ! empty($info['error']) )
-                       return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
-
-               if ( ! $r['blocking'] )
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
-
-               list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
-               $theHeaders = WP_Http::processHeaders($theHeaders);
-
-               if ( ! empty( $theBody ) && isset( $theHeaders['headers']['transfer-encoding'] ) && 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
-                       if ( !WP_DEBUG )
-                               $theBody = @http_chunked_decode($theBody);
-                       else
-                               $theBody = http_chunked_decode($theBody);
-               }
-
-               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
-                       $theBody = http_inflate( $theBody );
-
-               $theResponse = array();
-               $theResponse['code'] = $info['response_code'];
-               $theResponse['message'] = get_status_header_desc($info['response_code']);
-
-               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse, 'cookies' => $theHeaders['cookies']);
-       }
-
-       /**
-        * Whether this class can be used for retrieving an URL.
-        *
-        * @static
-        * @since 2.7.0
-        *
-        * @return boolean False means this class can not be used, true means it can.
-        */
-       function test($args = array()) {
-               return apply_filters('use_http_extension_transport', function_exists('http_request'), $args );
-       }
-}
-
-/**
- * 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.0
-        *
-        * @param string $url
-        * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', 'cookies' and 'response' keys.
-        */
-       function request($url, $args = array()) {
-               $defaults = array(
-                       'method' => 'GET', 'timeout' => 5,
-                       'redirection' => 5, 'httpversion' => '1.0',
-                       'blocking' => true,
-                       'headers' => array(), 'body' => null, 'cookies' => array()
-               );
-
-               $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']);
-               }
-
-               // Construct Cookie: header if any cookies are set.
-               WP_Http::buildCookieHeader( $r );
-
-               $handle = curl_init();
-
-               // cURL offers really easy proxy support.
-               $proxy = new WP_HTTP_Proxy();
-
-               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
-
-                       $isPHP5 = version_compare(PHP_VERSION, '5.0.0', '>=');
-
-                       if ( $isPHP5 ) {
-                               curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
-                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
-                               curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
-                       } else {
-                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() .':'. $proxy->port() );
-                       }
-
-                       if ( $proxy->use_authentication() ) {
-                               if ( $isPHP5 )
-                                       curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC );
-
-                               curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
-                       }
-               }
-
-               $is_local = isset($args['local']) && $args['local'];
-               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
-               if ( $is_local )
-                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
-               elseif ( ! $is_local )
-                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
-
-
-               // CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers.  Have to use ceil since
-               // a value of 0 will allow an ulimited timeout.
-               $timeout = (int) ceil( $r['timeout'] );
-               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
-               curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
-
-               curl_setopt( $handle, CURLOPT_URL, $url);
-               curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
-               curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, $ssl_verify );
-               curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
-               curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
-               curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
-
-               switch ( $r['method'] ) {
-                       case 'HEAD':
-                               curl_setopt( $handle, CURLOPT_NOBODY, true );
-                               break;
-                       case 'POST':
-                               curl_setopt( $handle, CURLOPT_POST, true );
-                               curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
-                               break;
-                       case 'PUT':
-                               curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
-                               curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
-                               break;
-               }
-
-               if ( true === $r['blocking'] )
-                       curl_setopt( $handle, CURLOPT_HEADER, true );
-               else
-                       curl_setopt( $handle, CURLOPT_HEADER, false );
-
-               // The option doesn't work with safe mode or when open_basedir is set.
-               if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
-                       curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
-
-               if ( !empty( $r['headers'] ) ) {
-                       // cURL expects full header strings in each element
-                       $headers = array();
-                       foreach ( $r['headers'] as $name => $value ) {
-                               $headers[] = "{$name}: $value";
-                       }
-                       curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
-               }
-
-               if ( $r['httpversion'] == '1.0' )
-                       curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
-               else
-                       curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
-
-               // Cookies are not handled by the HTTP API currently. Allow for plugin authors to handle it
-               // themselves... Although, it is somewhat pointless without some reference.
-               do_action_ref_array( 'http_api_curl', array(&$handle) );
-
-               // We don't need to return the body, so don't. Just execute request and return.
-               if ( ! $r['blocking'] ) {
-                       curl_exec( $handle );
-                       curl_close( $handle );
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
-               }
-
-               $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(), 'cookies' => array() );
-                       $theBody = '';
-               }
-
-               $response = array();
-               $response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
-               $response['message'] = get_status_header_desc($response['code']);
-
-               curl_close( $handle );
-
-               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
-                       $theBody = WP_Http_Encoding::decompress( $theBody );
-
-               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);
-       }
-
-       /**
-        * Whether this class can be used for retrieving an URL.
-        *
-        * @static
-        * @since 2.7.0
-        *
-        * @return boolean False means this class can not be used, true means it can.
-        */
-       function test($args = array()) {
-               if ( function_exists('curl_init') && function_exists('curl_exec') )
-                       return apply_filters('use_curl_transport', true, $args);
-
-               return false;
-       }
-}
-
-/**
- * Adds Proxy support to the WordPress HTTP API.
- *
- * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
- * enable proxy support. There are also a few filters that plugins can hook into for some of the
- * constants.
- *
- * The constants are as follows:
- * <ol>
- * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
- * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
- * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
- * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
- * <li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
- * You do not need to have localhost and the blog host in this list, because they will not be passed
- * through the proxy. The list should be presented in a comma separated list</li>
- * </ol>
- *
- * An example can be as seen below.
- * <code>
- * define('WP_PROXY_HOST', '192.168.84.101');
- * define('WP_PROXY_PORT', '8080');
- * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
- * </code>
- *
- * @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
- * @since 2.8
- */
-class WP_HTTP_Proxy {
-
-       /**
-        * Whether proxy connection should be used.
-        *
-        * @since 2.8
-        * @use WP_PROXY_HOST
-        * @use WP_PROXY_PORT
-        *
-        * @return bool
-        */
-       function is_enabled() {
-               return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT');
-       }
-
-       /**
-        * Whether authentication should be used.
-        *
-        * @since 2.8
-        * @use WP_PROXY_USERNAME
-        * @use WP_PROXY_PASSWORD
-        *
-        * @return bool
-        */
-       function use_authentication() {
-               return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD');
-       }
-
-       /**
-        * Retrieve the host for the proxy server.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function host() {
-               if ( defined('WP_PROXY_HOST') )
-                       return WP_PROXY_HOST;
-
-               return '';
-       }
-
-       /**
-        * Retrieve the port for the proxy server.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function port() {
-               if ( defined('WP_PROXY_PORT') )
-                       return WP_PROXY_PORT;
-
-               return '';
-       }
-
-       /**
-        * Retrieve the username for proxy authentication.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function username() {
-               if ( defined('WP_PROXY_USERNAME') )
-                       return WP_PROXY_USERNAME;
-
-               return '';
-       }
-
-       /**
-        * Retrieve the password for proxy authentication.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function password() {
-               if ( defined('WP_PROXY_PASSWORD') )
-                       return WP_PROXY_PASSWORD;
-
-               return '';
-       }
-
-       /**
-        * Retrieve authentication string for proxy authentication.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function authentication() {
-               return $this->username() . ':' . $this->password();
-       }
-
-       /**
-        * Retrieve header string for proxy authentication.
-        *
-        * @since 2.8
-        *
-        * @return string
-        */
-       function authentication_header() {
-               return 'Proxy-Authentication: Basic ' . base64_encode( $this->authentication() );
-       }
-
-       /**
-        * Whether URL should be sent through the proxy server.
-        *
-        * We want to keep localhost and the blog URL from being sent through the proxy server, because
-        * some proxies can not handle this. We also have the constant available for defining other
-        * hosts that won't be sent through the proxy.
-        *
-        * @uses WP_PROXY_BYPASS_HOSTS
-        * @since unknown
-        *
-        * @param string $uri URI to check.
-        * @return bool True, to send through the proxy and false if, the proxy should not be used.
-        */
-       function send_through_proxy( $uri ) {
-               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
-               // This will be displayed on blogs, which is not reasonable.
-               $check = @parse_url($uri);
-
-               // Malformed URL, can not process, but this could mean ssl, so let through anyway.
-               if ( $check === false )
-                       return true;
-
-               $home = parse_url( get_option('siteurl') );
-
-               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
-                       return false;
-
-               if ( !defined('WP_PROXY_BYPASS_HOSTS') )
-                       return true;
-
-               static $bypass_hosts;
-               if ( null == $bypass_hosts )
-                       $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
-
-               return !in_array( $check['host'], $bypass_hosts );
-       }
-}
-/**
- * Internal representation of a single cookie.
- *
- * Returned cookies are represented using this class, and when cookies are set, if they are not
- * already a WP_Http_Cookie() object, then they are turned into one.
- *
- * @todo The WordPress convention is to use underscores instead of camelCase for function and method
- * names. Need to switch to use underscores instead for the methods.
- *
- * @package WordPress
- * @subpackage HTTP
- * @since 2.8.0
- * @author Beau Lebens
- */
-class WP_Http_Cookie {
-
-       /**
-        * Cookie name.
-        *
-        * @since 2.8.0
-        * @var string
-        */
-       var $name;
-
-       /**
-        * Cookie value.
-        *
-        * @since 2.8.0
-        * @var string
-        */
-       var $value;
-
-       /**
-        * When the cookie expires.
-        *
-        * @since 2.8.0
-        * @var string
-        */
-       var $expires;
-
-       /**
-        * Cookie URL path.
-        *
-        * @since 2.8.0
-        * @var string
-        */
-       var $path;
-
-       /**
-        * Cookie Domain.
-        *
-        * @since 2.8.0
-        * @var string
-        */
-       var $domain;
-
-       /**
-        * PHP4 style Constructor - Calls PHP5 Style Constructor.
-        *
-        * @access public
-        * @since 2.8.0
-        * @param string|array $data Raw cookie data.
-        */
-       function WP_Http_Cookie( $data ) {
-               $this->__construct( $data );
-       }
-
-       /**
-        * Sets up this cookie object.
-        *
-        * The parameter $data should be either an associative array containing the indices names below
-        * or a header string detailing it.
-        *
-        * If it's an array, it should include the following elements:
-        * <ol>
-        * <li>Name</li>
-        * <li>Value - should NOT be urlencoded already.</li>
-        * <li>Expires - (optional) String or int (UNIX timestamp).</li>
-        * <li>Path (optional)</li>
-        * <li>Domain (optional)</li>
-        * </ol>
-        *
-        * @access public
-        * @since 2.8.0
-        *
-        * @param string|array $data Raw cookie data.
-        */
-       function __construct( $data ) {
-               if ( is_string( $data ) ) {
-                       // Assume it's a header string direct from a previous request
-                       $pairs = explode( ';', $data );
-
-                       // Special handling for first pair; name=value. Also be careful of "=" in value
-                       $name  = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) );
-                       $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 );
-                       $this->name  = $name;
-                       $this->value = urldecode( $value );
-                       array_shift( $pairs ); //Removes name=value from items.
-
-                       // Set everything else as a property
-                       foreach ( $pairs as $pair ) {
-                               if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
-                                       continue;
-
-                               list( $key, $val ) = explode( '=', $pair );
-                               $key = strtolower( trim( $key ) );
-                               if ( 'expires' == $key )
-                                       $val = strtotime( $val );
-                               $this->$key = $val;
-                       }
-               } else {
-                       if ( !isset( $data['name'] ) )
-                               return false;
-
-                       // Set properties based directly on parameters
-                       $this->name   = $data['name'];
-                       $this->value  = isset( $data['value'] ) ? $data['value'] : '';
-                       $this->path   = isset( $data['path'] ) ? $data['path'] : '';
-                       $this->domain = isset( $data['domain'] ) ? $data['domain'] : '';
-
-                       if ( isset( $data['expires'] ) )
-                               $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] );
-                       else
-                               $this->expires = null;
-               }
-       }
-
-       /**
-        * Confirms that it's OK to send this cookie to the URL checked against.
-        *
-        * Decision is based on RFC 2109/2965, so look there for details on validity.
-        *
-        * @access public
-        * @since 2.8.0
-        *
-        * @param string $url URL you intend to send this cookie to
-        * @return boolean TRUE if allowed, FALSE otherwise.
-        */
-       function test( $url ) {
-               // Expires - if expired then nothing else matters
-               if ( time() > $this->expires )
-                       return false;
-
-               // Get details on the URL we're thinking about sending to
-               $url = parse_url( $url );
-               $url['port'] = isset( $url['port'] ) ? $url['port'] : 80;
-               $url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
-
-               // Values to use for comparison against the URL
-               $path   = isset( $this->path )   ? $this->path   : '/';
-               $port   = isset( $this->port )   ? $this->port   : 80;
-               $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] );
-               if ( false === stripos( $domain, '.' ) )
-                       $domain .= '.local';
-
-               // Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
-               $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
-               if ( substr( $url['host'], -strlen( $domain ) ) != $domain )
-                       return false;
-
-               // Port - supports "port-lists" in the format: "80,8000,8080"
-               if ( !in_array( $url['port'], explode( ',', $port) ) )
-                       return false;
-
-               // Path - request path must start with path restriction
-               if ( substr( $url['path'], 0, strlen( $path ) ) != $path )
-                       return false;
-
-               return true;
-       }
-
-       /**
-        * Convert cookie name and value back to header string.
-        *
-        * @access public
-        * @since 2.8.0
-        *
-        * @return string Header encoded cookie name and value.
-        */
-       function getHeaderValue() {
-               if ( empty( $this->name ) || empty( $this->value ) )
-                       return '';
-
-               return $this->name . '=' . urlencode( $this->value );
-       }
-
-       /**
-        * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
-        *
-        * @access public
-        * @since 2.8.0
-        *
-        * @return string
-        */
-       function getFullHeader() {
-               return 'Cookie: ' . $this->getHeaderValue();
-       }
-}
-
-/**
- * Implementation for deflate and gzip transfer encodings.
- *
- * Includes RFC 1950, RFC 1951, and RFC 1952.
- *
- * @since 2.8
- * @package WordPress
- * @subpackage HTTP
- */
-class WP_Http_Encoding {
-
-       /**
-        * Compress raw string using the deflate format.
-        *
-        * Supports the RFC 1951 standard.
-        *
-        * @since 2.8
-        *
-        * @param string $raw String to compress.
-        * @param int $level Optional, default is 9. Compression level, 9 is highest.
-        * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
-        * @return string|bool False on failure.
-        */
-       function compress( $raw, $level = 9, $supports = null ) {
-               return gzdeflate( $raw, $level );
-       }
-
-       /**
-        * Decompression of deflated string.
-        *
-        * Will attempt to decompress using the RFC 1950 standard, and if that fails
-        * then the RFC 1951 standard deflate will be attempted. Finally, the RFC
-        * 1952 standard gzip decode will be attempted. If all fail, then the
-        * original compressed string will be returned.
-        *
-        * @since 2.8
-        *
-        * @param string $compressed String to decompress.
-        * @param int $length The optional length of the compressed data.
-        * @return string|bool False on failure.
-        */
-       function decompress( $compressed, $length = null ) {
-
-               if ( false !== ( $decompressed = @gzinflate( $compressed ) ) )
-                       return $decompressed;
-
-               if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) )
-                       return $decompressed;
-
-               if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) )
-                       return $decompressed;
-
-               if ( function_exists('gzdecode') ) {
-                       $decompressed = @gzdecode( $compressed );
-
-                       if ( false !== $decompressed )
-                               return $decompressed;
-               }
-
-               return $compressed;
-       }
-
-       /**
-        * Decompression of deflated string while staying compatible with the majority of servers.
-        *
-        * Certain Servers will return deflated data with headers which PHP's gziniflate()
-        * function cannot handle out of the box. The following function lifted from
-        * http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
-        * the various return forms used.
-        *
-        * @since 2.8.1
-        * @link http://au2.php.net/manual/en/function.gzinflate.php#77336
-        *
-        * @param string $gzData String to decompress.
-        * @return string|bool False on failure.
-        */
-       function compatible_gzinflate($gzData) {
-               if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
-                       $i = 10;
-                       $flg = ord( substr($gzData, 3, 1) );
-                       if ( $flg > 0 ) {
-                               if ( $flg & 4 ) {
-                                       list($xlen) = unpack('v', substr($gzData, $i, 2) );
-                                       $i = $i + 2 + $xlen;
-                               }
-                               if ( $flg & 8 )
-                                       $i = strpos($gzData, "\0", $i) + 1;
-                               if ( $flg & 16 )
-                                       $i = strpos($gzData, "\0", $i) + 1;
-                               if ( $flg & 2 )
-                                       $i = $i + 2;
-                       }
-                       return gzinflate( substr($gzData, $i, -8) );
-               } else {
-                       return false;
-               }
-       }
-
-       /**
-        * What encoding types to accept and their priority values.
-        *
-        * @since 2.8
-        *
-        * @return string Types of encoding to accept.
-        */
-       function accept_encoding() {
-               $type = array();
-               if ( function_exists( 'gzinflate' ) )
-                       $type[] = 'deflate;q=1.0';
-
-               if ( function_exists( 'gzuncompress' ) )
-                       $type[] = 'compress;q=0.5';
-
-               if ( function_exists( 'gzdecode' ) )
-                       $type[] = 'gzip;q=0.5';
-
-               return implode(', ', $type);
-       }
-
-       /**
-        * What enconding the content used when it was compressed to send in the headers.
-        *
-        * @since 2.8
-        *
-        * @return string Content-Encoding string to send in the header.
-        */
-       function content_encoding() {
-               return 'deflate';
-       }
-
-       /**
-        * Whether the content be decoded based on the headers.
-        *
-        * @since 2.8
-        *
-        * @param array|string $headers All of the available headers.
-        * @return bool
-        */
-       function should_decode($headers) {
-               if ( is_array( $headers ) ) {
-                       if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
-                               return true;
-               } else if ( is_string( $headers ) ) {
-                       return ( stripos($headers, 'content-encoding:') !== false );
-               }
-
-               return false;
-       }
-
-       /**
-        * Whether decompression and compression are supported by the PHP version.
-        *
-        * Each function is tested instead of checking for the zlib extension, to
-        * ensure that the functions all exist in the PHP version and aren't
-        * disabled.
-        *
-        * @since 2.8
-        *
-        * @return bool
-        */
-       function is_available() {
-               return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
-       }
-}
-
 /**
  * Returns the initialized WP_Http Object
  *
@@ -2119,4 +191,4 @@ function wp_remote_retrieve_body(&$response) {
        return $response['body'];
 }
 
-?>
+?>
\ No newline at end of file
index 74c6f12f0b7015b46da0573311ea2ce4a39dbed8..8ca02d7c1881c563c1fae78dbbf44fdbeecab979 100644 (file)
Binary files a/wp-includes/images/upload.png and b/wp-includes/images/upload.png differ
index 7aac86bcaa86dd86a7f34b8def9be9b83092bc69..ee5c4e4b8566c692b6ed40ad35f260c2dd6ce99e 100644 (file)
@@ -2,7 +2,7 @@ var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', au
 
 jQuery(document).ready( function($) {
        var dotabkey = true;
-       
+
        autosaveLast = $('#post #title').val() + $('#post #content').val();
        autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
 
@@ -39,7 +39,7 @@ jQuery(document).ready( function($) {
 
        // preview
        $('#post-preview').click(function(){
-               if ( 1 > $('#post_ID').val() && notSaved ) {
+               if ( $('#auto_draft').val() == '1' && notSaved ) {
                        autosaveDelayPreview = true;
                        autosave();
                        return false;
@@ -58,7 +58,7 @@ jQuery(document).ready( function($) {
        if ( typeof tinyMCE != 'undefined' ) {
                $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
                        if ( e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey ) {
-                               if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
+                               if ( ($('#auto_draft').val() == '1') && ($("#title").val().length > 0) ) { autosave(); }
                                if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
                                        e.preventDefault();
                                        dotabkey = false;
@@ -70,11 +70,10 @@ jQuery(document).ready( function($) {
        }
 
        // autosave new posts after a title is typed but not if Publish or Save Draft is clicked
-       if ( 0 > $('#post_ID').val() ) {
+       if ( '1' == $('#auto_draft').val() ) {
                $('#title').blur( function() {
-                       if ( !this.value || 0 < $('#post_ID').val() )
+                       if ( !this.value || $('#auto_draft').val() != '1' )
                                return;
-
                        delayed_autosave();
                });
        }
@@ -121,24 +120,23 @@ function autosave_parse_response(response) {
 
 // called when autosaving pre-existing post
 function autosave_saved(response) {
+       blockSave = false;
        autosave_parse_response(response); // parse the ajax response
        autosave_enable_buttons(); // re-enable disabled form buttons
 }
 
 // called when autosaving new post
 function autosave_saved_new(response) {
+       blockSave = false;
        var res = autosave_parse_response(response), tempID, postID;
-       // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
        if ( res && res.responses.length && !res.errors ) {
-               tempID = jQuery('#post_ID').val();
+               // An ID is sent only for real auto-saves, not for autosave=0 "keepalive" saves
                postID = parseInt( res.responses[0].id, 10 );
-               autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
-               if ( tempID < 0 && postID > 0 ) { // update media buttons
+               if ( !isNaN(postID) && postID > 0 ) {
                        notSaved = false;
-                       jQuery('#media-buttons a').each(function(){
-                               this.href = this.href.replace(tempID, postID);
-                       });
+                       jQuery('#auto_draft').val('0'); // No longer an auto-draft
                }
+               autosave_enable_buttons();
                if ( autosaveDelayPreview ) {
                        autosaveDelayPreview = false;
                        doPreview();
@@ -148,28 +146,6 @@ function autosave_saved_new(response) {
        }
 }
 
-function autosave_update_post_ID( postID ) {
-       if ( !isNaN(postID) && postID > 0 ) {
-               if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once
-               jQuery('#post_ID').attr({name: "post_ID"});
-               jQuery('#post_ID').val(postID);
-               // We need new nonces
-               jQuery.post(autosaveL10n.requestFile, {
-                       action: "autosave-generate-nonces",
-                       post_ID: postID,
-                       autosavenonce: jQuery('#autosavenonce').val(),
-                       post_type: jQuery('#post_type').val()
-               }, function(html) {
-                       jQuery('#_wpnonce').val(html.updateNonce);
-                       jQuery('#delete-action a.submitdelete').attr('href', html.deleteURL);
-                       autosave_enable_buttons(); // re-enable disabled form buttons
-                       jQuery('#delete-action a.submitdelete').fadeIn();
-               },
-               'json');
-               jQuery('#hiddenaction').val('editpost');
-       }
-}
-
 function autosave_update_slug(post_id) {
        // create slug area only if not already there
        if ( 'undefined' != makeSlugeditClickable && jQuery.isFunction(makeSlugeditClickable) && !jQuery('#edit-slug-box > *').size() ) {
@@ -217,6 +193,7 @@ function delayed_autosave() {
 
 autosave = function() {
        // (bool) is rich editor enabled and active
+       blockSave = true;
        var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), post_data, doAutoSave, ed, origStatus, successCallback;
 
        autosave_disable_buttons();
@@ -280,23 +257,25 @@ autosave = function() {
                post_data["excerpt"] = jQuery("#excerpt").val();
        if ( jQuery("#post_author").size() )
                post_data["post_author"] = jQuery("#post_author").val();
+       if ( jQuery("#parent_id").val() ) 
+               post_data["parent_id"] = jQuery("#parent_id").val(); 
        post_data["user_ID"] = jQuery("#user-id").val();
+       if ( jQuery('#auto_draft').val() == '1' )
+               post_data["auto_draft"] = '1';
 
        if ( doAutoSave ) {
-               autosaveLast = jQuery("#title").val()+jQuery("#content").val();
+               autosaveLast = jQuery("#title").val() + jQuery("#content").val();
        } else {
                post_data['autosave'] = 0;
        }
 
-       if ( parseInt(post_data["post_ID"], 10) < 1 ) {
-               post_data["temp_ID"] = post_data["post_ID"];
+       if ( post_data["auto_draft"] == '1' ) {
                successCallback = autosave_saved_new; // new post
        } else {
                successCallback = autosave_saved; // pre-existing post
        }
 
        autosaveOldMessage = jQuery('#autosave').html();
-
        jQuery.ajax({
                data: post_data,
                beforeSend: doAutoSave ? autosave_loading : null,
index 1c05613034f2e4c8b4a44726d442bff76c9b0226..581fc6f909cf41651f8fcea3c004a9482e182056 100644 (file)
@@ -1 +1 @@
-var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,interimLogin=false;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;b(":button, :submit","#submitpost").each(function(){var c=b(this);if(c.hasClass("button-primary")){c.addClass("button-primary-disabled")}else{c.addClass("button-disabled")}});b("#ajax-loading").css("visibility","visible")});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{e=b("#post #title").val(),d=b("#post #content").val();if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(1>b("#post_ID").val()&&notSaved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#post_ID").val()<1)&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if(0>b("#post_ID").val()){b("#title").blur(function(){if(!this.value||0<b("#post_ID").val()){return}delayed_autosave()})}});function autosave_parse_response(c){var e=wpAjax.parseAjaxResponse(c,"autosave"),f="",a,b,d;if(e&&e.responses&&e.responses.length){f=e.responses[0].data;if(e.responses[0].supplemental){b=e.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};e={errors:true}}if(b.session_expired&&(d=b.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(d,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete b.session_expired}jQuery.each(b,function(g,h){if(g.match(/^replace-/)){jQuery("#"+g.replace("replace-","")).val(h)}})}if(!e.errors){a=parseInt(e.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(f){jQuery("#autosave").html(f)}else{if(autosaveOldMessage&&e){jQuery("#autosave").html(autosaveOldMessage)}}return e}function autosave_saved(a){autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){c=jQuery("#post_ID").val();a=parseInt(d.responses[0].id,10);autosave_update_post_ID(a);if(c<0&&a>0){notSaved=false;jQuery("#media-buttons a").each(function(){this.href=this.href.replace(c,a)})}if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_post_ID(a){if(!isNaN(a)&&a>0){if(a==parseInt(jQuery("#post_ID").val(),10)){return}jQuery("#post_ID").attr({name:"post_ID"});jQuery("#post_ID").val(a);jQuery.post(autosaveL10n.requestFile,{action:"autosave-generate-nonces",post_ID:a,autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()},function(b){jQuery("#_wpnonce").val(b.updateNonce);jQuery("#delete-action a.submitdelete").attr("href",b.deleteURL);autosave_enable_buttons();jQuery("#delete-action a.submitdelete").fadeIn()},"json");jQuery("#hiddenaction").val("editpost")}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery("#ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}d.user_ID=jQuery("#user-id").val();if(f){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{d.autosave=0}if(parseInt(d.post_ID,10)<1){d.temp_ID=d.post_ID;a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
\ No newline at end of file
+var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,interimLogin=false;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;b(":button, :submit","#submitpost").each(function(){var c=b(this);if(c.hasClass("button-primary")){c.addClass("button-primary-disabled")}else{c.addClass("button-disabled")}});b("#ajax-loading").css("visibility","visible")});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{e=b("#post #title").val(),d=b("#post #content").val();if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(b("#auto_draft").val()=="1"&&notSaved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#auto_draft").val()=="1")&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if("1"==b("#auto_draft").val()){b("#title").blur(function(){if(!this.value||b("#auto_draft").val()!="1"){return}delayed_autosave()})}});function autosave_parse_response(c){var e=wpAjax.parseAjaxResponse(c,"autosave"),f="",a,b,d;if(e&&e.responses&&e.responses.length){f=e.responses[0].data;if(e.responses[0].supplemental){b=e.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};e={errors:true}}if(b.session_expired&&(d=b.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(d,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete b.session_expired}jQuery.each(b,function(g,h){if(g.match(/^replace-/)){jQuery("#"+g.replace("replace-","")).val(h)}})}if(!e.errors){a=parseInt(e.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(f){jQuery("#autosave").html(f)}else{if(autosaveOldMessage&&e){jQuery("#autosave").html(autosaveOldMessage)}}return e}function autosave_saved(a){blockSave=false;autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){blockSave=false;var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){a=parseInt(d.responses[0].id,10);if(!isNaN(a)&&a>0){notSaved=false;jQuery("#auto_draft").val("0")}autosave_enable_buttons();if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery("#ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){blockSave=true;var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}if(jQuery("#parent_id").val()){d.parent_id=jQuery("#parent_id").val()}d.user_ID=jQuery("#user-id").val();if(jQuery("#auto_draft").val()=="1"){d.auto_draft="1"}if(f){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{d.autosave=0}if(d.auto_draft=="1"){a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
\ No newline at end of file
diff --git a/wp-includes/js/codepress/codepress.css b/wp-includes/js/codepress/codepress.css
deleted file mode 100644 (file)
index 3a4a00a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-body {
-       margin-top:13px;
-       _margin-top:14px;
-       background:white;
-       margin-left:32px;
-       font-family:monospace;
-       font-size:13px;
-       white-space:pre;
-       background-image:url("images/line-numbers.png");
-       background-repeat:repeat-y;
-       background-position:0 3px;
-       line-height:16px;
-       height:100%;
-}
-pre {margin:0;}
-html>body{background-position:0 2px;}
-P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;}
-b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;}
-
-body.hide-line-numbers {background:white;margin-left:16px;}
-body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/codepress.html b/wp-includes/js/codepress/codepress.html
deleted file mode 100644 (file)
index d9711d6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-       <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
-       <meta name="description" content="CodePress - source code editor window" />
-
-       <script type="text/javascript">
-       var language = 'generic';
-       var engine = 'older';
-       var ua = navigator.userAgent;
-       var ts = (new Date).getTime(); // timestamp to avoid cache
-       var lh = location.href;
-       
-       if(ua.match('MSIE')) engine = 'msie';
-       else if(ua.match('KHTML')) engine = 'khtml'; 
-       else if(ua.match('Opera')) engine = 'opera'; 
-       else if(ua.match('Gecko')) engine = 'gecko';
-
-       if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
-
-       document.write('<link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />');
-       document.write('<link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
-       document.write('<scr'+'ipt type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
-       document.write('<scr'+'ipt type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
-       </script>
-
-</head>
-
-<script type="text/javascript">
-if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
-else if(engine == "opera") document.write('<body></body>');
-// else if(engine == "khtml") document.write('<body> </body>');
-</script>
-
-</html>
diff --git a/wp-includes/js/codepress/codepress.js b/wp-includes/js/codepress/codepress.js
deleted file mode 100644 (file)
index 804f29a..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- * 
- * Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the 
- * GNU Lesser General Public License as published by the Free Software Foundation.
- * 
- * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
- */
-
-CodePress = function(obj) {
-       var self = document.createElement('iframe');
-       self.textarea = obj;
-       self.textarea.disabled = true;
-       self.textarea.style.overflow = 'hidden';
-       self.style.height = self.textarea.clientHeight +'px';
-       self.style.width = self.textarea.clientWidth +'px';
-       self.textarea.style.overflow = 'auto';
-       self.style.border = '1px solid gray';
-       self.frameBorder = 0; // remove IE internal iframe border
-       self.style.visibility = 'hidden';
-       self.style.position = 'absolute';
-       self.options = self.textarea.className;
-       
-       self.initialize = function() {
-               self.editor = self.contentWindow.CodePress;
-               self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
-               self.editor.setCode(self.textarea.value);
-               self.setOptions();
-               self.editor.syntaxHighlight('init');
-               self.textarea.style.display = 'none';
-               self.style.position = 'static';
-               self.style.visibility = 'visible';
-               self.style.display = 'inline';
-       }
-       
-       // obj can by a textarea id or a string (code)
-       self.edit = function(obj,language) {
-               if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;
-               if(!self.textarea.disabled) return;
-               self.language = language ? language : self.getLanguage();
-               self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime();
-               if(self.attachEvent) self.attachEvent('onload',self.initialize);
-               else self.addEventListener('load',self.initialize,false);
-       }
-
-       self.getLanguage = function() {
-               for (language in CodePress.languages) 
-                       if(self.options.match('\\b'+language+'\\b')) 
-                               return CodePress.languages[language] ? language : 'generic';
-       }
-       
-       self.setOptions = function() {
-               if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
-               if(self.options.match('readonly-on')) self.toggleReadOnly();
-               if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
-       }
-       
-       self.getCode = function() {
-               return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
-       }
-
-       self.setCode = function(code) {
-               self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;
-       }
-
-       self.toggleAutoComplete = function() {
-               self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
-       }
-       
-       self.toggleReadOnly = function() {
-               self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
-               if(self.style.display != 'none') // prevent exception on FF + iframe with display:none
-                       self.editor.readOnly(self.textarea.readOnly ? true : false);
-       }
-       
-       self.toggleLineNumbers = function() {
-               var cn = self.editor.body.className;
-               self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
-       }
-       
-       self.toggleEditor = function() {
-               if(self.textarea.disabled) {
-                       self.textarea.value = self.getCode();
-                       self.textarea.disabled = false;
-                       self.style.display = 'none';
-                       self.textarea.style.display = 'inline';
-               }
-               else {
-                       self.textarea.disabled = true;
-                       self.setCode(self.textarea.value);
-                       self.editor.syntaxHighlight('init');
-                       self.style.display = 'inline';
-                       self.textarea.style.display = 'none';
-               }
-       }
-
-       self.edit();
-       return self;
-}
-
-CodePress.languages = {        
-       csharp : 'C#', 
-       css : 'CSS', 
-       generic : 'Generic',
-       html : 'HTML',
-       java : 'Java', 
-       javascript : 'JavaScript', 
-       perl : 'Perl', 
-       ruby : 'Ruby',  
-       php : 'PHP', 
-       text : 'Text', 
-       sql : 'SQL',
-       vbscript : 'VBScript'
-}
-
-
-CodePress.run = function() {
-       // Modified for WordPress compat to prevent loading on webkit and to
-       // reference a codepress_path which is specified externally.
-       if (navigator.userAgent.toLowerCase().indexOf('webkit') != -1)
-               return;
-       CodePress.path = codepress_path;
-       var t = document.getElementsByTagName('textarea'), i, id;
-       for(i=0,n=t.length;i<n;i++) {
-               if(t[i].className.match('codepress')) {
-                       id = t[i].id;
-                       t[i].id = id+'_cp';
-                       eval(id+' = new CodePress(t[i])');
-                       t[i].parentNode.insertBefore(eval(id), t[i]);
-               } 
-       }
-}
-
-if(window.attachEvent) window.attachEvent('onload',CodePress.run);
-else window.addEventListener('DOMContentLoaded',CodePress.run,false);
diff --git a/wp-includes/js/codepress/engines/gecko.js b/wp-includes/js/codepress/engines/gecko.js
deleted file mode 100644 (file)
index cd239ee..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- * 
- * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
- *
- * Developers:
- *             Fernando M.A.d.S. <fermads@gmail.com>
- *             Michael Hurni <michael.hurni@gmail.com>
- * Contributors:       
- *             Martin D. Kirk
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the 
- * GNU Lesser General Public License as published by the Free Software Foundation.
- * 
- * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
- */
-
-CodePress = {
-       scrolling : false,
-       autocomplete : true,
-
-       // set initial vars and start sh
-       initialize : function() {
-               if(typeof(editor)=='undefined' && !arguments[0]) return;
-               body = document.getElementsByTagName('body')[0];
-               body.innerHTML = body.innerHTML.replace(/\n/g,"");
-               chars = '|32|46|62|8|'; // charcodes that trigger syntax highlighting
-               cc = '\u2009'; // carret char
-               editor = document.getElementsByTagName('pre')[0];
-               document.designMode = 'on';
-               document.addEventListener('keypress', this.keyHandler, true);
-               window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
-               completeChars = this.getCompleteChars();
-               completeEndingChars =  this.getCompleteEndingChars();
-       },
-
-       // treat key bindings
-       keyHandler : function(evt) {
-       keyCode = evt.keyCode;  
-               charCode = evt.charCode;
-               fromChar = String.fromCharCode(charCode);
-
-               if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
-                       CodePress.shortcuts(charCode?charCode:keyCode);
-               }
-               else if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1) && CodePress.autocomplete) { // auto complete
-                       if(!CodePress.completeEnding(fromChar))
-                            CodePress.complete(fromChar);
-               }
-           else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
-                       top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
-               }
-               else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
-                       CodePress.snippets(evt);
-               }
-               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
-                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
-               }
-               else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
-                       (charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
-                       evt.preventDefault();
-               }
-               else if(charCode==118 && evt.ctrlKey)  { // handle paste
-                       top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
-               }
-               else if(charCode==99 && evt.ctrlKey)  { // handle cut
-                       //alert(window.getSelection().getRangeAt(0).toString().replace(/\t/g,'FFF'));
-               }
-
-       },
-
-       // put cursor back to its original position after every parsing
-       findString : function() {
-               if(self.find(cc))
-                       window.getSelection().getRangeAt(0).deleteContents();
-       },
-       
-       // split big files, highlighting parts of it
-       split : function(code,flag) {
-               if(flag=='scroll') {
-                       this.scrolling = true;
-                       return code;
-               }
-               else {
-                       this.scrolling = false;
-                       mid = code.indexOf(cc);
-                       if(mid-2000<0) {ini=0;end=4000;}
-                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
-                       else {ini=mid-2000;end=mid+2000;}
-                       code = code.substring(ini,end);
-                       return code;
-               }
-       },
-       
-       getEditor : function() {
-               if(!document.getElementsByTagName('pre')[0]) {
-                       body = document.getElementsByTagName('body')[0];
-                       if(!body.innerHTML) return body;
-                       if(body.innerHTML=="<br>") body.innerHTML = "<pre> </pre>";
-                       else body.innerHTML = "<pre>"+body.innerHTML+"</pre>";
-               }
-               return document.getElementsByTagName('pre')[0];
-       },
-       
-       // syntax highlighting parser
-       syntaxHighlight : function(flag) {
-               //if(document.designMode=='off') document.designMode='on'
-               if(flag != 'init') { window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));}
-               editor = CodePress.getEditor();
-               o = editor.innerHTML;
-               o = o.replace(/<br>/g,'\n');
-               o = o.replace(/<.*?>/g,'');
-               x = z = this.split(o,flag);
-               x = x.replace(/\n/g,'<br>');
-
-               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
-       
-               for(i=0;i<Language.syntax.length;i++) 
-                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
-
-               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x);
-               if(flag!='init') this.findString();
-       },
-       
-       getLastWord : function() {
-               var rangeAndCaret = CodePress.getRangeAndCaret();
-               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
-               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
-               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
-       },
-       
-       snippets : function(evt) {
-               var snippets = Language.snippets;       
-               var trigger = this.getLastWord();
-               for (var i=0; i<snippets.length; i++) {
-                       if(snippets[i].input == trigger) {
-                               var content = snippets[i].output.replace(/</g,'&lt;');
-                               content = content.replace(/>/g,'&gt;');
-                               if(content.indexOf('$0')<0) content += cc;
-                               else content = content.replace(/\$0/,cc);
-                               content = content.replace(/\n/g,'<br>');
-                               var pattern = new RegExp(trigger+cc,'gi');
-                               evt.preventDefault(); // prevent the tab key from being added
-                               this.syntaxHighlight('snippets',pattern,content);
-                       }
-               }
-       },
-       
-       readOnly : function() {
-               document.designMode = (arguments[0]) ? 'off' : 'on';
-       },
-
-       complete : function(trigger) {
-               window.getSelection().getRangeAt(0).deleteContents();
-               var complete = Language.complete;
-               for (var i=0; i<complete.length; i++) {
-                       if(complete[i].input == trigger) {
-                               var pattern = new RegExp('\\'+trigger+cc);
-                               var content = complete[i].output.replace(/\$0/g,cc);
-                               parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
-                       }
-               }
-       },
-
-       getCompleteChars : function() {
-               var cChars = '';
-               for(var i=0;i<Language.complete.length;i++)
-                       cChars += '|'+Language.complete[i].input;
-               return cChars+'|';
-       },
-       
-       getCompleteEndingChars : function() {
-               var cChars = '';
-               for(var i=0;i<Language.complete.length;i++)
-                       cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
-               return cChars+'|';
-       },
-       
-       completeEnding : function(trigger) {
-               var range = window.getSelection().getRangeAt(0);
-               try {
-                       range.setEnd(range.endContainer, range.endOffset+1)
-               }
-               catch(e) {
-                       return false;
-               }
-               var next_character = range.toString()
-               range.setEnd(range.endContainer, range.endOffset-1)
-               if(next_character != trigger) return false;
-               else {
-                       range.setEnd(range.endContainer, range.endOffset+1)
-                       range.deleteContents();
-                       return true;
-               }
-       },
-       
-       shortcuts : function() {
-               var cCode = arguments[0];
-               if(cCode==13) cCode = '[enter]';
-               else if(cCode==32) cCode = '[space]';
-               else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
-               for(var i=0;i<Language.shortcuts.length;i++)
-                       if(Language.shortcuts[i].input == cCode)
-                               this.insertCode(Language.shortcuts[i].output,false);
-       },
-       
-       getRangeAndCaret : function() { 
-               var range = window.getSelection().getRangeAt(0);
-               var range2 = range.cloneRange();
-               var node = range.endContainer;                  
-               var caret = range.endOffset;
-               range2.selectNode(node);        
-               return [range2.toString(),caret];
-       },
-       
-       insertCode : function(code,replaceCursorBefore) {
-               var range = window.getSelection().getRangeAt(0);
-               var node = window.document.createTextNode(code);
-               var selct = window.getSelection();
-               var range2 = range.cloneRange();
-               // Insert text at cursor position
-               selct.removeAllRanges();
-               range.deleteContents();
-               range.insertNode(node);
-               // Move the cursor to the end of text
-               range2.selectNode(node);                
-               range2.collapse(replaceCursorBefore);
-               selct.removeAllRanges();
-               selct.addRange(range2);
-       },
-       
-       // get code from editor
-       getCode : function() {
-               if(!document.getElementsByTagName('pre')[0] || editor.innerHTML == '')
-                       editor = CodePress.getEditor();
-               var code = editor.innerHTML;
-               code = code.replace(/<br>/g,'\n');
-               code = code.replace(/\u2009/g,'');
-               code = code.replace(/<.*?>/g,'');
-               code = code.replace(/&lt;/g,'<');
-               code = code.replace(/&gt;/g,'>');
-               code = code.replace(/&amp;/gi,'&');
-               return code;
-       },
-
-       // put code inside editor
-       setCode : function() {
-               var code = arguments[0];
-               code = code.replace(/\u2009/gi,'');
-               code = code.replace(/&/gi,'&amp;');
-               code = code.replace(/</g,'&lt;');
-               code = code.replace(/>/g,'&gt;');
-               editor.innerHTML = code;
-               if (code == '')
-                       document.getElementsByTagName('body')[0].innerHTML = '';
-       },
-
-       // undo and redo methods
-       actions : {
-               pos : -1, // actual history position
-               history : [], // history vector
-               
-               undo : function() {
-                       editor = CodePress.getEditor();
-                       if(editor.innerHTML.indexOf(cc)==-1){
-                               if(editor.innerHTML != " ")
-                                       window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
-                               this.history[this.pos] = editor.innerHTML;
-                       }
-                       this.pos --;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos ++;
-                       editor.innerHTML = this.history[this.pos];
-                       if(editor.innerHTML.indexOf(cc)>-1) editor.innerHTML+=cc;
-                       CodePress.findString();
-               },
-               
-               redo : function() {
-                       // editor = CodePress.getEditor();
-                       this.pos++;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
-                       editor.innerHTML = this.history[this.pos];
-                       CodePress.findString();
-               },
-               
-               next : function() { // get next vector position and clean old ones
-                       if(this.pos>20) this.history[this.pos-21] = undefined;
-                       return ++this.pos;
-               }
-       }
-}
-
-Language={};
-window.addEventListener('load', function() { CodePress.initialize('new'); }, true);
\ No newline at end of file
diff --git a/wp-includes/js/codepress/engines/khtml.js b/wp-includes/js/codepress/engines/khtml.js
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/wp-includes/js/codepress/engines/msie.js b/wp-includes/js/codepress/engines/msie.js
deleted file mode 100644 (file)
index 2558c39..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- * 
- * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
- *
- * Developers:
- *             Fernando M.A.d.S. <fermads@gmail.com>
- *             Michael Hurni <michael.hurni@gmail.com>
- * Contributors:       
- *             Martin D. Kirk
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the 
- * GNU Lesser General Public License as published by the Free Software Foundation.
- * 
- * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
- */
-
-CodePress = {
-       scrolling : false,
-       autocomplete : true,
-       
-       // set initial vars and start sh
-       initialize : function() {
-               if(typeof(editor)=='undefined' && !arguments[0]) return;
-               chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
-               cc = '\u2009'; // carret char
-               editor = document.getElementsByTagName('pre')[0];
-               editor.contentEditable = 'true';
-               document.getElementsByTagName('body')[0].onfocus = function() {editor.focus();}
-               document.attachEvent('onkeydown', this.metaHandler);
-               document.attachEvent('onkeypress', this.keyHandler);
-               window.attachEvent('onscroll', function() { if(!CodePress.scrolling) setTimeout(function(){CodePress.syntaxHighlight('scroll')},1)});
-               completeChars = this.getCompleteChars();
-               completeEndingChars =  this.getCompleteEndingChars();
-               setTimeout(function() { window.scroll(0,0) },50); // scroll IE to top
-       },
-       
-       // treat key bindings
-       keyHandler : function(evt) {
-               charCode = evt.keyCode;
-               fromChar = String.fromCharCode(charCode);
-               
-               if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1  )&& CodePress.autocomplete) { // auto complete
-                       if(!CodePress.completeEnding(fromChar))
-                            CodePress.complete(fromChar);
-               }
-           else if(chars.indexOf('|'+charCode+'|')!=-1||charCode==13) { // syntax highlighting
-                       CodePress.syntaxHighlight('generic');
-               }
-       },
-
-       metaHandler : function(evt) {
-               keyCode = evt.keyCode;
-               
-               if(keyCode==9 || evt.tabKey) { 
-                       CodePress.snippets();
-               }
-               else if((keyCode==122||keyCode==121||keyCode==90) && evt.ctrlKey) { // undo and redo
-                       (keyCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
-                       evt.returnValue = false;
-               }
-               else if(keyCode==34||keyCode==33) { // handle page up/down for IE
-                       self.scrollBy(0, (keyCode==34) ? 200 : -200); 
-                       evt.returnValue = false;
-               }
-               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
-                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
-               }
-               else if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && keyCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
-                       CodePress.shortcuts(keyCode);
-                       evt.returnValue = false;
-               }
-               else if(keyCode==86 && evt.ctrlKey)  { // handle paste
-                       window.clipboardData.setData('Text',window.clipboardData.getData('Text').replace(/\t/g,'\u2008'));
-                       top.setTimeout(function(){CodePress.syntaxHighlight('paste');},10);
-               }
-               else if(keyCode==67 && evt.ctrlKey)  { // handle cut
-                       // window.clipboardData.setData('Text',x[0]);
-                       // code = window.clipboardData.getData('Text');
-               }
-       },
-
-       // put cursor back to its original position after every parsing
-       
-       
-       findString : function() {
-               range = self.document.body.createTextRange();
-               if(range.findText(cc)){
-                       range.select();
-                       range.text = '';
-               }
-       },
-       
-       // split big files, highlighting parts of it
-       split : function(code,flag) {
-               if(flag=='scroll') {
-                       this.scrolling = true;
-                       return code;
-               }
-               else {
-                       this.scrolling = false;
-                       mid = code.indexOf(cc);
-                       if(mid-2000<0) {ini=0;end=4000;}
-                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
-                       else {ini=mid-2000;end=mid+2000;}
-                       code = code.substring(ini,end);
-                       return code.substring(code.indexOf('<P>'),code.lastIndexOf('</P>')+4);
-               }
-       },
-       
-       // syntax highlighting parser
-       syntaxHighlight : function(flag) {
-               if(flag!='init') document.selection.createRange().text = cc;
-               o = editor.innerHTML;
-               if(flag=='paste') { // fix pasted text
-                       o = o.replace(/<BR>/g,'\r\n'); 
-                       o = o.replace(/\u2008/g,'\t');
-               }
-               o = o.replace(/<P>/g,'\n');
-               o = o.replace(/<\/P>/g,'\r');
-               o = o.replace(/<.*?>/g,'');
-               o = o.replace(/&nbsp;/g,'');                    
-               o = '<PRE><P>'+o+'</P></PRE>';
-               o = o.replace(/\n\r/g,'<P></P>');
-               o = o.replace(/\n/g,'<P>');
-               o = o.replace(/\r/g,'<\/P>');
-               o = o.replace(/<P>(<P>)+/,'<P>');
-               o = o.replace(/<\/P>(<\/P>)+/,'</P>');
-               o = o.replace(/<P><\/P>/g,'<P><BR/></P>');
-               x = z = this.split(o,flag);
-
-               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
-       
-               for(i=0;i<Language.syntax.length;i++) 
-                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
-                       
-               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.replace(z,x);
-               if(flag!='init') this.findString();
-       },
-
-       snippets : function(evt) {
-               var snippets = Language.snippets;
-               var trigger = this.getLastWord();
-               for (var i=0; i<snippets.length; i++) {
-                       if(snippets[i].input == trigger) {
-                               var content = snippets[i].output.replace(/</g,'&lt;');
-                               content = content.replace(/>/g,'&gt;');
-                               if(content.indexOf('$0')<0) content += cc;
-                               else content = content.replace(/\$0/,cc);
-                               content = content.replace(/\n/g,'</P><P>');
-                               var pattern = new RegExp(trigger+cc,"gi");
-                               this.syntaxHighlight('snippets',pattern,content);
-                       }
-               }
-       },
-       
-       readOnly : function() {
-               editor.contentEditable = (arguments[0]) ? 'false' : 'true';
-       },
-       
-       complete : function(trigger) {
-               var complete = Language.complete;
-               for (var i=0; i<complete.length; i++) {
-                       if(complete[i].input == trigger) {
-                               var pattern = new RegExp('\\'+trigger+cc);
-                               var content = complete[i].output.replace(/\$0/g,cc);
-                               setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
-                       }
-               }
-       },
-       
-       getCompleteChars : function() {
-               var cChars = '';
-               for(var i=0;i<Language.complete.length;i++)
-                       cChars += '|'+Language.complete[i].input;
-               return cChars+'|';
-       },
-
-       getCompleteEndingChars : function() {
-               var cChars = '';
-               for(var i=0;i<Language.complete.length;i++)
-                       cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
-               return cChars+'|';
-       },
-
-       completeEnding : function(trigger) {
-               var range = document.selection.createRange();
-               try {
-                       range.moveEnd('character', 1)
-               }
-               catch(e) {
-                       return false;
-               }
-               var next_character = range.text
-               range.moveEnd('character', -1)
-               if(next_character != trigger )  return false;
-               else {
-                       range.moveEnd('character', 1)
-                       range.text=''
-                       return true;
-               }
-       },      
-
-       shortcuts : function() {
-               var cCode = arguments[0];
-               if(cCode==13) cCode = '[enter]';
-               else if(cCode==32) cCode = '[space]';
-               else cCode = '['+String.fromCharCode(keyCode).toLowerCase()+']';
-               for(var i=0;i<Language.shortcuts.length;i++)
-                       if(Language.shortcuts[i].input == cCode)
-                               this.insertCode(Language.shortcuts[i].output,false);
-       },
-       
-       getLastWord : function() {
-               var rangeAndCaret = CodePress.getRangeAndCaret();
-               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
-               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
-               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
-       }, 
-
-       getRangeAndCaret : function() { 
-               var range = document.selection.createRange();
-               var caret = Math.abs(range.moveStart('character', -1000000)+1);
-               range = this.getCode();
-               range = range.replace(/\n\r/gi,'  ');
-               range = range.replace(/\n/gi,'');
-               return [range.toString(),caret];
-       },
-       
-       insertCode : function(code,replaceCursorBefore) {
-               var repdeb = '';
-               var repfin = '';
-               
-               if(replaceCursorBefore) { repfin = code; }
-               else { repdeb = code; }
-               
-               if(typeof document.selection != 'undefined') {
-                       var range = document.selection.createRange();
-                       range.text = repdeb + repfin;
-                       range = document.selection.createRange();
-                       range.move('character', -repfin.length);
-                       range.select(); 
-               }       
-       },
-
-       // get code from editor 
-       getCode : function() {
-               var code = editor.innerHTML;
-               code = code.replace(/<br>/g,'\n');
-               code = code.replace(/<\/p>/gi,'\r');
-               code = code.replace(/<p>/i,''); // IE first line fix
-               code = code.replace(/<p>/gi,'\n');
-               code = code.replace(/&nbsp;/gi,'');
-               code = code.replace(/\u2009/g,'');
-               code = code.replace(/<.*?>/g,'');
-               code = code.replace(/&lt;/g,'<');
-               code = code.replace(/&gt;/g,'>');
-               code = code.replace(/&amp;/gi,'&');
-               return code;
-       },
-
-       // put code inside editor
-       setCode : function() {
-               var code = arguments[0];
-               code = code.replace(/\u2009/gi,'');
-               code = code.replace(/&/gi,'&amp;');             
-               code = code.replace(/</g,'&lt;');
-        code = code.replace(/>/g,'&gt;');
-               editor.innerHTML = '<pre>'+code+'</pre>';
-       },
-
-       
-       // undo and redo methods
-       actions : {
-               pos : -1, // actual history position
-               history : [], // history vector
-               
-               undo : function() {
-                       if(editor.innerHTML.indexOf(cc)==-1){
-                               document.selection.createRange().text = cc;
-                               this.history[this.pos] = editor.innerHTML;
-                       }
-                       this.pos--;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos++;
-                       editor.innerHTML = this.history[this.pos];
-                       CodePress.findString();
-               },
-               
-               redo : function() {
-                       this.pos++;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
-                       editor.innerHTML = this.history[this.pos];
-                       CodePress.findString();
-               },
-               
-               next : function() { // get next vector position and clean old ones
-                       if(this.pos>20) this.history[this.pos-21] = undefined;
-                       return ++this.pos;
-               }
-       }
-}
-
-Language={};
-window.attachEvent('onload', function() { CodePress.initialize('new');});
\ No newline at end of file
diff --git a/wp-includes/js/codepress/engines/older.js b/wp-includes/js/codepress/engines/older.js
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/wp-includes/js/codepress/engines/opera.js b/wp-includes/js/codepress/engines/opera.js
deleted file mode 100644 (file)
index 155bf09..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- * 
- * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
- *
- * Contributors :
- *
- *     Michael Hurni <michael.hurni@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the 
- * GNU Lesser General Public License as published by the Free Software Foundation.
- * 
- * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
- */
-
-
-CodePress = {
-       scrolling : false,
-       autocomplete : true,
-
-       // set initial vars and start sh
-       initialize : function() {
-               if(typeof(editor)=='undefined' && !arguments[0]) return;
-               chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
-               cc = '\u2009'; // control char
-               editor = document.getElementsByTagName('body')[0];
-               document.designMode = 'on';
-               document.addEventListener('keyup', this.keyHandler, true);
-               window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
-               completeChars = this.getCompleteChars();
-//             CodePress.syntaxHighlight('init');
-       },
-
-       // treat key bindings
-       keyHandler : function(evt) {
-       keyCode = evt.keyCode;  
-               charCode = evt.charCode;
-
-               if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
-                       CodePress.shortcuts(charCode?charCode:keyCode);
-               }
-               else if(completeChars.indexOf('|'+String.fromCharCode(charCode)+'|')!=-1 && CodePress.autocomplete) { // auto complete
-                       CodePress.complete(String.fromCharCode(charCode));
-               }
-           else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
-                       CodePress.syntaxHighlight('generic');
-               }
-               else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
-                       CodePress.snippets(evt);
-               }
-               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
-                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
-               }
-               else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
-                       (charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
-                       evt.preventDefault();
-               }
-               else if(keyCode==86 && evt.ctrlKey)  { // paste
-                       // TODO: pasted text should be parsed and highlighted
-               }
-       },
-
-       // put cursor back to its original position after every parsing
-       findString : function() {
-               var sel = window.getSelection();
-               var range = window.document.createRange();
-               var span = window.document.getElementsByTagName('span')[0];
-                       
-               range.selectNode(span);
-               sel.removeAllRanges();
-               sel.addRange(range);
-               span.parentNode.removeChild(span);
-               //if(self.find(cc))
-               //window.getSelection().getRangeAt(0).deleteContents();
-       },
-       
-       // split big files, highlighting parts of it
-       split : function(code,flag) {
-               if(flag=='scroll') {
-                       this.scrolling = true;
-                       return code;
-               }
-               else {
-                       this.scrolling = false;
-                       mid = code.indexOf('<SPAN>');
-                       if(mid-2000<0) {ini=0;end=4000;}
-                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
-                       else {ini=mid-2000;end=mid+2000;}
-                       code = code.substring(ini,end);
-                       return code;
-               }
-       },
-       
-       // syntax highlighting parser
-       syntaxHighlight : function(flag) {
-               //if(document.designMode=='off') document.designMode='on'
-               if(flag!='init') {
-                       var span = document.createElement('span');
-                       window.getSelection().getRangeAt(0).insertNode(span);
-               }
-
-               o = editor.innerHTML;
-//             o = o.replace(/<br>/g,'\r\n');
-//             o = o.replace(/<(b|i|s|u|a|em|tt|ins|big|cite|strong)?>/g,'');
-               //alert(o)
-               o = o.replace(/<(?!span|\/span|br).*?>/gi,'');
-//             alert(o)
-//             x = o;
-               x = z = this.split(o,flag);
-               //alert(z)
-//             x = x.replace(/\r\n/g,'<br>');
-               x = x.replace(/\t/g, '        ');
-
-
-               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
-       
-               for(i=0;i<Language.syntax.length;i++) 
-                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
-
-               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); 
-
-               if(flag!='init') this.findString();
-       },
-       
-       getLastWord : function() {
-               var rangeAndCaret = CodePress.getRangeAndCaret();
-               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
-               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
-               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
-       }, 
-       
-       snippets : function(evt) {
-               var snippets = Language.snippets;       
-               var trigger = this.getLastWord();
-               for (var i=0; i<snippets.length; i++) {
-                       if(snippets[i].input == trigger) {
-                               var content = snippets[i].output.replace(/</g,'&lt;');
-                               content = content.replace(/>/g,'&gt;');
-                               if(content.indexOf('$0')<0) content += cc;
-                               else content = content.replace(/\$0/,cc);
-                               content = content.replace(/\n/g,'<br>');
-                               var pattern = new RegExp(trigger+cc,'gi');
-                               evt.preventDefault(); // prevent the tab key from being added
-                               this.syntaxHighlight('snippets',pattern,content);
-                       }
-               }
-       },
-       
-       readOnly : function() {
-               document.designMode = (arguments[0]) ? 'off' : 'on';
-       },
-
-       complete : function(trigger) {
-               window.getSelection().getRangeAt(0).deleteContents();
-               var complete = Language.complete;
-               for (var i=0; i<complete.length; i++) {
-                       if(complete[i].input == trigger) {
-                               var pattern = new RegExp('\\'+trigger+cc);
-                               var content = complete[i].output.replace(/\$0/g,cc);
-                               parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
-                       }
-               }
-       },
-
-       getCompleteChars : function() {
-               var cChars = '';
-               for(var i=0;i<Language.complete.length;i++)
-                       cChars += '|'+Language.complete[i].input;
-               return cChars+'|';
-       },
-
-       shortcuts : function() {
-               var cCode = arguments[0];
-               if(cCode==13) cCode = '[enter]';
-               else if(cCode==32) cCode = '[space]';
-               else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
-               for(var i=0;i<Language.shortcuts.length;i++)
-                       if(Language.shortcuts[i].input == cCode)
-                               this.insertCode(Language.shortcuts[i].output,false);
-       },
-       
-       getRangeAndCaret : function() { 
-               var range = window.getSelection().getRangeAt(0);
-               var range2 = range.cloneRange();
-               var node = range.endContainer;                  
-               var caret = range.endOffset;
-               range2.selectNode(node);        
-               return [range2.toString(),caret];
-       },
-       
-       insertCode : function(code,replaceCursorBefore) {
-               var range = window.getSelection().getRangeAt(0);
-               var node = window.document.createTextNode(code);
-               var selct = window.getSelection();
-               var range2 = range.cloneRange();
-               // Insert text at cursor position
-               selct.removeAllRanges();
-               range.deleteContents();
-               range.insertNode(node);
-               // Move the cursor to the end of text
-               range2.selectNode(node);                
-               range2.collapse(replaceCursorBefore);
-               selct.removeAllRanges();
-               selct.addRange(range2);
-       },
-       
-       // get code from editor
-       getCode : function() {
-               var code = editor.innerHTML;
-               code = code.replace(/<br>/g,'\n');
-               code = code.replace(/\u2009/g,'');
-               code = code.replace(/<.*?>/g,'');
-               code = code.replace(/&lt;/g,'<');
-               code = code.replace(/&gt;/g,'>');
-               code = code.replace(/&amp;/gi,'&');
-               return code;
-       },
-
-       // put code inside editor
-       setCode : function() {
-               var code = arguments[0];
-               code = code.replace(/\u2009/gi,'');
-               code = code.replace(/&/gi,'&amp;');
-               code = code.replace(/</g,'&lt;');
-        code = code.replace(/>/g,'&gt;');
-               editor.innerHTML = code;
-       },
-
-       // undo and redo methods
-       actions : {
-               pos : -1, // actual history position
-               history : [], // history vector
-               
-               undo : function() {
-                       if(editor.innerHTML.indexOf(cc)==-1){
-                               window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
-                               this.history[this.pos] = editor.innerHTML;
-                       }
-                       this.pos--;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos++;
-                       editor.innerHTML = this.history[this.pos];
-                       CodePress.findString();
-               },
-               
-               redo : function() {
-                       this.pos++;
-                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
-                       editor.innerHTML = this.history[this.pos];
-                       CodePress.findString();
-               },
-               
-               next : function() { // get next vector position and clean old ones
-                       if(this.pos>20) this.history[this.pos-21] = undefined;
-                       return ++this.pos;
-               }
-       }
-}
-
-Language={};
-window.addEventListener('load', function() { CodePress.initialize('new'); }, true);
diff --git a/wp-includes/js/codepress/images/line-numbers.png b/wp-includes/js/codepress/images/line-numbers.png
deleted file mode 100644 (file)
index ffea4e6..0000000
Binary files a/wp-includes/js/codepress/images/line-numbers.png and /dev/null differ
diff --git a/wp-includes/js/codepress/languages/asp.css b/wp-includes/js/codepress/languages/asp.css
deleted file mode 100644 (file)
index 9a4c505..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CodePress color styles for ASP-VB syntax highlighting
- * By Martin D. Kirk
- */
-/* tags */
-
-b {
-       color:#000080;
-} 
-/* comments */
-big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
-       color:gray;
-       font-weight:normal;
-}
-/* ASP comments */
-strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
-       color:gray;
-       font-weight:normal;
-}
- /* attributes */ 
-s, s b, span s u, span s cite, strong span s {
-       color:#5656fa ;
-       font-weight:normal;
-}
- /* strings */ 
-strong s,strong s b, strong s u, strong s cite {
-       color:#009900;
-       font-weight:normal;
-}
-strong ins{
-       color:#000000;
-       font-weight:bold;
-}
- /* Syntax */
-strong a, strong a u {
-       color:#0000FF;
-       font-weight:;
-}
- /* Native Keywords */
-strong u {
-       color:#990099;
-       font-weight:bold;
-}
-/* Numbers */
-strong var{
-       color:#FF0000;
-}
-/* ASP Language */
-span{
-       color:#990000;
-       font-weight:bold;
-}
-strong i,strong a i, strong u i {
-       color:#009999;
-}
-/* style */
-em {
-       color:#800080;
-       font-style:normal;
-}
- /* script */ 
-ins {
-       color:#800000;
-       font-weight:bold;
-}
-
-/* <?php and ?> */
-cite, s cite {
-       color:red;
-       font-weight:bold;
-}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/asp.js b/wp-includes/js/codepress/languages/asp.js
deleted file mode 100644 (file)
index 21e78dd..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CodePress regular expressions for ASP-vbscript syntax highlighting
- */
-
-// ASP VBScript
-Language.syntax = [
-// all tags
-       { input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
-// style tags  
-       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
-// script tags 
-       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
-// strings "" and attributes
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
-// ASP Comment
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
-// <%.*
-       { input : /(&lt;%)/g, output : '<strong>$1' }, 
-// .*%>        
-       { input : /(%&gt;)/g, output : '$1</strong>' }, 
-// <%@...%>    
-       { input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
-//Numbers      
-       { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
-// Reserved Words 1 (Blue)
-       { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
-       { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
-       { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
-// Reserved Words 2 (Purple)   
-       { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
-       { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
-// Reserved Words 3 (Turquis)
-       { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
-// html comments
-       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
-]
-
-Language.Functions = [ 
-       // Output at index 0, must be the desired tagname surrounding a $1
-       // Name is the index from the regex that marks the functionname
-       {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
-]
-
-Language.snippets = [
-//Conditional
-       { input : 'if', output : 'If $0 Then\n\t\nEnd If' },
-       { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
-       { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
-//Response
-       { input : 'rw', output : 'Response.Write( $0 )' },
-       { input : 'resc', output : 'Response.Cookies( $0 )' },
-       { input : 'resb', output : 'Response.Buffer'},
-       { input : 'resflu', output : 'Response.Flush()'},
-       { input : 'resend', output : 'Response.End'},
-//Request
-       { input : 'reqc', output : 'Request.Cookies( $0 )' },
-       { input : 'rq', output : 'Request.Querystring("$0")' },
-       { input : 'rf', output : 'Request.Form("$0")' },
-//FSO
-       { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
-       { input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
-       { input : 'setfi', output : 'Set fi = fso.getFile($0)' },
-       { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
-       { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
-//Server
-       { input : 'mapp', output : 'Server.Mappath($0)' },
-//Loops
-       { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
-       { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
-       { input : 'do', output : 'Do While($0)\n\t\nLoop' },
-       { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
-//ADO
-       { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
-       { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
-       { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
-//Http Request
-       { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
-       { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
-//Functions
-       { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
-       { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
-
-]
-
-Language.complete = [
-       //{ input : '\'', output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = [
-       { input : '[space]', output : '&nbsp;' },
-       { input : '[enter]', output : '<br />' } ,
-       { input : '[j]', output : 'testing' },
-       { input : '[7]', output : '&amp;' }
-]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/autoit.css b/wp-includes/js/codepress/languages/autoit.css
deleted file mode 100644 (file)
index eb2b43b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * CodePress color styles for AutoIt syntax highlighting
- */
-
-u {font-style:normal;color:#000090;font-weight:bold;font-family:Monospace;}
-var {color:#AA0000;font-weight:bold;font-style:normal;}
-em {color:#FF33FF;}
-ins {color:#AC00A9;}
-i {color:#F000FF;}
-b {color:#FF0000;}
-a {color:#0080FF;font-weight:bold;}
-s, s u, s b {color:#9999CC;font-weight:normal;}
-cite, cite *{color:#009933;font-weight:normal;}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/autoit.js b/wp-includes/js/codepress/languages/autoit.js
deleted file mode 100644 (file)
index 6f5c19d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * CodePress regular expressions for AutoIt syntax highlighting
- * @author: James Brooks, Michael HURNI
- */ 
-// AutoIt 
-Language.syntax = [  
-    { input : /({|}|\(|\))/g, output : '<b>$1</b>' }, // Brackets
-       { input : /(\*|\+|-)/g, output : '<b>$1</b>' }, // Operator
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : "<s>\"$1$2</s>" }, // strings double 
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single  
-       { input : /\b([\d]+)\b/g, output : '<ins>$1</ins>' }, // Numbers 
-       { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' }, // Directives and Includes 
-       { input : /(\$[\w\.]*)/g, output : '<var>$1</var>' }, // vars
-       { input : /(_[\w\.]*)/g, output : '<a>$1</a>' }, // underscored word
-       { input : /(\@[\w\.]*)/g, output : '<em>$1</em>' }, // Macros
-       { input : /\b(Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitSHIFT|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCall|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|FileCopy|FileCreateNTFS|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GuiCreate|GuiCtrlCreateAvi|GuiCtrlCreateButton|GuiCtrlCreateCheckbox|GuiCtrlCreateCombo|GuiCtrlCreateContextMenu|GuiCtrlCreateDate|GuiCtrlCreateDummy|GuiCtrlCreateEdit|GuiCtrlCreateGraphic|GuiCtrlCreateGroup|GuiCtrlCreateIcon|GuiCtrlCreateInput|GuiCtrlCreateLabel|GuiCtrlCreateList|GuiCtrlCreateListView|GuiCtrlCreateListViewItem|GuiCtrlCreateMenu|GuiCtrlCreateMenuItem|GuiCtrlCreateMonthCal|GuiCtrlCreateObj|GuiCtrlCreatePic|GuiCtrlCreateProgress|GuiCtrlCreateRadio|GuiCtrlCreateSlider|GuiCtrlCreateTab|GuiCtrlCreateTabItem|GuiCtrlCreateUpdown|GuiCtrlDelete|GuiCtrlGetHandle|GuiCtrlGetState|GuiCtrlRead|GuiCtrlRecvMsg|GuiCtrlSentMsg|GuiCtrlSendToDummy|GuiCtrlSetBkColor|GuiCtrlSetColor|GuiCtrlSetCursor|GuiCtrlSetData|GuiCtrlSetFont|GuiCtrlSetGraphic|GuiCtrlSetImage|GuiCtrlSetLimit|GuiCtrlSetOnEvent|GuiCtrlSetPos|GuiCtrlResizing|GuiCtrlSetState|GuiCtrlSetTip|GuiDelete|GuiGetCursorInfo|GuiGetMsg|GuiGetStyle|GuiRegisterMsg|GuiSetBkColor|GuiSetCoord|GuiSetCursor|GuiSetFont|GuiSetHelp|GuiSetIcon|GuiSetOnEvent|GuiSetStat|GuiSetStyle|GuiStartGroup|GuiSwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Ping|PixelCheckSum|PixelGetColor|PixelSearch|ProcessClose|ProcessExists|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProcessOn|ProgressSet|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAsSet|RunWait|Send|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCPAccept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPrecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/g, output : '<u>$1</u>' } ,// reserved words
-       { input : /\B;(.*?)(<br>|<\/P>)/g, output : '<cite>;$1</cite>$2' }, // comments 
-       { input : /#CS(.*?)#CE/g, output : '<cite>#CS$1#CE</cite>' } // Block Comments
-] 
-Language.snippets = [] 
-Language.complete = [ 
-{ input : '\'',output : '\'$0\'' }, 
-{ input : '"', output : '"$0"' }, 
-{ input : '(', output : '\($0\)' }, 
-{ input : '[', output : '\[$0\]' }, 
-{ input : '{', output : '{\n\t$0\n}' } 
-] 
-Language.shortcuts = [] 
diff --git a/wp-includes/js/codepress/languages/csharp.css b/wp-includes/js/codepress/languages/csharp.css
deleted file mode 100644 (file)
index 8464c5d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * CodePress color styles for Java syntax highlighting
- * By Edwin de Jonge
- */
-
-b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
-a {color:#2A0088;font-weight:bold;font-style:normal;} /* types */
-i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
-s, s b {color:#2A00FF;font-weight:normal;} /* strings */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/csharp.js b/wp-includes/js/codepress/languages/csharp.js
deleted file mode 100644 (file)
index 0a61fd5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * CodePress regular expressions for C# syntax highlighting
- * By Edwin de Jonge
- */
-Language.syntax = [ // C#
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
-       { input : /\'(.?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote 
-       { input : /\b(abstract|as|base|break|case|catch|checked|continue|default|delegate|do|else|event|explicit|extern|false|finally|fixed|for|foreach|get|goto|if|implicit|in|interface|internal|is|lock|namespace|new|null|object|operator|out|override|params|partial|private|protected|public|readonly|ref|return|set|sealed|sizeof|static|stackalloc|switch|this|throw|true|try|typeof|unchecked|unsafe|using|value|virtual|while)\b/g, output : '<b>$1</b>' }, // reserved words
-       { input : /\b(bool|byte|char|class|double|float|int|interface|long|string|struct|void)\b/g, output : '<a>$1</a>' }, // types
-       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //  
-       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
-];
-
-Language.snippets = [];
-
-Language.complete = [ // Auto complete only for 1 character
-       {input : '\'',output : '\'$0\'' },
-       {input : '"', output : '"$0"' },
-       {input : '(', output : '\($0\)' },
-       {input : '[', output : '\[$0\]' },
-       {input : '{', output : '{\n\t$0\n}' }           
-];
-
-Language.shortcuts = [];
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/css.css b/wp-includes/js/codepress/languages/css.css
deleted file mode 100644 (file)
index 49ba584..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * CodePress color styles for CSS syntax highlighting
- */
-
-b, b a, b u {color:#000080;} /* tags, ids, classes */
-i, i b, i s, i a, i u {color:gray;} /* comments */
-s, s b {color:#a0a0dd;} /* parameters */
-a {color:#0000ff;} /* keys */
-u {color:red;} /* values */
-
diff --git a/wp-includes/js/codepress/languages/css.js b/wp-includes/js/codepress/languages/css.js
deleted file mode 100644 (file)
index c29059b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * CodePress regular expressions for CSS syntax highlighting
- */
-
-// CSS
-Language.syntax = [
-       { input : /(.*?){(.*?)}/g,output : '<b>$1</b>{<u>$2</u>}' }, // tags, ids, classes, values
-       { input : /([\w-]*?):([^\/])/g,output : '<a>$1</a>:$2' }, // keys
-       { input : /\((.*?)\)/g,output : '(<s>$1</s>)' }, // parameters
-       { input : /\/\*(.*?)\*\//g,output : '<i>/*$1*/</i>'} // comments
-]
-
-Language.snippets = []
-
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/generic.css b/wp-includes/js/codepress/languages/generic.css
deleted file mode 100644 (file)
index 712942f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * CodePress color styles for generic syntax highlighting
- */
-
-b {color:#7F0055;font-weight:bold;} /* reserved words */
-u {color:darkblue;font-weight:bold;} /* special words */
-i, i b, i s, i u, i em {color:green;font-weight:normal;} /* comments */
-s, s b, s em {color:#2A00FF;font-weight:normal;} /* strings */
-em {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/generic.js b/wp-includes/js/codepress/languages/generic.js
deleted file mode 100644 (file)
index 4c866de..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * CodePress regular expressions for generic syntax highlighting
- */
-// generic languages
-Language.syntax = [
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
-       { input : /\b(abstract|continue|for|new|switch|default|goto|boolean|do|if|private|this|break|double|protected|throw|byte|else|import|public|throws|case|return|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|const|float|while|function|label)\b/g, output : '<b>$1</b>' }, // reserved words
-       { input : /([\(\){}])/g, output : '<em>$1</em>' }, // special chars;
-       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
-       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
-]
-
-Language.snippets = []
-
-Language.complete = [
-       { input : '\'', output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/html.css b/wp-includes/js/codepress/languages/html.css
deleted file mode 100644 (file)
index 14882e5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * CodePress color styles for HTML syntax highlighting
- */
-
-b {color:#000080;} /* tags */
-ins, ins b, ins s, ins em {color:gray;} /* comments */
-s, s b {color:#7777e4;} /* attribute values */
-a {color:green;} /* links */
-u {color:#E67300;} /* forms */
-big {color:#db0000;} /* images */
-em, em b {color:#800080;} /* style */
-strong {color:#800000;} /* script */
-tt i {color:darkblue;font-weight:bold;} /* script reserved words */
diff --git a/wp-includes/js/codepress/languages/html.js b/wp-includes/js/codepress/languages/html.js
deleted file mode 100644 (file)
index 4ead0b0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CodePress regular expressions for HTML syntax highlighting
- */
-
-// HTML
-Language.syntax = [
-       { input : /(&lt;[^!]*?&gt;)/g, output : '<b>$1</b>'     }, // all tags
-       { input : /(&lt;a .*?&gt;|&lt;\/a&gt;)/g, output : '<a>$1</a>' }, // links
-       { input : /(&lt;img .*?&gt;)/g, output : '<big>$1</big>' }, // images
-       { input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g, output : '<u>$1</u>' }, // forms
-       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
-       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' }, // script tags
-       { input : /=(".*?")/g, output : '=<s>$1</s>' }, // atributes double quote
-       { input : /=('.*?')/g, output : '=<s>$1</s>' }, // atributes single quote
-       { input : /(&lt;!--.*?--&gt.)/g, output : '<ins>$1</ins>' }, // comments 
-       { input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<i>$1</i>' } // script reserved words 
-]
-
-Language.snippets = [
-       { input : 'aref', output : '<a href="$0"></a>' },
-       { input : 'h1', output : '<h1>$0</h1>' },
-       { input : 'h2', output : '<h2>$0</h2>' },
-       { input : 'h3', output : '<h3>$0</h3>' },
-       { input : 'h4', output : '<h4>$0</h4>' },
-       { input : 'h5', output : '<h5>$0</h5>' },
-       { input : 'h6', output : '<h6>$0</h6>' },
-       { input : 'html', output : '<html>\n\t$0\n</html>' },
-       { input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
-       { input : 'img', output : '<img src="$0" alt="" />' },
-       { input : 'input', output : '<input name="$0" id="" type="" value="" />' },
-       { input : 'label', output : '<label for="$0"></label>' },
-       { input : 'legend', output : '<legend>\n\t$0\n</legend>' },
-       { input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },              
-       { input : 'base', output : '<base href="$0" />' }, 
-       { input : 'body', output : '<body>\n\t$0\n</body>' }, 
-       { input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
-       { input : 'div', output : '<div>\n\t$0\n</div>' },
-       { input : 'divid', output : '<div id="$0">\n\t\n</div>' },
-       { input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
-       { input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
-       { input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
-       { input : 'meta', output : '<meta name="$0" content="" />' },
-       { input : 'p', output : '<p>$0</p>' },
-       { input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
-       { input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
-       { input : 'span', output : '<span>$0</span>' },
-       { input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
-       { input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' }
-]
-       
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/java.css b/wp-includes/js/codepress/languages/java.css
deleted file mode 100644 (file)
index b9c4441..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * CodePress color styles for Java syntax highlighting
- */
-
-b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
-i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
-s, s b {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/java.js b/wp-includes/js/codepress/languages/java.js
deleted file mode 100644 (file)
index f0d620d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * CodePress regular expressions for Java syntax highlighting
- */
-// Java
-Language.syntax = [
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>'}, // strings double quote
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
-       { input : /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g, output : '<b>$1</b>'}, // reserved words
-       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3'}, // comments //   
-       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }// comments /* */
-]
-
-Language.snippets = []
-
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/javascript.css b/wp-includes/js/codepress/languages/javascript.css
deleted file mode 100644 (file)
index acbf49a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * CodePress color styles for JavaScript syntax highlighting
- */
-
-b {color:#7F0055;font-weight:bold;} /* reserved words */
-u {color:darkblue;font-weight:bold;} /* special words */
-i, i b, i s, i u {color:green;font-weight:normal;} /* comments */
-s, s b, s u {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/javascript.js b/wp-includes/js/codepress/languages/javascript.js
deleted file mode 100644 (file)
index 66d0fc0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * CodePress regular expressions for JavaScript syntax highlighting
- */
-// JavaScript
-Language.syntax = [ 
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
-       { input : /\b(break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<b>$1</b>' }, // reserved words
-       { input : /\b(alert|isNaN|parent|Array|parseFloat|parseInt|blur|clearTimeout|prompt|prototype|close|confirm|length|Date|location|Math|document|element|name|self|elements|setTimeout|navigator|status|String|escape|Number|submit|eval|Object|event|onblur|focus|onerror|onfocus|onclick|top|onload|toString|onunload|unescape|open|valueOf|window|onmouseover)\b/g, output : '<u>$1</u>' }, // special words
-       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
-       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
-]
-
-Language.snippets = [
-       { input : 'dw', output : 'document.write(\'$0\');' },
-       { input : 'getid', output : 'document.getElementById(\'$0\')' },
-       { input : 'fun', output : 'function $0(){\n\t\n}' },
-       { input : 'func', output : 'function $0(){\n\t\n}' }
-]
-
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/perl.css b/wp-includes/js/codepress/languages/perl.css
deleted file mode 100644 (file)
index c2d6d56..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * CodePress color styles for Perl syntax highlighting
- * By J. Nick Koston
- */
-
-b {color:#7F0055;font-weight:bold;} /* reserved words */
-i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
-s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
-a {color:#006700;font-weight:bold;} /* variables */
-em {color:darkblue;font-weight:bold;} /* functions */
-u {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/perl.js b/wp-includes/js/codepress/languages/perl.js
deleted file mode 100644 (file)
index 06c380d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * CodePress regular expressions for Perl syntax highlighting
- * By J. Nick Koston
- */
-
-// Perl
-Language.syntax = [ 
-       { input  : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
-       { input  : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
-       { input  : /([\$\@\%][\w\.]*)/g, output : '<a>$1</a>' }, // vars
-       { input  : /(sub\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
-       { input  : /\b(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|else|elsif|endgrent|endhostent|endnetent|endprotoent|endpwent|eof|eval|exec|exists|exit|fcntl|fileno|find|flock|for|foreach|fork|format|formlinegetc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyaddr|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|hostname|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|LoadExternals|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ordpack|package|pipe|pop|pos|print|printf|push|pwd|qq|quotemeta|qw|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|stty|study|sub|substr|symlink|syscall|sysopen|sysread|system|syswritetell|telldir|tie|tied|time|times|tr|truncate|uc|ucfirst|umask|undef|unless|unlink|until|unpack|unshift|untie|use|utime|values|vec|waitpid|wantarray|warn|while|write)\b/g, output : '<b>$1</b>' }, // reserved words
-       { input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
-       { input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
-]
-
-Language.snippets = []
-
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/php.css b/wp-includes/js/codepress/languages/php.css
deleted file mode 100644 (file)
index 23fca5c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * CodePress color styles for PHP syntax highlighting
- */
-
-b {color:#000080;} /* tags */
-big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {color:gray;font-weight:normal;} /* comments */
-s, s b, strong s u, strong s cite {color:#5656fa;font-weight:normal;} /* attributes and strings */
-strong a, strong a u {color:#006700;font-weight:bold;} /* variables */
-em {color:#800080;font-style:normal;} /* style */
-ins {color:#800000;} /* script */
-strong u {color:#7F0055;font-weight:bold;} /* reserved words */
-cite, s cite {color:red;font-weight:bold;} /* <?php and ?> */
diff --git a/wp-includes/js/codepress/languages/php.js b/wp-includes/js/codepress/languages/php.js
deleted file mode 100644 (file)
index 1689fba..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CodePress regular expressions for PHP syntax highlighting
- */
-
-// PHP
-Language.syntax = [
-       { input : /(&lt;[^!\?]*?&gt;)/g, output : '<b>$1</b>' }, // all tags
-       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
-       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, // script tags
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
-       { input : /(&lt;\?)/g, output : '<strong>$1' }, // <?.*
-       { input : /(\?&gt;)/g, output : '$1</strong>' }, // .*?>
-       { input : /(&lt;\?php|&lt;\?=|&lt;\?|\?&gt;)/g, output : '<cite>$1</cite>' }, // php tags
-       { input : /(\$[\w\.]*)/g, output : '<a>$1</a>' }, // vars
-       { input : /\b(false|true|and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|for|foreach|function|global|if|include|include_once|isset|list|new|print|require|require_once|return|static|switch|unset|use|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interface|implements|extends|public|private|protected|abstract|clone|try|catch|throw|this)\b/g, output : '<u>$1</u>' }, // reserved words
-       { input : /([^:])\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // php comments //
-       { input : /([^:])#(.*?)(<br|<\/P)/g, output : '$1<i>#$2</i>$3' }, // php comments #
-       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }, // php comments /* */
-       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } // html comments
-]
-
-Language.snippets = [
-       { input : 'if', output : 'if($0){\n\t\n}' },
-       { input : 'ifelse', output : 'if($0){\n\t\n}\nelse{\n\t\n}' },
-       { input : 'else', output : '}\nelse {\n\t' },
-       { input : 'elseif', output : '}\nelseif($0) {\n\t' },
-       { input : 'do', output : 'do{\n\t$0\n}\nwhile();' },
-       { input : 'inc', output : 'include_once("$0");' },
-       { input : 'fun', output : 'function $0(){\n\t\n}' },    
-       { input : 'func', output : 'function $0(){\n\t\n}' },   
-       { input : 'while', output : 'while($0){\n\t\n}' },
-       { input : 'for', output : 'for($0,,){\n\t\n}' },
-       { input : 'fore', output : 'foreach($0 as ){\n\t\n}' },
-       { input : 'foreach', output : 'foreach($0 as ){\n\t\n}' },
-       { input : 'echo', output : 'echo \'$0\';' },
-       { input : 'switch', output : 'switch($0) {\n\tcase "": break;\n\tdefault: ;\n}' },
-       { input : 'case', output : 'case "$0" : break;' },
-       { input : 'ret0', output : 'return false;' },
-       { input : 'retf', output : 'return false;' },
-       { input : 'ret1', output : 'return true;' },
-       { input : 'rett', output : 'return true;' },
-       { input : 'ret', output : 'return $0;' },
-       { input : 'def', output : 'define(\'$0\',\'\');' },
-       { input : '<?', output : 'php\n$0\n?>' }
-]
-
-Language.complete = [
-       { input : '\'', output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = [
-       { input : '[space]', output : '&nbsp;' },
-       { input : '[enter]', output : '<br />' } ,
-       { input : '[j]', output : 'testing' },
-       { input : '[7]', output : '&amp;' }
-]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/ruby.css b/wp-includes/js/codepress/languages/ruby.css
deleted file mode 100644 (file)
index edb9028..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * CodePress color styles for Ruby syntax highlighting
- */
-
-b {color:#7F0055;font-weight:bold;} /* reserved words */
-i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
-s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
-a {color:#006700;font-weight:bold;} /* variables */
-em {color:darkblue;font-weight:bold;} /* functions */
-u {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/ruby.js b/wp-includes/js/codepress/languages/ruby.js
deleted file mode 100644 (file)
index 207f23b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * CodePress regular expressions for Perl syntax highlighting
- */
-
-// Ruby
-Language.syntax = [
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote 
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
-       { input : /([\$\@\%]+)([\w\.]*)/g, output : '<a>$1$2</a>' }, // vars
-       { input : /(def\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
-       { input : /\b(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/g, output : '<b>$1</b>' }, // reserved words
-       { input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
-       { input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
-];
-
-Language.snippets = []
-
-Language.complete = [
-       { input : '\'',output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/sql.css b/wp-includes/js/codepress/languages/sql.css
deleted file mode 100644 (file)
index 92c4b96..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * CodePress color styles for SQL syntax highlighting
- * By Merlin Moncure
- */
-b {color:#0000FF;font-style:normal;font-weight:bold;} /* reserved words */
-u {color:#FF0000;font-style:normal;} /* types */
-a {color:#CD6600;font-style:normal;font-weight:bold;} /* commands */
-i, i b, i u, i a, i s  {color:#A9A9A9;font-weight:normal;font-style:italic;} /* comments */
-s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/sql.js b/wp-includes/js/codepress/languages/sql.js
deleted file mode 100644 (file)
index 1d4a21f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * CodePress regular expressions for SQL syntax highlighting
- * By Merlin Moncure
- */
-// SQL
-Language.syntax = [
-       { input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote
-       { input : /\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|like|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/gi, output : '<b>$1</b>' }, // reserved words
-       { input : /\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/gi, output : '<u>$1</u>' }, // types
-       { input : /\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/gi, output : '<a>$1</a>' }, // commands
-       { input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments //    
-]
-
-Language.snippets = [
-       { input : 'select', output : 'select $0 from  where ' }
-]
-
-Language.complete = [
-       { input : '\'', output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = []
-
-
-
diff --git a/wp-includes/js/codepress/languages/text.css b/wp-includes/js/codepress/languages/text.css
deleted file mode 100644 (file)
index 474fe60..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * CodePress color styles for Text syntax highlighting
- */
-
-/* do nothing as expected */
diff --git a/wp-includes/js/codepress/languages/text.js b/wp-includes/js/codepress/languages/text.js
deleted file mode 100644 (file)
index 6534aaf..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * CodePress regular expressions for Text syntax highlighting
- */
-
-// plain text
-Language.syntax = []
-Language.snippets = []
-Language.complete = []
-Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/vbscript.css b/wp-includes/js/codepress/languages/vbscript.css
deleted file mode 100644 (file)
index e1465e9..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CodePress color styles for ASP-VB syntax highlighting 
- * By Martin D. Kirk
- */
-
-/* tags */
-b {
-       color:#000080;
-} 
-/* comments */
-big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
-       color:gray;
-       font-weight:normal;
-}
-/* ASP comments */
-strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
-       color:gray;
-       font-weight:normal;
-}
- /* attributes */ 
-s, s b, span s u, span s cite, strong span s {
-       color:#5656fa ;
-       font-weight:normal;
-}
- /* strings */ 
-strong s,strong s b, strong s u, strong s cite {
-       color:#009900;
-       font-weight:normal;
-}
-strong ins{
-       color:#000000;
-       font-weight:bold;
-}
- /* Syntax */
-strong a, strong a u {
-       color:#0000FF;
-       font-weight:;
-}
- /* Native Keywords */
-strong u {
-       color:#990099;
-       font-weight:bold;
-}
-/* Numbers */
-strong var{
-       color:#FF0000;
-}
-/* ASP Language */
-span{
-       color:#990000;
-       font-weight:bold;
-}
-strong i,strong a i, strong u i {
-       color:#009999;
-}
-/* style */
-em {
-       color:#800080;
-       font-style:normal;
-}
- /* script */ 
-ins {
-       color:#800000;
-       font-weight:bold;
-}
-
-/* <?php and ?> */
-cite, s cite {
-       color:red;
-       font-weight:bold;
-}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/vbscript.js b/wp-includes/js/codepress/languages/vbscript.js
deleted file mode 100644 (file)
index 21e78dd..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CodePress regular expressions for ASP-vbscript syntax highlighting
- */
-
-// ASP VBScript
-Language.syntax = [
-// all tags
-       { input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
-// style tags  
-       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
-// script tags 
-       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
-// strings "" and attributes
-       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
-// ASP Comment
-       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
-// <%.*
-       { input : /(&lt;%)/g, output : '<strong>$1' }, 
-// .*%>        
-       { input : /(%&gt;)/g, output : '$1</strong>' }, 
-// <%@...%>    
-       { input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
-//Numbers      
-       { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
-// Reserved Words 1 (Blue)
-       { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
-       { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
-       { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
-// Reserved Words 2 (Purple)   
-       { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
-       { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
-       { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
-// Reserved Words 3 (Turquis)
-       { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
-       { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
-// html comments
-       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
-]
-
-Language.Functions = [ 
-       // Output at index 0, must be the desired tagname surrounding a $1
-       // Name is the index from the regex that marks the functionname
-       {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
-]
-
-Language.snippets = [
-//Conditional
-       { input : 'if', output : 'If $0 Then\n\t\nEnd If' },
-       { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
-       { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
-//Response
-       { input : 'rw', output : 'Response.Write( $0 )' },
-       { input : 'resc', output : 'Response.Cookies( $0 )' },
-       { input : 'resb', output : 'Response.Buffer'},
-       { input : 'resflu', output : 'Response.Flush()'},
-       { input : 'resend', output : 'Response.End'},
-//Request
-       { input : 'reqc', output : 'Request.Cookies( $0 )' },
-       { input : 'rq', output : 'Request.Querystring("$0")' },
-       { input : 'rf', output : 'Request.Form("$0")' },
-//FSO
-       { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
-       { input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
-       { input : 'setfi', output : 'Set fi = fso.getFile($0)' },
-       { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
-       { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
-//Server
-       { input : 'mapp', output : 'Server.Mappath($0)' },
-//Loops
-       { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
-       { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
-       { input : 'do', output : 'Do While($0)\n\t\nLoop' },
-       { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
-//ADO
-       { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
-       { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
-       { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
-//Http Request
-       { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
-       { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
-//Functions
-       { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
-       { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
-
-]
-
-Language.complete = [
-       //{ input : '\'', output : '\'$0\'' },
-       { input : '"', output : '"$0"' },
-       { input : '(', output : '\($0\)' },
-       { input : '[', output : '\[$0\]' },
-       { input : '{', output : '{\n\t$0\n}' }          
-]
-
-Language.shortcuts = [
-       { input : '[space]', output : '&nbsp;' },
-       { input : '[enter]', output : '<br />' } ,
-       { input : '[j]', output : 'testing' },
-       { input : '[7]', output : '&amp;' }
-]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/xsl.css b/wp-includes/js/codepress/languages/xsl.css
deleted file mode 100644 (file)
index 385eaab..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * CodePress color styles for HTML syntax highlighting
- * By RJ Bruneel
- */
-b {color:#000080;} /* tags */
-ins, ins b, ins s, ins em {color:gray;} /* comments */
-s, s b {color:#7777e4;} /* attribute values */
-a {color:#E67300;} /* links */
-u {color:#CC66CC;} /* forms */
-big {color:#db0000;} /* images */
-em, em b {color:#800080;} /* style */
-strong {color:#800000;} /* script */
-tt i {color:darkblue;font-weight:bold;} /* script reserved words */
-xsl {color:green;} /* xsl */
diff --git a/wp-includes/js/codepress/languages/xsl.js b/wp-includes/js/codepress/languages/xsl.js
deleted file mode 100644 (file)
index e93932a..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * CodePress regular expressions for XSL syntax highlighting
- * By RJ Bruneel
- */
-
-Language.syntax = [ // XSL
-       {
-       input : /(&lt;[^!]*?&gt;)/g,
-       output : '<b>$1</b>' // all tags
-       },{
-       input : /(&lt;a.*?&gt;|&lt;\/a&gt;)/g,
-       output : '<a>$1</a>' // links
-       },{
-       input : /(&lt;img .*?&gt;)/g,
-       output : '<big>$1</big>' // images
-       },{
-       input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g,
-       output : '<u>$1</u>' // forms
-       },{
-       input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g,
-       output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags
-       },{
-       input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g,
-       output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags
-       },{     
-       input : /(&lt;xsl.*?&gt;|&lt;\/xsl.*?&gt;)/g,
-       output : '<xsl>$1</xsl>' // xsl
-       },{
-       input : /=(".*?")/g,
-       output : '=<s>$1</s>' // atributes double quote
-       },{
-       input : /=('.*?')/g,
-       output : '=<s>$1</s>' // atributes single quote
-       },{
-       input : /(&lt;!--.*?--&gt.)/g,
-       output : '<ins>$1</ins>' // comments 
-       },{
-       input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g,
-       output : '<i>$1</i>' // script reserved words
-       }
-];
-
-Language.snippets = [
-       {input : 'aref', output : '<a href="$0"></a>' },
-       {input : 'h1', output : '<h1>$0</h1>' },
-       {input : 'h2', output : '<h2>$0</h2>' },
-       {input : 'h3', output : '<h3>$0</h3>' },
-       {input : 'h4', output : '<h4>$0</h4>' },
-       {input : 'h5', output : '<h5>$0</h5>' },
-       {input : 'h6', output : '<h6>$0</h6>' },
-       {input : 'html', output : '<html>\n\t$0\n</html>' },
-       {input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
-       {input : 'img', output : '<img src="$0" width="" height="" alt="" border="0" />' },
-       {input : 'input', output : '<input name="$0" id="" type="" value="" />' },
-       {input : 'label', output : '<label for="$0"></label>' },
-       {input : 'legend', output : '<legend>\n\t$0\n</legend>' },
-       {input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },               
-       {input : 'base', output : '<base href="$0" />' }, 
-       {input : 'body', output : '<body>\n\t$0\n</body>' }, 
-       {input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
-       {input : 'div', output : '<div>\n\t$0\n</div>' },
-       {input : 'divid', output : '<div id="$0">\n\t\n</div>' },
-       {input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
-       {input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
-       {input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
-       {input : 'meta', output : '<meta name="$0" content="" />' },
-       {input : 'p', output : '<p>$0</p>' },
-       {input : 'b', output : '<b>$0</b>' },
-       {input : 'li', output : '<li>$0</li>' },
-       {input : 'ul', output : '<ul>$0</ul>' },
-       {input : 'ol', output : '<ol>$0</ol>' },
-       {input : 'strong', output : '<strong>$0</strong>' },
-       {input : 'br', output : '<br />' },
-       {input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
-       {input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
-       {input : 'span', output : '<span>$0</span>' },
-       {input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
-       {input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' },
-       {input : 'xsl:stylesheet', output : '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' },
-       {input : 'xsl:template', output : '<xsl:template>$0</xsl:template>' },
-       {input : 'xsl:for-each', output : '<xsl:for-each select="$0"></xsl:for-each>' },
-       {input : 'xsl:choose', output : '<xsl:choose>$0<\xsl:choose>' },
-       {input : 'xsl:param', output : '<xsl:param name="$0" />' },
-       {input : 'xsl:variable', output : '<xsl:variable name="$0"></xsl:variable>' },
-       {input : 'xsl:if', output : '<xsl:if test="$0"></xsl:if>' },
-       {input : 'xsl:when', output : '<xsl:when test="$0"></xsl:when>' },
-       {input : 'xsl:otherwise', output : '<xsl:otherwise>$0</xsl:otherwise>' },
-       {input : 'xsl:attribute', output : '<xsl:attribute name="$0"></xsl:attribute>' },
-       {input : 'xsl:value-of', output : '<xsl:value-of select="$0"/>' },
-       {input : 'xsl:with-param', output : '<xsl:with-param name="$0" select="" />' },
-       {input : 'xsl:call-template', output : '<xsl:call-template name="$0">' }
-
-];
-       
-Language.complete = [ // Auto complete only for 1 character
-       {input : '\'',output : '\'$0\'' },
-       {input : '"', output : '"$0"' },
-       {input : '(', output : '\($0\)' },
-       {input : '[', output : '\[$0\]' },
-       {input : '{', output : '{\n\t$0\n}' }           
-];
-
-Language.shortcuts = [];
\ No newline at end of file
diff --git a/wp-includes/js/codepress/license.txt b/wp-includes/js/codepress/license.txt
deleted file mode 100644 (file)
index e80ac68..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-                 GNU LESSER GENERAL PUBLIC LICENSE
-                      Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-                 GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                           NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
diff --git a/wp-includes/js/jquery/interface.js b/wp-includes/js/jquery/interface.js
deleted file mode 100644 (file)
index 6d00f2e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Interface Elements for jQuery
- * 
- * http://interface.eyecon.ro
- * 
- * Copyright (c) 2006 Stefan Petre
- * Dual licensed under the MIT (MIT-LICENSE.txt) 
- * and GPL (GPL-LICENSE.txt) licenses.
- *   
- *
- */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('A.cP={2l:C(c){G B.1y(C(){if(!c.8Y||!c.8P)G;F b=B;b.2a={9M:c.9M||bz,8Y:c.8Y,8P:c.8P,7R:c.7R||\'du\',9c:c.9c||\'du\',2K:c.2K&&28 c.2K==\'C\'?c.2K:H,2V:c.2K&&28 c.2V==\'C\'?c.2V:H,6D:c.6D&&28 c.6D==\'C\'?c.6D:H,8A:A(c.8Y,B),8a:A(c.8P,B),1l:c.1l||7n,5w:c.5w||0};b.2a.8a.2x().E(\'S\',\'9e\').eq(0).E({S:b.2a.9M+\'Q\',11:\'2v\'}).3m();b.2a.8A.1y(C(a){B.6L=a}).ht(C(){A(B).2H(b.2a.9c)},C(){A(B).3S(b.2a.9c)}).1C(\'4U\',C(e){if(b.2a.5w==B.6L)G;b.2a.8A.eq(b.2a.5w).3S(b.2a.7R).3m().eq(B.6L).2H(b.2a.7R).3m();b.2a.8a.eq(b.2a.5w).4S({S:0},b.2a.1l,C(){B.Y.11=\'1k\';if(b.2a.2V){b.2a.2V.1x(b,[B])}}).3m().eq(B.6L).1S().4S({S:b.2a.9M},b.2a.1l,C(){B.Y.11=\'2v\';if(b.2a.2K){b.2a.2K.1x(b,[B])}}).3m();if(b.2a.6D){b.2a.6D.1x(b,[B,b.2a.8a.I(B.6L),b.2a.8A.I(b.2a.5w),b.2a.8a.I(b.2a.5w)])}b.2a.5w=B.6L}).eq(0).2H(b.2a.7R).3m();A(B).E(\'S\',A(B).E(\'S\')).E(\'2N\',\'2B\')})}};A.fn.fe=A.cP.2l;A.8p={2l:C(h){G B.1y(C(){F c=B;F d=2*Z.2F/eD;F f=2*Z.2F;if(A(c).E(\'T\')!=\'2i\'&&A(c).E(\'T\')!=\'1J\'){A(c).E(\'T\',\'2i\')}c.1i={1M:A(h.1M,B),2y:h.2y,61:h.61,9l:h.9l,iu:f,1N:A.12.2f(B),T:A.12.3a(B),2b:Z.2F/2,b4:h.b4,7K:h.5U,5U:[],93:H,7G:2*Z.2F/eD};c.1i.d8=(c.1i.1N.w-c.1i.2y)/2;c.1i.6Y=(c.1i.1N.h-c.1i.61-c.1i.61*c.1i.7K)/2;c.1i.3f=2*Z.2F/c.1i.1M.1N();c.1i.aS=c.1i.1N.w/2;c.1i.aR=c.1i.1N.h/2-c.1i.61*c.1i.7K;F g=1c.3x(\'1W\');A(g).E({T:\'1J\',3j:1,O:0,M:0});A(c).1L(g);c.1i.1M.1y(C(a){8G=A(\'3O\',B).I(0);S=R(c.1i.61*c.1i.7K);if(A.2R.46){3u=1c.3x(\'3O\');A(3u).E(\'T\',\'1J\');3u.2E=8G.2E;3u.Y.4X=\'fu 9x:9C.9E.a6(1E=60, Y=1, fc=0, f9=0, f5=0, f3=0)\'}L{3u=1c.3x(\'3u\');if(3u.bZ){4j=3u.bZ("2d");3u.Y.T=\'1J\';3u.Y.S=S+\'Q\';3u.Y.V=c.1i.2y+\'Q\';3u.S=S;3u.V=c.1i.2y;4j.eR();4j.eM(0,S);4j.eJ(1,-1);4j.jm(8G,0,0,c.1i.2y,S);4j.bL();4j.jl="jh-3U";F b=4j.jf(0,0,0,S);b.es(1,"eg(1O, 1O, 1O, 1)");b.es(0,"eg(1O, 1O, 1O, 0.6)");4j.j9=b;if(j7.j5.3o(\'iX\')!=-1){4j.iV()}L{4j.iS(0,0,c.1i.2y,S)}}}c.1i.5U[a]=3u;A(g).1L(3u)}).1C(\'9r\',C(e){c.1i.93=14;c.1i.1l=c.1i.7G*0.1*c.1i.1l/Z.3B(c.1i.1l);G H}).1C(\'86\',C(e){c.1i.93=H;G H});A.8p.6z(c);c.1i.1l=c.1i.7G*0.2;c.1i.it=1P.5Y(C(){c.1i.2b+=c.1i.1l;if(c.1i.2b>f)c.1i.2b=0;A.8p.6z(c)},20);A(c).1C(\'86\',C(){c.1i.1l=c.1i.7G*0.2*c.1i.1l/Z.3B(c.1i.1l)}).1C(\'3t\',C(e){if(c.1i.93==H){1A=A.12.3W(e);dr=c.1i.1N.w-1A.x+c.1i.T.x;c.1i.1l=c.1i.b4*c.1i.7G*(c.1i.1N.w/2-dr)/(c.1i.1N.w/2)}})})},6z:C(b){b.1i.1M.1y(C(a){b8=b.1i.2b+a*b.1i.3f;x=b.1i.d8*Z.51(b8);y=b.1i.6Y*Z.7L(b8);do=R(1Y*(b.1i.6Y+y)/(2*b.1i.6Y));dm=(b.1i.6Y+y)/(2*b.1i.6Y);V=R((b.1i.2y-b.1i.9l)*dm+b.1i.9l);S=R(V*b.1i.61/b.1i.2y);B.Y.O=b.1i.aR+y-S/2+"Q";B.Y.M=b.1i.aS+x-V/2+"Q";B.Y.V=V+"Q";B.Y.S=S+"Q";B.Y.3j=do;b.1i.5U[a].Y.O=R(b.1i.aR+y+S-1-S/2)+"Q";b.1i.5U[a].Y.M=R(b.1i.aS+x-V/2)+"Q";b.1i.5U[a].Y.V=V+"Q";b.1i.5U[a].Y.S=R(S*b.1i.7K)+"Q"})}};A.fn.hL=A.8p.2l;A.1U({1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a},ho:C(p,n,a,b,c){G b*(n/=c)*n*n+a},d2:C(p,n,a,b,c){G-b*((n=n/c-1)*n*n*n-1)+a},hh:C(p,n,a,b,c){if((n/=c/2)<1)G b/2*n*n*n*n+a;G-b/2*((n-=2)*n*n*n-2)+a},7D:C(p,n,a,b,c){if((n/=c)<(1/2.75)){G b*(7.8W*n*n)+a}L if(n<(2/2.75)){G b*(7.8W*(n-=(1.5/2.75))*n+.75)+a}L if(n<(2.5/2.75)){G b*(7.8W*(n-=(2.25/2.75))*n+.gV)+a}L{G b*(7.8W*(n-=(2.gR/2.75))*n+.gN)+a}},aQ:C(p,n,a,b,c){if(A.1e.7D)G b-A.1e.7D(p,c-n,0,b,c)+a;G a+b},gE:C(p,n,a,b,c){if(A.1e.aQ&&A.1e.7D)if(n<c/2)G A.1e.aQ(p,n*2,0,b,c)*.5+a;G A.1e.7D(p,n*2-c,0,b,c)*.5+b*.5+a;G a+b},gz:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d)==1)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G-(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b},gg:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G a*Z.5j(2,-10*n)*Z.7L((n*d-s)*(2*Z.2F)/p)+c+b},gd:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}if(n<1){G-.5*(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b}G a*Z.5j(2,-10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p)*.5+c+b}}});A.5K={2l:C(h){G B.1y(C(){F g=B;g.1z={1M:A(h.1M,B),2q:A(h.2q,B),1I:A.12.3a(B),2y:h.2y,8K:h.8K,6q:h.6q,cG:h.cG,4I:h.4I,5R:h.5R};A.5K.8F(g,0);A(1P).1C(\'fR\',C(){g.1z.1I=A.12.3a(g);A.5K.8F(g,0);A.5K.6z(g)});A.5K.6z(g);g.1z.1M.1C(\'9r\',C(){A(g.1z.8K,B).I(0).Y.11=\'2v\'}).1C(\'86\',C(){A(g.1z.8K,B).I(0).Y.11=\'1k\'});A(1c).1C(\'3t\',C(e){F b=A.12.3W(e);F c=0;if(g.1z.4I&&g.1z.4I==\'az\')F d=b.x-g.1z.1I.x-(g.3P-g.1z.2y*g.1z.1M.1N())/2-g.1z.2y/2;L if(g.1z.4I&&g.1z.4I==\'2D\')F d=b.x-g.1z.1I.x-g.3P+g.1z.2y*g.1z.1M.1N();L F d=b.x-g.1z.1I.x;F f=Z.5j(b.y-g.1z.1I.y-g.5r/2,2);g.1z.1M.1y(C(a){3J=Z.cB(Z.5j(d-a*g.1z.2y,2)+f);3J-=g.1z.2y/2;3J=3J<0?0:3J;3J=3J>g.1z.6q?g.1z.6q:3J;3J=g.1z.6q-3J;bc=g.1z.5R*3J/g.1z.6q;B.Y.V=g.1z.2y+bc+\'Q\';B.Y.M=g.1z.2y*a+c+\'Q\';c+=bc});A.5K.8F(g,c)})})},8F:C(a,b){if(a.1z.4I)if(a.1z.4I==\'az\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())/2-b/2+\'Q\';L if(a.1z.4I==\'M\')a.1z.2q.I(0).Y.M=-b/a.1z.1M.1N()+\'Q\';L if(a.1z.4I==\'2D\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())-b/2+\'Q\';a.1z.2q.I(0).Y.V=a.1z.2y*a.1z.1M.1N()+b+\'Q\'},6z:C(b){b.1z.1M.1y(C(a){B.Y.V=b.1z.2y+\'Q\';B.Y.M=b.1z.2y*a+\'Q\'})}};A.fn.fz=A.5K.2l;A.K={18:P,7W:P,3q:P,2A:P,4b:P,af:P,2r:P,2h:P,1M:P,58:C(){A.K.7W.58();if(A.K.3q){A.K.3q.2x()}},4i:C(){A.K.1M=P;A.K.2h=P;A.K.4b=A.K.2r.2m;if(A.K.18.E(\'11\')==\'2v\'){if(A.K.2r.1a.fx){2X(A.K.2r.1a.fx.1K){19\'a4\':A.K.18.6d(A.K.2r.1a.fx.1H,A.K.58);1n;19\'1u\':A.K.18.c6(A.K.2r.1a.fx.1H,A.K.58);1n;19\'8o\':A.K.18.c3(A.K.2r.1a.fx.1H,A.K.58);1n}}L{A.K.18.2x()}if(A.K.2r.1a.2V)A.K.2r.1a.2V.1x(A.K.2r,[A.K.18,A.K.3q])}L{A.K.58()}1P.a2(A.K.2A)},c1:C(){F e=A.K.2r;F f=A.K.8C(e);if(e&&f.3w!=A.K.4b&&f.3w.1b>=e.1a.8N){A.K.4b=f.3w;A.K.af=f.3w;9V={bR:A(e).1m(\'eS\')||\'bR\',2m:f.3w};A.eQ({1K:\'eN\',9V:A.eL(9V),eK:C(b){e.1a.3X=A(\'3w\',b);1N=e.1a.3X.1N();if(1N>0){F c=\'\';e.1a.3X.1y(C(a){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'});if(e.1a.9K){F d=A(\'2m\',e.1a.3X.I(0)).3D();e.2m=f.30+d+e.1a.3y+f.5m;A.K.64(e,f.3w.1b!=d.1b?(f.30.1b+f.3w.1b):d.1b,f.3w.1b!=d.1b?(f.30.1b+d.1b):d.1b)}if(1N>0){A.K.aU(e,c)}L{A.K.4i()}}L{A.K.4i()}},5v:e.1a.96})}},aU:C(a,b){A.K.7W.3i(b);A.K.1M=A(\'7b\',A.K.7W.I(0));A.K.1M.9r(A.K.en).1C(\'4U\',A.K.ed);F c=A.12.3a(a);F d=A.12.2f(a);A.K.18.E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').2H(a.1a.9D);if(A.K.3q){A.K.3q.E(\'11\',\'2v\').E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').E(\'V\',A.K.18.E(\'V\')).E(\'S\',A.K.18.E(\'S\'))}A.K.2h=0;A.K.1M.I(0).2Z=a.1a.72;A.K.7I(a,a.1a.3X.I(0),\'6H\');if(A.K.18.E(\'11\')==\'1k\'){if(a.1a.bv){F e=A.12.9y(a,14);F f=A.12.6b(a,14);A.K.18.E(\'V\',a.3P-(A.e0?(e.l+e.r+f.l+f.r):0)+\'Q\')}if(a.1a.fx){2X(a.1a.fx.1K){19\'a4\':A.K.18.6U(a.1a.fx.1H);1n;19\'1u\':A.K.18.dR(a.1a.fx.1H);1n;19\'8o\':A.K.18.dP(a.1a.fx.1H);1n}}L{A.K.18.1S()}if(A.K.2r.1a.2K)A.K.2r.1a.2K.1x(A.K.2r,[A.K.18,A.K.3q])}},dM:C(){F b=B;if(b.1a.3X){A.K.4b=b.2m;A.K.af=b.2m;F c=\'\';b.1a.3X.1y(C(a){2m=A(\'2m\',B).3D().5u();dH=b.2m.5u();if(2m.3o(dH)==0){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'}});if(c!=\'\'){A.K.aU(b,c);B.1a.9s=14;G}}b.1a.3X=P;B.1a.9s=H},64:C(a,b,c){if(a.9q){F d=a.9q();d.iJ(14);d.dC("bh",b);d.iE("bh",-c+b);d.7Q()}L if(a.9m){a.9m(b,c)}L{if(a.88){a.88=b;a.dA=c}}a.6a()},dw:C(a){if(a.88)G a.88;L if(a.9q){F b=1c.64.dv();F c=b.il();G 0-c.dC(\'bh\',-ij)}},8C:C(a){F b={2m:a.2m,30:\'\',5m:\'\',3w:\'\'};if(a.1a.9k){F c=H;F d=A.K.dw(a)||0;F e=b.2m.6W(a.1a.3y);1V(F i=0;i<e.1b;i++){if((b.30.1b+e[i].1b>=d||d==0)&&!c){if(b.30.1b<=d)b.3w=e[i];L b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\');c=14}L if(c){b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\')}if(!c){b.30+=e[i]+(e.1b>1?a.1a.3y:\'\')}}}L{b.3w=b.2m}G b},b9:C(e){1P.a2(A.K.2A);F a=A.K.8C(B);F b=e.6S||e.6R||-1;if(/13|27|35|36|38|40|9/.3M(b)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';L A.K.2h=-1;2X(b){19 9:19 13:if(A.K.2h==-1)A.K.2h=0;F c=A.K.1M.I(A.K.2h||0);F d=c.4Z(\'4o\');B.2m=a.30+d+B.1a.3y+a.5m;A.K.4b=a.3w;A.K.64(B,a.30.1b+d.1b+B.1a.3y.1b,a.30.1b+d.1b+B.1a.3y.1b);A.K.4i();if(B.1a.5p){4E=R(c.4Z(\'8h\'))||0;A.K.7I(B,B.1a.3X.I(4E),\'5p\')}if(B.6O)B.6O(H);G b!=13;1n;19 27:B.2m=a.30+A.K.4b+B.1a.3y+a.5m;B.1a.3X=P;A.K.4i();if(B.6O)B.6O(H);G H;1n;19 35:A.K.2h=A.K.1M.1N()-1;1n;19 36:A.K.2h=0;1n;19 38:A.K.2h--;if(A.K.2h<0)A.K.2h=A.K.1M.1N()-1;1n;19 40:A.K.2h++;if(A.K.2h==A.K.1M.1N())A.K.2h=0;1n}A.K.7I(B,B.1a.3X.I(A.K.2h||0),\'6H\');A.K.1M.I(A.K.2h||0).2Z=B.1a.72;if(A.K.1M.I(A.K.2h||0).6O)A.K.1M.I(A.K.2h||0).6O(H);if(B.1a.9K){F f=A.K.1M.I(A.K.2h||0).4Z(\'4o\');B.2m=a.30+f+B.1a.3y+a.5m;if(A.K.4b.1b!=f.1b)A.K.64(B,a.30.1b+A.K.4b.1b,a.30.1b+f.1b)}G H}A.K.dM.1x(B);if(B.1a.9s==H){if(a.3w!=A.K.4b&&a.3w.1b>=B.1a.8N)A.K.2A=1P.97(A.K.c1,B.1a.4w);if(A.K.1M){A.K.4i()}}G 14},7I:C(a,b,c){if(a.1a[c]){F d={};94=b.dj(\'*\');1V(i=0;i<94.1b;i++){d[94[i].4D]=94[i].6M.hG}a.1a[c].1x(a,[d])}},en:C(e){if(A.K.1M){if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.2h=R(B.4Z(\'8h\'))||0;A.K.1M.I(A.K.2h||0).2Z=A.K.2r.1a.72}},ed:C(a){1P.a2(A.K.2A);a=a||A.3N.hD(1P.3N);a.9b();a.99();F b=A.K.8C(A.K.2r);F c=B.4Z(\'4o\');A.K.2r.2m=b.30+c+A.K.2r.1a.3y+b.5m;A.K.4b=B.4Z(\'4o\');A.K.64(A.K.2r,b.30.1b+c.1b+A.K.2r.1a.3y.1b,b.30.1b+c.1b+A.K.2r.1a.3y.1b);A.K.4i();if(A.K.2r.1a.5p){4E=R(B.4Z(\'8h\'))||0;A.K.7I(A.K.2r,A.K.2r.1a.3X.I(4E),\'5p\')}G H},dh:C(e){6K=e.6S||e.6R||-1;if(/13|27|35|36|38|40/.3M(6K)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}G H}},2l:C(a){if(!a.96||!A.12){G}if(!A.K.18){if(A.2R.46){A(\'23\',1c).1L(\'<3q Y="11:1k;T:1J;4X:9x:9C.9E.a6(1E=0);" id="df" 2E="dc:H;" da="0" d7="b0"></3q>\');A.K.3q=A(\'#df\')}A(\'23\',1c).1L(\'<1W id="d4" Y="T: 1J; O: 0; M: 0; z-aY: hj; 11: 1k;"><90 Y="5X: 0;7E: 0; h9-Y: 1k; z-aY: h8;">&6G;</90></1W>\');A.K.18=A(\'#d4\');A.K.7W=A(\'90\',A.K.18)}G B.1y(C(){if(B.4D!=\'aV\'&&B.4Z(\'1K\')!=\'3D\')G;B.1a={};B.1a.96=a.96;B.1a.8N=Z.3B(R(a.8N)||1);B.1a.9D=a.9D?a.9D:\'\';B.1a.72=a.72?a.72:\'\';B.1a.5p=a.5p&&a.5p.1F==2w?a.5p:P;B.1a.2K=a.2K&&a.2K.1F==2w?a.2K:P;B.1a.2V=a.2V&&a.2V.1F==2w?a.2V:P;B.1a.6H=a.6H&&a.6H.1F==2w?a.6H:P;B.1a.bv=a.bv||H;B.1a.9k=a.9k||H;B.1a.3y=B.1a.9k?(a.3y||\', \'):\'\';B.1a.9K=a.9K?14:H;B.1a.4w=Z.3B(R(a.4w)||8V);if(a.fx&&a.fx.1F==6E){if(!a.fx.1K||!/a4|1u|8o/.3M(a.fx.1K)){a.fx.1K=\'1u\'}if(a.fx.1K==\'1u\'&&!A.fx.1u)G;if(a.fx.1K==\'8o\'&&!A.fx.5l)G;a.fx.1H=Z.3B(R(a.fx.1H)||7n);if(a.fx.1H>B.1a.4w){a.fx.1H=B.1a.4w-1Y}B.1a.fx=a.fx}B.1a.3X=P;B.1a.9s=H;A(B).1m(\'b9\',\'cW\').6a(C(){A.K.2r=B;A.K.4b=B.2m}).cV(A.K.dh).5Q(A.K.b9).4W(C(){A.K.2A=1P.97(A.K.4i,gM)})})}};A.fn.gJ=A.K.2l;A.1t={2A:P,4k:P,1X:P,3f:10,2b:C(a,b,c,d){A.1t.4k=a;A.1t.1X=b;A.1t.3f=R(c)||10;A.1t.2A=1P.5Y(A.1t.cR,R(d)||40)},cR:C(){1V(i=0;i<A.1t.1X.1b;i++){if(!A.1t.1X[i].2J){A.1t.1X[i].2J=A.1U(A.12.6x(A.1t.1X[i]),A.12.6w(A.1t.1X[i]),A.12.5O(A.1t.1X[i]))}L{A.1t.1X[i].2J.t=A.1t.1X[i].2T;A.1t.1X[i].2J.l=A.1t.1X[i].2P}if(A.1t.4k.D&&A.1t.4k.D.6g==14){5a={x:A.1t.4k.D.2n,y:A.1t.4k.D.2j,1D:A.1t.4k.D.1w.1D,hb:A.1t.4k.D.1w.hb}}L{5a=A.1U(A.12.6x(A.1t.4k),A.12.6w(A.1t.4k))}if(A.1t.1X[i].2J.t>0&&A.1t.1X[i].2J.y+A.1t.1X[i].2J.t>5a.y){A.1t.1X[i].2T-=A.1t.3f}L if(A.1t.1X[i].2J.t<=A.1t.1X[i].2J.h&&A.1t.1X[i].2J.t+A.1t.1X[i].2J.hb<5a.y+5a.hb){A.1t.1X[i].2T+=A.1t.3f}if(A.1t.1X[i].2J.l>0&&A.1t.1X[i].2J.x+A.1t.1X[i].2J.l>5a.x){A.1t.1X[i].2P-=A.1t.3f}L if(A.1t.1X[i].2J.l<=A.1t.1X[i].2J.gf&&A.1t.1X[i].2J.l+A.1t.1X[i].2J.1D<5a.x+5a.1D){A.1t.1X[i].2P+=A.1t.3f}}},7w:C(){1P.5h(A.1t.2A);A.1t.4k=P;A.1t.1X=P;1V(i in A.1t.1X){A.1t.1X[i].2J=P}}};A.X={18:P,1g:P,4v:C(){G B.1y(C(){if(B.8L){B.D.cM.3h(\'4R\',A.X.aM);B.D=P;B.8L=H;if(A.2R.46){B.aI="cW"}L{B.Y.g0=\'\';B.Y.cJ=\'\';B.Y.cH=\'\'}}})},aM:C(e){if(A.X.1g!=P){A.X.8I(e);G H}F a=B.3H;A(1c).1C(\'3t\',A.X.aE).1C(\'5n\',A.X.8I);a.D.1A=A.12.3W(e);a.D.4d=a.D.1A;a.D.6g=H;a.D.fY=B!=B.3H;A.X.1g=a;if(a.D.4P&&B!=B.3H){aC=A.12.3a(a.2S);aZ=A.12.2f(a);ay={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};dx=a.D.4d.x-aC.x-aZ.1D/2-ay.x;dy=a.D.4d.y-aC.y-aZ.hb/2-ay.y;A.2Q.4s(a,[dx,dy])}G A.6J||H},cD:C(e){F a=A.X.1g;a.D.6g=14;F b=a.Y;a.D.6o=A.E(a,\'11\');a.D.49=A.E(a,\'T\');if(!a.D.av)a.D.av=a.D.49;a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.8z=0;a.D.8y=0;if(A.2R.46){F c=A.12.6b(a,14);a.D.8z=c.l||0;a.D.8y=c.t||0}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){b.T=\'2i\'}A.X.18.58();F d=A(a).cA(14).I(0);A(d).E({11:\'2v\',M:\'2G\',O:\'2G\'});d.Y.4M=\'0\';d.Y.53=\'0\';d.Y.4L=\'0\';d.Y.4K=\'0\';A.X.18.1L(d);F f=A.X.18.I(0).Y;if(a.D.ar){f.V=\'8x\';f.S=\'8x\'}L{f.S=a.D.1w.hb+\'Q\';f.V=a.D.1w.1D+\'Q\'}f.11=\'2v\';f.4M=\'2G\';f.53=\'2G\';f.4L=\'2G\';f.4K=\'2G\';A.1U(a.D.1w,A.12.2f(d));if(a.D.2M){if(a.D.2M.M){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.2M.M;a.D.1w.x=a.D.1A.x-a.D.2M.M}if(a.D.2M.O){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.2M.O;a.D.1w.y=a.D.1A.y-a.D.2M.O}if(a.D.2M.2D){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.1w.hb+a.D.2M.2D;a.D.1w.x=a.D.1A.x-a.D.1w.1D+a.D.2M.2D}if(a.D.2M.4e){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.1w.hb+a.D.2M.4e;a.D.1w.y=a.D.1A.y-a.D.1w.hb+a.D.2M.4e}}a.D.2n=a.D.22.x;a.D.2j=a.D.22.y;if(a.D.7V||a.D.2e==\'7X\'){7Z=A.12.6b(a.2S,14);a.D.1w.x=a.7Y+(A.2R.46?0:A.2R.6l?-7Z.l:7Z.l);a.D.1w.y=a.7t+(A.2R.46?0:A.2R.6l?-7Z.t:7Z.t);A(a.2S).1L(A.X.18.I(0))}if(a.D.2e){A.X.ah(a);a.D.4V.2e=A.X.ae}if(a.D.4P){A.2Q.ad(a)}f.M=a.D.1w.x-a.D.8z+\'Q\';f.O=a.D.1w.y-a.D.8y+\'Q\';f.V=a.D.1w.1D+\'Q\';f.S=a.D.1w.hb+\'Q\';A.X.1g.D.8w=H;if(a.D.gx){a.D.4V.5y=A.X.a9}if(a.D.3j!=H){A.X.18.E(\'3j\',a.D.3j)}if(a.D.1E){A.X.18.E(\'1E\',a.D.1E);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=\'+a.D.1E*1Y+\')\')}}if(a.D.6i){A.X.18.2H(a.D.6i);A.X.18.I(0).6M.Y.11=\'1k\'}if(a.D.4c)a.D.4c.1x(a,[d,a.D.22.x,a.D.22.y]);if(A.1s&&A.1s.7p>0){A.1s.ck(a)}if(a.D.3L==H){b.11=\'1k\'}G H},ah:C(a){if(a.D.2e.1F==8t){if(a.D.2e==\'7X\'){a.D.1Z=A.1U({x:0,y:0},A.12.2f(a.2S));F b=A.12.6b(a.2S,14);a.D.1Z.w=a.D.1Z.1D-b.l-b.r;a.D.1Z.h=a.D.1Z.hb-b.t-b.b}L if(a.D.2e==\'1c\'){F c=A.12.a5();a.D.1Z={x:0,y:0,w:c.w,h:c.h}}}L if(a.D.2e.1F==6h){a.D.1Z={x:R(a.D.2e[0])||0,y:R(a.D.2e[1])||0,w:R(a.D.2e[2])||0,h:R(a.D.2e[3])||0}}a.D.1Z.dx=a.D.1Z.x-a.D.1w.x;a.D.1Z.dy=a.D.1Z.y-a.D.1w.y},8r:C(a){if(a.D.7V||a.D.2e==\'7X\'){A(\'23\',1c).1L(A.X.18.I(0))}A.X.18.58().2x().E(\'1E\',1);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=1Y)\')}},8I:C(e){A(1c).3h(\'3t\',A.X.aE).3h(\'5n\',A.X.8I);if(A.X.1g==P){G}F a=A.X.1g;A.X.1g=P;if(a.D.6g==H){G H}if(a.D.3I==14){A(a).E(\'T\',a.D.49)}F b=a.Y;if(a.4P){A.X.18.E(\'7z\',\'7g\')}if(a.D.6i){A.X.18.3S(a.D.6i)}if(a.D.5B==H){if(a.D.fx>0){if(!a.D.2g||a.D.2g==\'3Z\'){F x=W A.fx(a,{1H:a.D.fx},\'M\');x.1G(a.D.22.x,a.D.7i)}if(!a.D.2g||a.D.2g==\'3K\'){F y=W A.fx(a,{1H:a.D.fx},\'O\');y.1G(a.D.22.y,a.D.7k)}}L{if(!a.D.2g||a.D.2g==\'3Z\')a.Y.M=a.D.7i+\'Q\';if(!a.D.2g||a.D.2g==\'3K\')a.Y.O=a.D.7k+\'Q\'}A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}L if(a.D.fx>0){a.D.8w=14;F c=H;if(A.1s&&A.1p&&a.D.3I){c=A.12.3a(A.1p.18.I(0))}A.X.18.4S({M:c?c.x:a.D.1w.x,O:c?c.y:a.D.1w.y},a.D.fx,C(){a.D.8w=H;if(a.D.3L==H){a.Y.11=a.D.6o}A.X.8r(a)})}L{A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}if(A.1s&&A.1s.7p>0){A.1s.c8(a)}if(A.1p&&a.D.3I){A.1p.c7(a)}if(a.D.2I&&(a.D.7i!=a.D.22.x||a.D.7k!=a.D.22.y)){a.D.2I.1x(a,a.D.aa||[0,0,a.D.7i,a.D.7k])}if(a.D.3C)a.D.3C.1x(a);G H},a9:C(x,y,a,b){if(a!=0)a=R((a+(B.D.gx*a/Z.3B(a))/2)/B.D.gx)*B.D.gx;if(b!=0)b=R((b+(B.D.gy*b/Z.3B(b))/2)/B.D.gy)*B.D.gy;G{dx:a,dy:b,x:0,y:0}},ae:C(x,y,a,b){a=Z.3k(Z.3g(a,B.D.1Z.dx),B.D.1Z.w+B.D.1Z.dx-B.D.1w.1D);b=Z.3k(Z.3g(b,B.D.1Z.dy),B.D.1Z.h+B.D.1Z.dy-B.D.1w.hb);G{dx:a,dy:b,x:0,y:0}},aE:C(e){if(A.X.1g==P||A.X.1g.D.8w==14){G}F a=A.X.1g;a.D.4d=A.12.3W(e);if(a.D.6g==H){3J=Z.cB(Z.5j(a.D.1A.x-a.D.4d.x,2)+Z.5j(a.D.1A.y-a.D.4d.y,2));if(3J<a.D.5D){G}L{A.X.cD(e)}}F b=a.D.4d.x-a.D.1A.x;F c=a.D.4d.y-a.D.1A.y;1V(F i in a.D.4V){F d=a.D.4V[i].1x(a,[a.D.22.x+b,a.D.22.y+c,b,c]);if(d&&d.1F==6E){b=i!=\'6f\'?d.dx:(d.x-a.D.22.x);c=i!=\'6f\'?d.dy:(d.y-a.D.22.y)}}a.D.2n=a.D.1w.x+b-a.D.8z;a.D.2j=a.D.1w.y+c-a.D.8y;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,a.D.2n,a.D.2j)}if(a.D.4h)a.D.4h.1x(a,[a.D.22.x+b,a.D.22.y+c]);if(!a.D.2g||a.D.2g==\'3Z\'){a.D.7i=a.D.22.x+b;A.X.18.I(0).Y.M=a.D.2n+\'Q\'}if(!a.D.2g||a.D.2g==\'3K\'){a.D.7k=a.D.22.y+c;A.X.18.I(0).Y.O=a.D.2j+\'Q\'}if(A.1s&&A.1s.7p>0){A.1s.8n(a)}G H},2l:C(o){if(!A.X.18){A(\'23\',1c).1L(\'<1W id="bX"></1W>\');A.X.18=A(\'#bX\');F c=A.X.18.I(0);F d=c.Y;d.T=\'1J\';d.11=\'1k\';d.7z=\'7g\';d.bV=\'1k\';d.2N=\'2B\';if(1P.6j){c.aI="bU"}L{d.eZ=\'1k\';d.cH=\'1k\';d.cJ=\'1k\'}}if(!o){o={}}G B.1y(C(){if(B.8L||!A.12)G;if(1P.6j){B.eX=C(){G H};B.eW=C(){G H}}F a=B;F b=o.3c?A(B).eV(o.3c):A(B);if(A.2R.46){b.1y(C(){B.aI="bU"})}L{b.E(\'-eU-6f-7Q\',\'1k\');b.E(\'6f-7Q\',\'1k\');b.E(\'-eT-6f-7Q\',\'1k\')}B.D={cM:b,5B:o.5B?14:H,3L:o.3L?14:H,3I:o.3I?o.3I:H,4P:o.4P?o.4P:H,7V:o.7V?o.7V:H,3j:o.3j?R(o.3j)||0:H,1E:o.1E?2c(o.1E):H,fx:R(o.fx)||P,5z:o.5z?o.5z:H,4V:{},1A:{},4c:o.4c&&o.4c.1F==2w?o.4c:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2I:o.2I&&o.2I.1F==2w?o.2I:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:0,2M:o.2M?o.2M:H,ar:o.ar?14:H,6i:o.6i||H};if(o.4V&&o.4V.1F==2w)B.D.4V.6f=o.4V;if(o.4h&&o.4h.1F==2w)B.D.4h=o.4h;if(o.2e&&((o.2e.1F==8t&&(o.2e==\'7X\'||o.2e==\'1c\'))||(o.2e.1F==6h&&o.2e.1b==4))){B.D.2e=o.2e}if(o.2C){B.D.2C=o.2C}if(o.5y){if(28 o.5y==\'eO\'){B.D.gx=R(o.5y)||1;B.D.gy=R(o.5y)||1}L if(o.5y.1b==2){B.D.gx=R(o.5y[0])||1;B.D.gy=R(o.5y[1])||1}}if(o.3n&&o.3n.1F==2w){B.D.3n=o.3n}B.8L=14;b.1y(C(){B.3H=a});b.1C(\'4R\',A.X.aM)})}};A.fn.1U({8j:A.X.4v,6r:A.X.2l});A.1s={bP:C(a,b,c,d){G a<=A.X.1g.D.2n&&(a+c)>=(A.X.1g.D.2n+A.X.1g.D.1w.w)&&b<=A.X.1g.D.2j&&(b+d)>=(A.X.1g.D.2j+A.X.1g.D.1w.h)?14:H},9S:C(a,b,c,d){G!(a>(A.X.1g.D.2n+A.X.1g.D.1w.w)||(a+c)<A.X.1g.D.2n||b>(A.X.1g.D.2j+A.X.1g.D.1w.h)||(b+d)<A.X.1g.D.2j)?14:H},1A:C(a,b,c,d){G a<A.X.1g.D.4d.x&&(a+c)>A.X.1g.D.4d.x&&b<A.X.1g.D.4d.y&&(b+d)>A.X.1g.D.4d.y?14:H},4T:H,3z:{},7p:0,3p:{},ck:C(a){if(A.X.1g==P){G}F i;A.1s.3z={};F b=H;1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F c=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+c.1f.a)){if(c.1f.m==H){c.1f.p=A.1U(A.12.6x(c),A.12.6w(c));c.1f.m=14}if(c.1f.ac){A.1s.3p[i].2H(c.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&c.1f.s&&A.X.1g.D.3I){c.1f.el=A(\'.\'+c.1f.a,c);a.Y.11=\'1k\';A.1p.bM(c);c.1f.9P=A.1p.8g(A.1m(c,\'id\')).6A;a.Y.11=a.D.6o;b=14}if(c.1f.9O){c.1f.9O.1x(A.1s.3p[i].I(0),[A.X.1g])}}}}if(b){A.1p.2b()}},eF:C(){A.1s.3z={};1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F a=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+a.1f.a)){a.1f.p=A.1U(A.12.6x(a),A.12.6w(a));if(a.1f.ac){A.1s.3p[i].2H(a.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&a.1f.s&&A.X.1g.D.3I){a.1f.el=A(\'.\'+a.1f.a,a);bJ.Y.11=\'1k\';A.1p.bM(a);bJ.Y.11=bJ.D.6o}}}}},8n:C(e){if(A.X.1g==P){G}A.1s.4T=H;F i;F a=H;F b=0;1V(i in A.1s.3z){F c=A.1s.3z[i].I(0);if(A.1s.4T==H&&A.1s[c.1f.t](c.1f.p.x,c.1f.p.y,c.1f.p.1D,c.1f.p.hb)){if(c.1f.hc&&c.1f.h==H){A.1s.3z[i].2H(c.1f.hc)}if(c.1f.h==H&&c.1f.76){a=14}c.1f.h=14;A.1s.4T=c;if(A.1p&&c.1f.s&&A.X.1g.D.3I){A.1p.18.I(0).2Z=c.1f.eC;A.1p.8n(c)}b++}L if(c.1f.h==14){if(c.1f.6C){c.1f.6C.1x(c,[e,A.X.18.I(0).6M,c.1f.fx])}if(c.1f.hc){A.1s.3z[i].3S(c.1f.hc)}c.1f.h=H}}if(A.1p&&!A.1s.4T&&A.X.1g.3I){A.1p.18.I(0).Y.11=\'1k\'}if(a){A.1s.4T.1f.76.1x(A.1s.4T,[e,A.X.18.I(0).6M])}},c8:C(e){F i;1V(i in A.1s.3z){F a=A.1s.3z[i].I(0);if(a.1f.ac){A.1s.3z[i].3S(a.1f.ac)}if(a.1f.hc){A.1s.3z[i].3S(a.1f.hc)}if(a.1f.s){A.1p.73[A.1p.73.1b]=i}if(a.1f.9I&&a.1f.h==14){a.1f.h=H;a.1f.9I.1x(a,[e,a.1f.fx])}a.1f.m=H;a.1f.h=H}A.1s.3z={}},4v:C(){G B.1y(C(){if(B.8S){if(B.1f.s){id=A.1m(B,\'id\');A.1p.54[id]=P;A(\'.\'+B.1f.a,B).8j()}A.1s.3p[\'d\'+B.bG]=P;B.8S=H;B.f=P}})},2l:C(o){G B.1y(C(){if(B.8S==14||!o.3r||!A.12||!A.X){G}B.1f={a:o.3r,ac:o.9F||H,hc:o.8X||H,eC:o.4G||H,9I:o.je||o.9I||H,76:o.76||o.ev||H,6C:o.6C||o.er||H,9O:o.9O||H,t:o.5T&&(o.5T==\'bP\'||o.5T==\'9S\')?o.5T:\'1A\',fx:o.fx?o.fx:H,m:H,h:H};if(o.bC==14&&A.1p){id=A.1m(B,\'id\');A.1p.54[id]=B.1f.a;B.1f.s=14;if(o.2I){B.1f.2I=o.2I;B.1f.9P=A.1p.8g(id).6A}}B.8S=14;B.bG=R(Z.63()*aW);A.1s.3p[\'d\'+B.bG]=A(B);A.1s.7p++})}};A.fn.1U({ei:A.1s.4v,ee:A.1s.2l});A.jd=A.1s.eF;A.3l={18:P,89:C(){3D=B.2m;if(!3D)G;Y={eb:A(B).E(\'eb\')||\'\',4a:A(B).E(\'4a\')||\'\',87:A(B).E(\'87\')||\'\',e9:A(B).E(\'e9\')||\'\',e8:A(B).E(\'e8\')||\'\',e7:A(B).E(\'e7\')||\'\',bx:A(B).E(\'bx\')||\'\',e6:A(B).E(\'e6\')||\'\'};A.3l.18.E(Y);3i=A.3l.e5(3D);3i=3i.48(W bw("\\\\n","g"),"<br />");A.3l.18.3i(\'j6\');b3=A.3l.18.I(0).3P;A.3l.18.3i(3i);V=A.3l.18.I(0).3P+b3;if(B.66.65&&V>B.66.65[0]){V=B.66.65[0]}B.Y.V=V+\'Q\';if(B.4D==\'bs\'){S=A.3l.18.I(0).5r+b3;if(B.66.65&&S>B.66.65[1]){S=B.66.65[1]}B.Y.S=S+\'Q\'}},e5:C(a){bq={\'&\':\'&j1;\',\'<\':\'&j0;\',\'>\':\'&gt;\',\'"\':\'&iZ;\'};1V(i in bq){a=a.48(W bw(i,\'g\'),bq[i])}G a},2l:C(a){if(A.3l.18==P){A(\'23\',1c).1L(\'<1W id="dX" Y="T: 1J; O: 0; M: 0; 2W: 2B;"></1W>\');A.3l.18=A(\'#dX\')}G B.1y(C(){if(/bs|aV/.3M(B.4D)){if(B.4D==\'aV\'){dT=B.4Z(\'1K\');if(!/3D|iW/.3M(dT)){G}}if(a&&(a.1F==bm||(a.1F==6h&&a.1b==2))){if(a.1F==bm)a=[a,a];L{a[0]=R(a[0])||7n;a[1]=R(a[1])||7n}B.66={65:a}}A(B).4W(A.3l.89).5Q(A.3l.89).cV(A.3l.89);A.3l.89.1x(B)}})}};A.fn.iU=A.3l.2l;A.fn.1U({c3:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'4l\',c)})},dP:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'41\',c)})},iQ:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dG\',c)})},iM:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'M\',c)})},iL:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'2D\',c)})},iK:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dF\',c)})}});A.fx.5l=C(e,a,b,c,d){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1N=A.12.2f(e);z.1e=28 b==\'4B\'?b:d||P;if(!e.4f)e.4f=z.el.E(\'11\');if(c==\'dG\'){c=z.el.E(\'11\')==\'1k\'?\'41\':\'4l\'}L if(c==\'dF\'){c=z.el.E(\'11\')==\'1k\'?\'2D\':\'M\'}z.el.1S();z.1l=a;z.29=28 b==\'C\'?b:P;z.fx=A.fx.9u(e);z.6T=c;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.6T==\'41\'||z.6T==\'2D\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(z.fx.U.1o.hb,0);1n;19\'41\':z.fx.2Y.E(\'S\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(0,z.fx.U.1o.hb);1n;19\'M\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(z.fx.U.1o.1D,0);1n;19\'2D\':z.fx.2Y.E(\'V\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(0,z.fx.U.1o.1D);1n}};A.fn.iA=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.eu(B,a,b);e.bE()})};A.fx.eu=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.29=b;z.8e=R(a)||40;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.74=5;z.52=1;z.bE=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:io,1T:C(){z.e=W A.fx(z.el.I(0),{1H:80,1T:C(){z.8e=R(z.8e/2);if(z.52<=z.74)z.bE();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'O\');z.e.1G(z.U.O-z.8e,z.U.O)}},\'O\');z.e.1G(z.U.O,z.U.O-z.8e)}};A.fn.1U({im:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3U\',c)})},ik:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'in\',c)})},ii:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3E\',c)})},ig:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3U\',c)})},ie:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'in\',c)})},ic:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3E\',c)})},ib:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3U\',c)})},ia:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'in\',c)})},i9:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3E\',c)})},i8:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3U\',c)})},i7:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'in\',c)})},i6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3E\',c)})}});A.fx.3Y=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.U={};z.U.T=z.el.E(\'T\');z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(!e.4f)e.4f=z.el.E(\'11\');if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}z.el.1S();if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.1K=d;b=28 b==\'C\'?b:P;7N=1;2X(c){19\'4l\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;7N=-1;1n;19\'41\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;1n;19\'2D\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;1n;19\'M\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;7N=-1;1n}z.e2=W A.fx(z.el.I(0),A.1l(a,z.1e,C(){z.el.E(z.U);if(z.1K==\'3U\'){z.el.E(\'11\',\'1k\')}L z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f);A.2z(z.el.I(0),\'1j\')}),\'1E\');if(d==\'in\'){z.e.1G(z.5x+1Y*7N,z.5x);z.e2.1G(0,1)}L{z.e.1G(z.5x,z.5x+1Y*7N);z.e2.1G(1,0)}};A.fn.1U({i5:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'dq\',d)})},i4:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'9g\',d)})},i3:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'3E\',d)})}});A.fx.9h=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 c==\'4B\'?c:f||P;z.29=28 c==\'C\'?c:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'9g\':\'dq\'}z.1l=a;z.S=b&&b.1F==bm?b:20;z.fx=A.fx.9u(e);z.1K=d;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.1K==\'9g\'){z.el.1S()}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};if(z.1K==\'9g\'){z.el.1S();z.fx.2Y.E(\'S\',z.S+\'Q\').E(\'V\',\'9e\');z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');z.ef.1G(z.S,z.fx.U.1o.hb)}),\'V\');z.ef.1G(0,z.fx.U.1o.1D)}L{z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');z.ef.1G(z.fx.U.1o.1D,0)}),\'S\');z.ef.1G(z.fx.U.1o.hb,z.S)}};A.fn.i2=C(c,d,e,f){G B.1r(\'dp\',C(){B.6Q=A(B).1m("Y")||\'\';f=28 e==\'4B\'?e:f||P;e=28 e==\'C\'?e:P;F a=A(B).E(\'6P\');F b=B.2S;6k(a==\'b7\'&&b){a=A(b).E(\'6P\');b=b.2S}A(B).E(\'6P\',d);if(28 B.6Q==\'7M\')B.6Q=B.6Q["9d"];A(B).4S({\'6P\':a},c,f,C(){A.2z(B,\'dp\');if(28 A(B).1m("Y")==\'7M\'){A(B).1m("Y")["9d"]="";A(B).1m("Y")["9d"]=B.6Q}L{A(B).1m("Y",B.6Q)}if(e)e.1x(B)})})};A.4n=C(e){if(/^i1$|^i0$|^hZ$|^5W$|^hY$|^hX$|^hW$|^hV$|^hU$|^23$|^hT$|^hS$|^hR$|^hQ$|^hP$|^hO$|^hN$/i.3M(e.98))G H;L G 14};A.fx.9n=C(e,a){F c=e.6M;F b=c.Y;b.T=a.T;b.4M=a.3s.t;b.4K=a.3s.l;b.4L=a.3s.b;b.53=a.3s.r;b.O=a.O+\'Q\';b.M=a.M+\'Q\';e.2S.dn(c,e);e.2S.hM(e)};A.fx.9u=C(e){if(!A.4n(e))G H;F t=A(e);F a=e.Y;F b=H;if(t.E(\'11\')==\'1k\'){95=t.E(\'2W\');t.E(\'2W\',\'2B\').1S();b=14}F c={};c.T=t.E(\'T\');c.1o=A.12.2f(e);c.3s=A.12.b2(e);F d=e.4u?e.4u.dk:t.E(\'hK\');c.O=R(t.E(\'O\'))||0;c.M=R(t.E(\'M\'))||0;F f=\'hJ\'+R(Z.63()*aW);F g=1c.3x(/^3O$|^br$|^hI$|^hr$|^7Q$|^hH$|^7M$|^3q$|^hF$|^hE$|^hC$|^90$|^dl$|^hB$/i.3M(e.98)?\'1W\':e.98);A.1m(g,\'id\',f);F h=A(g).2H(\'hA\');F i=g.Y;F j=0;F k=0;if(c.T==\'2i\'||c.T==\'1J\'){j=c.O;k=c.M}i.O=j+\'Q\';i.M=k+\'Q\';i.T=c.T!=\'2i\'&&c.T!=\'1J\'?\'2i\':c.T;i.S=c.1o.hb+\'Q\';i.V=c.1o.1D+\'Q\';i.4M=c.3s.t;i.53=c.3s.r;i.4L=c.3s.b;i.4K=c.3s.l;i.2N=\'2B\';if(A.2R.46){i.dk=d}L{i.hz=d}if(A.2R=="46"){a.4X="7s(1E="+0.dg*1Y+")"}a.1E=0.dg;e.2S.dn(g,e);g.hy(e);a.4M=\'2G\';a.53=\'2G\';a.4L=\'2G\';a.4K=\'2G\';a.T=\'1J\';a.bV=\'1k\';a.O=\'2G\';a.M=\'2G\';if(b){t.2x();a.2W=95}G{U:c,2Y:A(g)}};A.fx.7H={hx:[0,1O,1O],hw:[dd,1O,1O],hv:[db,db,hu],hs:[0,0,0],hq:[0,0,1O],hp:[d6,42,42],hn:[0,1O,1O],hm:[0,0,6N],hl:[0,6N,6N],hk:[aX,aX,aX],hi:[0,1Y,0],hg:[hf,he,cZ],hd:[6N,0,6N],ha:[85,cZ,47],h7:[1O,cY,0],h6:[h5,50,h4],h3:[6N,0,0],h2:[h1,cX,h0],gZ:[gY,0,8U],gX:[1O,0,1O],gW:[1O,gU,0],gT:[0,67,0],gS:[75,0,gQ],gP:[dd,cU,cY],gO:[gL,gK,cU],gI:[cT,1O,1O],gH:[cS,gG,cS],gF:[8U,8U,8U],gD:[1O,gC,gB],gA:[1O,1O,cT],gw:[0,1O,0],gv:[1O,0,1O],gu:[67,0,0],gs:[0,0,67],gr:[67,67,0],gq:[1O,d6,0],gp:[1O,8R,gn],gm:[67,0,67],gl:[1O,0,0],gk:[8R,8R,8R],gj:[1O,1O,1O],gi:[1O,1O,0]};A.fx.5L=C(a,b){if(A.fx.7H[a])G{r:A.fx.7H[a][0],g:A.fx.7H[a][1],b:A.fx.7H[a][2]};L if(2L=/^6v\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.8Q(a))G{r:R(2L[1]),g:R(2L[2]),b:R(2L[3])};L if(2L=/6v\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.8Q(a))G{r:2c(2L[1])*2.55,g:2c(2L[2])*2.55,b:2c(2L[3])*2.55};L if(2L=/^#([a-fA-6t-9])([a-fA-6t-9])([a-fA-6t-9])$/.8Q(a))G{r:R("6s"+2L[1]+2L[1]),g:R("6s"+2L[2]+2L[2]),b:R("6s"+2L[3]+2L[3])};L if(2L=/^#([a-fA-6t-9]{2})([a-fA-6t-9]{2})([a-fA-6t-9]{2})$/.8Q(a))G{r:R("6s"+2L[1]),g:R("6s"+2L[2]),b:R("6s"+2L[3])};L G b==14?H:{r:1O,g:1O,b:1O}};A.fx.cQ={5d:1,4y:1,5i:1,4x:1,4e:1,4a:1,S:1,M:1,bx:1,gh:1,4L:1,4K:1,53:1,4M:1,7y:1,5R:1,7x:1,8O:1,1E:1,ge:1,gc:1,4Q:1,4F:1,5g:1,5b:1,2D:1,gb:1,O:1,V:1,3j:1};A.fx.cN={6P:1,ga:1,g9:1,g8:1,g7:1,g6:1,g5:1};A.fx.7v=[\'g4\',\'g3\',\'g2\',\'g1\'];A.fx.aL={\'aK\':[\'2u\',\'cK\'],\'8E\':[\'2u\',\'aH\'],\'5X\':[\'5X\',\'\'],\'7E\':[\'7E\',\'\']};A.fn.1U({4S:C(b,c,d,f){G B.1r(C(){F a=A.1l(c,d,f);F e=W A.cI(B,a,b)})},aG:C(b,c){G B.1r(C(){F a=A.1l(b,c);F e=W A.aG(B,a)})},7w:C(a){G B.1y(C(){if(B.5e)A.aF(B,a)})},fZ:C(a){G B.1y(C(){if(B.5e)A.aF(B,a);if(B.1r&&B.1r[\'fx\'])B.1r.fx=[]})}});A.1U({aG:C(a,b){F z=B,5f;z.3f=C(){if(A.cF(b.1T))b.1T.1x(a)};z.2A=5Y(C(){z.3f()},b.1H);a.5e=z},1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a}},cI:C(f,g,h){F z=B,5f;F y=f.Y;F k=A.E(f,"2N");F l=A.E(f,"11");F o={};z.9a=(W 6p()).6y();g.1e=g.1e&&A.1e[g.1e]?g.1e:\'b1\';z.8H=C(a,b){if(A.fx.cQ[a]){if(b==\'1S\'||b==\'2x\'||b==\'3E\'){if(!f.5I)f.5I={};F r=2c(A.5S(f,a));f.5I[a]=r&&r>-aW?r:(2c(A.E(f,a))||0);b=b==\'3E\'?(l==\'1k\'?\'1S\':\'2x\'):b;g[b]=14;o[a]=b==\'1S\'?[0,f.5I[a]]:[f.5I[a],0];if(a!=\'1E\')y[a]=o[a][0]+(a!=\'3j\'&&a!=\'87\'?\'Q\':\'\');L A.1m(y,"1E",o[a][0])}L{o[a]=[2c(A.5S(f,a)),2c(b)||0]}}L if(A.fx.cN[a])o[a]=[A.fx.5L(A.5S(f,a)),A.fx.5L(b)];L if(/^5X$|7E$|2u$|8E$|aK$/i.3M(a)){F m=b.48(/\\s+/g,\' \').48(/6v\\s*\\(\\s*/g,\'6v(\').48(/\\s*,\\s*/g,\',\').48(/\\s*\\)/g,\')\').aD(/([^\\s]+)/g);2X(a){19\'5X\':19\'7E\':19\'aK\':19\'8E\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];1V(F i=0;i<A.fx.7v.1b;i++){F c=A.fx.aL[a][0]+A.fx.7v[i]+A.fx.aL[a][1];o[c]=a==\'8E\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),2c(m[i])]}1n;19\'2u\':1V(F i=0;i<m.1b;i++){F d=2c(m[i]);F e=!fX(d)?\'cK\':(!/b7|1k|2B|fW|fV|fU|fT|fS|fQ|fP|fO/i.3M(m[i])?\'aH\':H);if(e){1V(F j=0;j<A.fx.7v.1b;j++){c=\'2u\'+A.fx.7v[j]+e;o[c]=e==\'aH\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),d]}}L{y[\'fN\']=m[i]}}1n}}L{y[a]=b}G H};1V(p in h){if(p==\'Y\'){F q=A.ax(h[p]);1V(6I in q){B.8H(6I,q[6I])}}L if(p==\'2Z\'){if(1c.8D)1V(F i=0;i<1c.8D.1b;i++){F s=1c.8D[i].fM||1c.8D[i].fL||P;if(s){1V(F j=0;j<s.1b;j++){if(s[j].fK==\'.\'+h[p]){F u=W bw(\'\\.\'+h[p]+\' {\');F v=s[j].Y.9d;F q=A.ax(v.48(u,\'\').48(/}/g,\'\'));1V(6I in q){B.8H(6I,q[6I])}}}}}}L{B.8H(p,h[p])}}y.11=l==\'1k\'?\'2v\':l;y.2N=\'2B\';z.3f=C(){F t=(W 6p()).6y();if(t>g.1H+z.9a){5h(z.2A);z.2A=P;1V(p in o){if(p=="1E")A.1m(y,"1E",o[p][1]);L if(28 o[p][1]==\'7M\')y[p]=\'6v(\'+o[p][1].r+\',\'+o[p][1].g+\',\'+o[p][1].b+\')\';L y[p]=o[p][1]+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}if(g.2x||g.1S)1V(F p in f.5I)if(p=="1E")A.1m(y,p,f.5I[p]);L y[p]="";y.11=g.2x?\'1k\':(l!=\'1k\'?l:\'2v\');y.2N=k;f.5e=P;if(A.cF(g.1T))g.1T.1x(f)}L{F n=t-B.9a;F a=n/g.1H;1V(p in o){if(28 o[p][1]==\'7M\'){y[p]=\'6v(\'+R(A.1e[g.1e](a,n,o[p][0].r,(o[p][1].r-o[p][0].r),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].g,(o[p][1].g-o[p][0].g),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].b,(o[p][1].b-o[p][0].b),g.1H))+\')\'}L{F b=A.1e[g.1e](a,n,o[p][0],(o[p][1]-o[p][0]),g.1H);if(p=="1E")A.1m(y,"1E",b);L y[p]=b+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}}}};z.2A=5Y(C(){z.3f()},13);f.5e=z},aF:C(a,b){if(b)a.5e.9a-=fJ;L{1P.5h(a.5e.2A);a.5e=P;A.2z(a,"fx")}}});A.ax=C(a){F b={};if(28 a==\'4B\'){a=a.5u().6W(\';\');1V(F i=0;i<a.1b;i++){8B=a[i].6W(\':\');if(8B.1b==2){b[A.cE(8B[0].48(/\\-(\\w)/g,C(m,c){G c.fI()}))]=A.cE(8B[1])}}}G b};A.fn.1U({fH:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'5o\',c)})},fG:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)})},fF:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)}})},fE:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3K\',\'5o\',c)}})},fD:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)})},fC:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)})}});A.fx.4N=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;F g=H;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;z.1K=d;z.1l=a;z.26=A.12.2f(e);z.U={};z.U.T=z.el.E(\'T\');z.U.11=z.el.E(\'11\');if(z.U.11==\'1k\'){95=z.el.E(\'2W\');z.el.1S();g=14}z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(g){z.el.2x();z.el.E(\'2W\',95)}z.U.V=z.26.w+\'Q\';z.U.S=z.26.h+\'Q\';z.U.2N=z.el.E(\'2N\');z.26.O=R(z.U.O)||0;z.26.M=R(z.U.M)||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\').E(\'S\',d==\'6n\'&&c==\'3K\'?1:z.26.h+\'Q\').E(\'V\',d==\'6n\'&&c==\'3Z\'?1:z.26.w+\'Q\');z.1T=C(){z.el.E(z.U);if(z.1K==\'5o\')z.el.2x();L z.el.1S();A.2z(z.el.I(0),\'1j\')};2X(c){19\'3K\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'S\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'5o\'){z.eh.1G(z.26.h,0);z.et.1G(z.26.O,z.26.O+z.26.h/2)}L{z.eh.1G(0,z.26.h);z.et.1G(z.26.O+z.26.h/2,z.26.O)}1n;19\'3Z\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'V\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'5o\'){z.eh.1G(z.26.w,0);z.et.1G(z.26.M,z.26.M+z.26.w/2)}L{z.eh.1G(0,z.26.w);z.et.1G(z.26.M+z.26.w/2,z.26.M)}1n}};A.fn.au=C(b,c,d){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F a=W A.fx.au(B,b,c,d);a.at()})};A.fx.au=C(a,b,c,d){F z=B;z.74=c;z.52=1;z.el=a;z.1l=b;z.29=d;A(z.el).1S();z.at=C(){z.52++;z.e=W A.fx(z.el,A.1l(z.1l,C(){z.ef=W A.fx(z.el,A.1l(z.1l,C(){if(z.52<=z.74)z.at();L{A.2z(z.el,\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el)}}}),\'1E\');z.ef.1G(0,1)}),\'1E\');z.e.1G(1,0)}};A.fn.1U({fB:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1,1Y,14,b,\'cz\',c)})},fy:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1Y,1,14,b,\'as\',c)})},fw:C(b,c,d){G B.1r(\'1j\',C(){F a=a||\'d2\';W A.fx.5E(B,b,1Y,cX,14,c,\'5c\',a)})},5E:C(a,b,c,d,e,f){G B.1r(\'1j\',C(){W A.fx.5E(B,a,b,c,d,e,\'5E\',f)})}});A.fx.5E=C(e,f,g,h,j,k,m,q){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.6m=R(g)||1Y;z.3v=R(h)||1Y;z.1e=28 k==\'4B\'?k:q||P;z.29=28 k==\'C\'?k:P;z.1H=A.1l(f).1H;z.bL=j||P;z.26=A.12.2f(e);z.U={V:z.el.E(\'V\'),S:z.el.E(\'S\'),4a:z.el.E(\'4a\')||\'1Y%\',T:z.el.E(\'T\'),11:z.el.E(\'11\'),O:z.el.E(\'O\'),M:z.el.E(\'M\'),2N:z.el.E(\'2N\'),4x:z.el.E(\'4x\'),5i:z.el.E(\'5i\'),5d:z.el.E(\'5d\'),4y:z.el.E(\'4y\'),5b:z.el.E(\'5b\'),5g:z.el.E(\'5g\'),4Q:z.el.E(\'4Q\'),4F:z.el.E(\'4F\')};z.V=R(z.U.V)||e.3P||0;z.S=R(z.U.S)||e.5r||0;z.O=R(z.U.O)||0;z.M=R(z.U.M)||0;1o=[\'em\',\'Q\',\'fv\',\'%\'];1V(i in 1o){if(z.U.4a.3o(1o[i])>0){z.cy=1o[i];z.4a=2c(z.U.4a)}if(z.U.4x.3o(1o[i])>0){z.cx=1o[i];z.aq=2c(z.U.4x)||0}if(z.U.5i.3o(1o[i])>0){z.cw=1o[i];z.ap=2c(z.U.5i)||0}if(z.U.5d.3o(1o[i])>0){z.cv=1o[i];z.ao=2c(z.U.5d)||0}if(z.U.4y.3o(1o[i])>0){z.cu=1o[i];z.an=2c(z.U.4y)||0}if(z.U.5b.3o(1o[i])>0){z.ct=1o[i];z.am=2c(z.U.5b)||0}if(z.U.5g.3o(1o[i])>0){z.cr=1o[i];z.al=2c(z.U.5g)||0}if(z.U.4Q.3o(1o[i])>0){z.cq=1o[i];z.ak=2c(z.U.4Q)||0}if(z.U.4F.3o(1o[i])>0){z.cp=1o[i];z.aj=2c(z.U.4F)||0}}if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\');z.1K=m;2X(z.1K){19\'cz\':z.3V=z.O+z.26.h/2;z.4H=z.O;z.3Q=z.M+z.26.w/2;z.4r=z.M;1n;19\'as\':z.4H=z.O+z.26.h/2;z.3V=z.O;z.4r=z.M+z.26.w/2;z.3Q=z.M;1n;19\'5c\':z.4H=z.O-z.26.h/4;z.3V=z.O;z.4r=z.M-z.26.w/4;z.3Q=z.M;1n}z.ai=H;z.t=(W 6p).6y();z.4i=C(){5h(z.2A);z.2A=P};z.3f=C(){if(z.ai==H){z.el.1S();z.ai=14}F t=(W 6p).6y();F n=t-z.t;F p=n/z.1H;if(t>=z.1H+z.t){97(C(){o=1;if(z.1K){t=z.4H;l=z.4r;if(z.1K==\'5c\')o=0}z.ag(z.3v,l,t,14,o)},13);z.4i()}L{o=1;if(!A.1e||!A.1e[z.1e]){s=((-Z.51(p*Z.2F)/2)+0.5)*(z.3v-z.6m)+z.6m}L{s=A.1e[z.1e](p,n,z.6m,(z.3v-z.6m),z.1H)}if(z.1K){if(!A.1e||!A.1e[z.1e]){t=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V;l=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q;if(z.1K==\'5c\')o=((-Z.51(p*Z.2F)/2)+0.5)*(-0.9B)+0.9B}L{t=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.1H);l=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.1H);if(z.1K==\'5c\')o=A.1e[z.1e](p,n,0.9B,-0.9B,z.1H)}}z.ag(s,l,t,H,o)}};z.2A=5Y(C(){z.3f()},13);z.ag=C(a,b,c,d,e){z.el.E(\'S\',z.S*a/1Y+\'Q\').E(\'V\',z.V*a/1Y+\'Q\').E(\'M\',b+\'Q\').E(\'O\',c+\'Q\').E(\'4a\',z.4a*a/1Y+z.cy);if(z.aq)z.el.E(\'4x\',z.aq*a/1Y+z.cx);if(z.ap)z.el.E(\'5i\',z.ap*a/1Y+z.cw);if(z.ao)z.el.E(\'5d\',z.ao*a/1Y+z.cv);if(z.an)z.el.E(\'4y\',z.an*a/1Y+z.cu);if(z.am)z.el.E(\'5b\',z.am*a/1Y+z.ct);if(z.al)z.el.E(\'5g\',z.al*a/1Y+z.cr);if(z.ak)z.el.E(\'4Q\',z.ak*a/1Y+z.cq);if(z.aj)z.el.E(\'4F\',z.aj*a/1Y+z.cp);if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+e*1Y+")";z.el.I(0).Y.1E=e}if(d){if(z.bL){z.el.E(z.U)}if(z.1K==\'as\'||z.1K==\'5c\'){z.el.E(\'11\',\'1k\');if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+1Y+")";z.el.I(0).Y.1E=1}}L z.el.E(\'11\',\'2v\');if(z.29)z.29.1x(z.el.I(0));A.2z(z.el.I(0),\'1j\')}}};A.fn.1U({9A:C(a,b,c){o=A.1l(a);G B.1r(\'1j\',C(){W A.fx.9A(B,o,b,c)})},ft:C(a,b,c){G B.1y(C(){A(\'a[@2U*="#"]\',B).4U(C(e){co=B.2U.6W(\'#\');A(\'#\'+co[1]).9A(a,b,c);G H})})}});A.fx.9A=C(e,o,a,b){F z=B;z.o=o;z.e=e;z.2g=/cn|cm/.3M(a)?a:H;z.1e=b;p=A.12.3a(e);s=A.12.5O();z.4i=C(){5h(z.2A);z.2A=P;A.2z(z.e,\'1j\')};z.t=(W 6p).6y();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.4H=p.y>s.h?s.h:p.y;z.4r=p.x>s.w?s.w:p.x;z.3V=s.t;z.3Q=s.l;z.3f=C(){F t=(W 6p).6y();F n=t-z.t;F p=n/z.o.1H;if(t>=z.o.1H+z.t){z.4i();97(C(){z.ab(z.4H,z.4r)},13)}L{if(!z.2g||z.2g==\'cn\'){if(!A.1e||!A.1e[z.1e]){8v=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V}L{8v=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.o.1H)}}L{8v=z.3V}if(!z.2g||z.2g==\'cm\'){if(!A.1e||!A.1e[z.1e]){8u=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q}L{8u=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.o.1H)}}L{8u=z.3Q}z.ab(8v,8u)}};z.ab=C(t,l){1P.fs(l,t)};z.2A=5Y(C(){z.3f()},13)};A.fn.a8=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.a8(B,a,b);e.a7()})};A.fx.a8=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.74=R(a)||3;z.29=b;z.52=1;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.a7=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(e,{1H:60,1T:C(){if(z.52<=z.74)z.a7();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'M\');z.e.1G(z.U.M-20,z.U.M)}},\'M\');z.e.1G(z.U.M+20,z.U.M-20)}},\'M\');z.e.1G(z.U.M,z.U.M+20)}};A.fn.1U({dR:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'in\',c)})},c6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3U\',c)})},fr:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3E\',c)})},fq:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'in\',c)})},fp:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3U\',c)})},fo:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3E\',c)})},fm:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'in\',c)})},fl:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3U\',c)})},fk:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3E\',c)})},fj:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'in\',c)})},fi:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3U\',c)})},fh:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3E\',c)})}});A.fx.1u=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}if(!e.4f)e.4f=z.el.E(\'11\');z.el.1S();z.1l=a;z.fx=A.fx.9u(e);z.1K=d;z.6T=c;z.1T=C(){if(z.1K==\'3U\')z.el.E(\'2W\',\'2B\');A.fx.9n(z.fx.2Y.I(0),z.fx.U);if(z.1K==\'in\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.E(\'11\',\'1k\');z.el.E(\'2W\',\'cl\')}if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'S\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.hb,0);z.79.1G(0,z.fx.U.1o.hb)}L{z.ef.1G(0,-z.fx.U.1o.hb);z.79.1G(z.fx.U.1o.hb,0)}1n;19\'41\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.hb,0)}L{z.ef.1G(0,z.fx.U.1o.hb)}1n;19\'M\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'V\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.1D,0);z.79.1G(0,z.fx.U.1o.1D)}L{z.ef.1G(0,-z.fx.U.1o.1D);z.79.1G(z.fx.U.1o.1D,0)}1n;19\'2D\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.1D,0)}L{z.ef.1G(0,z.fx.U.1o.1D)}1n}};A.2O=P;A.fn.fg=C(o){G B.1r(\'1j\',C(){W A.fx.cj(B,o)})};A.fx.cj=C(e,o){if(A.2O==P){A(\'23\',1c).1L(\'<1W id="2O"></1W>\');A.2O=A(\'#2O\')}A.2O.E(\'11\',\'2v\').E(\'T\',\'1J\');F z=B;z.el=A(e);if(!o||!o.3v){G}if(o.3v.1F==8t&&1c.7o(o.3v)){o.3v=1c.7o(o.3v)}L if(!o.3v.ci){G}if(!o.1H){o.1H=ch}z.1H=o.1H;z.3v=o.3v;z.7e=o.2Z;z.1T=o.1T;if(z.7e){A.2O.2H(z.7e)}z.8s=0;z.8i=0;if(A.e0){z.8s=(R(A.2O.E(\'4y\'))||0)+(R(A.2O.E(\'5i\'))||0)+(R(A.2O.E(\'4F\'))||0)+(R(A.2O.E(\'5g\'))||0);z.8i=(R(A.2O.E(\'4x\'))||0)+(R(A.2O.E(\'5d\'))||0)+(R(A.2O.E(\'5b\'))||0)+(R(A.2O.E(\'4Q\'))||0)}z.2b=A.1U(A.12.3a(z.el.I(0)),A.12.2f(z.el.I(0)));z.3m=A.1U(A.12.3a(z.3v),A.12.2f(z.3v));z.2b.1D-=z.8s;z.2b.hb-=z.8i;z.3m.1D-=z.8s;z.3m.hb-=z.8i;z.29=o.1T;A.2O.E(\'V\',z.2b.1D+\'Q\').E(\'S\',z.2b.hb+\'Q\').E(\'O\',z.2b.y+\'Q\').E(\'M\',z.2b.x+\'Q\').4S({O:z.3m.y,M:z.3m.x,V:z.3m.1D,S:z.3m.hb},z.1H,C(){if(z.7e)A.2O.3S(z.7e);A.2O.E(\'11\',\'1k\');if(z.1T&&z.1T.1F==2w){z.1T.1x(z.el.I(0),[z.3v])}A.2z(z.el.I(0),\'1j\')})};A.1q={24:{2u:10,cf:\'1R/ff.ce\',cd:\'<3O 2E="1R/5o.cc" />\',cb:0.8,ca:\'fb 8G\',c9:\'6m\',3F:7n},fa:H,f8:H,5A:P,7m:H,7l:H,a3:C(a){if(!A.1q.7l||A.1q.7m)G;F b=a.6S||a.6R||-1;2X(b){19 35:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f7\').I(0));1n;19 36:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f6\').I(0));1n;19 37:19 8:19 33:19 80:19 f4:F c=A(\'#7j\');if(c.I(0).4q!=P){c.I(0).4q.1x(c.I(0))}1n;19 38:1n;19 39:19 34:19 32:19 fd:19 78:F d=A(\'#7h\');if(d.I(0).4q!=P){d.I(0).4q.1x(d.I(0))}1n;19 40:1n;19 27:A.1q.8q();1n}},6g:C(a){if(a)A.1U(A.1q.24,a);if(1P.3N){A(\'23\',1c).1C(\'5Q\',A.1q.a3)}L{A(1c).1C(\'5Q\',A.1q.a3)}A(\'a\').1y(C(){el=A(B);c5=el.1m(\'4o\')||\'\';c4=el.1m(\'2U\')||\'\';cg=/\\.cc|\\.f2|\\.7q|\\.ce|\\.f1/g;if(c4.5u().aD(cg)!=P&&c5.5u().3o(\'c2\')==0){el.1C(\'4U\',A.1q.2b)}});if(A.2R.46){3q=1c.3x(\'3q\');A(3q).1m({id:\'a1\',2E:\'dc:H;\',da:\'b0\',d7:\'b0\'}).E({11:\'1k\',T:\'1J\',O:\'0\',M:\'0\',4X:\'9x:9C.9E.a6(1E=0)\'});A(\'23\').1L(3q)}7r=1c.3x(\'1W\');A(7r).1m(\'id\',\'a0\').E({T:\'1J\',11:\'1k\',O:\'0\',M:\'0\',1E:0}).1L(1c.8b(\' \')).1C(\'4U\',A.1q.8q);5C=1c.3x(\'1W\');A(5C).1m(\'id\',\'c0\').E({4F:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Z=1c.3x(\'1W\');A(9Z).1m(\'id\',\'bY\').E({4F:A.1q.24.2u+\'Q\',4Q:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Y=1c.3x(\'a\');A(9Y).1m({id:\'f0\',2U:\'#\'}).E({T:\'1J\',2D:A.1q.24.2u+\'Q\',O:\'0\'}).1L(A.1q.24.cd).1C(\'4U\',A.1q.8q);6Z=1c.3x(\'1W\');A(6Z).1m(\'id\',\'9X\').E({T:\'2i\',9W:\'M\',5X:\'0 8x\',3j:1}).1L(5C).1L(9Z).1L(9Y);21=1c.3x(\'3O\');21.2E=A.1q.24.cf;A(21).1m(\'id\',\'bW\').E({T:\'1J\'});5G=1c.3x(\'a\');A(5G).1m({id:\'7j\',2U:\'#\'}).E({T:\'1J\',11:\'1k\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));5F=1c.3x(\'a\');A(5F).1m({id:\'7h\',2U:\'#\'}).E({T:\'1J\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));2q=1c.3x(\'1W\');A(2q).1m(\'id\',\'bT\').E({11:\'1k\',T:\'2i\',2N:\'2B\',9W:\'M\',5X:\'0 8x\',O:\'0\',M:\'0\',3j:2}).1L([21,5G,5F]);5Z=1c.3x(\'1W\');A(5Z).1m(\'id\',\'8m\').E({11:\'1k\',T:\'1J\',2N:\'2B\',O:\'0\',M:\'0\',9W:\'az\',6P:\'b7\',eY:\'0\'}).1L([2q,6Z]);A(\'23\').1L(7r).1L(5Z)},2b:C(e,a){el=a?A(a):A(B);8J=el.1m(\'4o\');F b,4E,5G,5F;if(8J!=\'c2\'){A.1q.5A=8J;7F=A(\'a[@4o=\'+8J+\']\');b=7F.1N();4E=7F.aY(a?a:B);5G=7F.I(4E-1);5F=7F.I(4E+1)}aw=el.1m(\'2U\');5C=el.1m(\'3T\');3R=A.12.5O();7r=A(\'#a0\');if(!A.1q.7l){A.1q.7l=14;if(A.2R.46){A(\'#a1\').E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S()}7r.E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S().bS(bz,A.1q.24.cb,C(){A.1q.aB(aw,5C,3R,b,4E,5G,5F)});A(\'#8m\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\')}L{A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.aB(aw,5C,3R,b,4E,5G,5F)}G H},aB:C(a,b,c,d,e,f,g){A(\'#aA\').9U();8l=A(\'#7j\');8l.2x();8k=A(\'#7h\');8k.2x();21=A(\'#bW\');2q=A(\'#bT\');5Z=A(\'#8m\');6Z=A(\'#9X\').E(\'2W\',\'2B\');A(\'#c0\').3i(5C);A.1q.7m=14;if(d)A(\'#bY\').3i(A.1q.24.ca+\' \'+(e+1)+\' \'+A.1q.24.c9+\' \'+d);if(f){8l.I(0).4q=C(){B.4W();A.1q.2b(P,f);G H}}if(g){8k.I(0).4q=C(){B.4W();A.1q.2b(P,g);G H}}21.1S();7u=A.12.2f(2q.I(0));4C=Z.3g(7u.1D,21.I(0).V+A.1q.24.2u*2);59=Z.3g(7u.hb,21.I(0).S+A.1q.24.2u*2);21.E({M:(4C-21.I(0).V)/2+\'Q\',O:(59-21.I(0).S)/2+\'Q\'});2q.E({V:4C+\'Q\',S:59+\'Q\'}).1S();bQ=A.12.a5();5Z.E(\'O\',c.t+(bQ.h/15)+\'Q\');if(5Z.E(\'11\')==\'1k\'){5Z.1S().6U(A.1q.24.3F)}5H=W 8M;A(5H).1m(\'id\',\'aA\').1C(\'eP\',C(){4C=5H.V+A.1q.24.2u*2;59=5H.S+A.1q.24.2u*2;21.2x();2q.4S({S:59},7u.hb!=59?A.1q.24.3F:1,C(){2q.4S({V:4C},7u.1D!=4C?A.1q.24.3F:1,C(){2q.aJ(5H);A(5H).E({T:\'1J\',M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\'}).6U(A.1q.24.3F,C(){cL=A.12.2f(6Z.I(0));if(f){8l.E({M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}if(g){8k.E({M:4C/2+A.1q.24.2u*2+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}6Z.E({V:4C+\'Q\',O:-cL.hb+\'Q\',2W:\'cl\'}).4S({O:-1},A.1q.24.3F,C(){A.1q.7m=H})})})})});5H.2E=a},8q:C(){A(\'#aA\').9U();A(\'#8m\').2x();A(\'#9X\').E(\'2W\',\'2B\');A(\'#a0\').bS(bz,0,C(){A(B).2x();if(A.2R.46){A(\'#a1\').2x()}});A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.5A=P;A.1q.7l=H;A.1q.7m=H;G H}};A.N={1v:P,3A:P,1g:P,1A:P,1o:P,T:P,7f:C(e){A.N.1g=(B.9T)?B.9T:B;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(A.N.1g).E(\'V\'))||0,S:R(A(A.N.1g).E(\'S\'))||0};A.N.T={O:R(A(A.N.1g).E(\'O\'))||0,M:R(A(A.N.1g).E(\'M\'))||0};A(1c).1C(\'3t\',A.N.aO).1C(\'5n\',A.N.aN);if(28 A.N.1g.1h.bO===\'C\'){A.N.1g.1h.bO.1x(A.N.1g)}G H},aN:C(e){A(1c).3h(\'3t\',A.N.aO).3h(\'5n\',A.N.aN);if(28 A.N.1g.1h.cO===\'C\'){A.N.1g.1h.cO.1x(A.N.1g)}A.N.1g=P},aO:C(e){if(!A.N.1g){G}1A=A.12.3W(e);6c=A.N.T.O-A.N.1A.y+1A.y;77=A.N.T.M-A.N.1A.x+1A.x;6c=Z.3g(Z.3k(6c,A.N.1g.1h.7d-A.N.1o.S),A.N.1g.1h.6F);77=Z.3g(Z.3k(77,A.N.1g.1h.7c-A.N.1o.V),A.N.1g.1h.6u);if(28 A.N.1g.1h.4h===\'C\'){F a=A.N.1g.1h.4h.1x(A.N.1g,[77,6c]);if(28 a==\'eI\'&&a.1b==2){77=a[0];6c=a[1]}}A.N.1g.Y.O=6c+\'Q\';A.N.1g.Y.M=77+\'Q\';G H},2b:C(e){A(1c).1C(\'3t\',A.N.7g).1C(\'5n\',A.N.7w);A.N.1v=B.1v;A.N.3A=B.3A;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(B.1v).E(\'V\'))||0,S:R(A(B.1v).E(\'S\'))||0};A.N.T={O:R(A(B.1v).E(\'O\'))||0,M:R(A(B.1v).E(\'M\'))||0};if(A.N.1v.1h.4c){A.N.1v.1h.4c.1x(A.N.1v,[B])}G H},7w:C(){A(1c).3h(\'3t\',A.N.7g).3h(\'5n\',A.N.7w);if(A.N.1v.1h.3C){A.N.1v.1h.3C.1x(A.N.1v,[A.N.3A])}A.N.1v=P;A.N.3A=P},5N:C(a,b){G Z.3k(Z.3g(A.N.1o.V+a*b,A.N.1v.1h.8O),A.N.1v.1h.5R)},5M:C(a,b){G Z.3k(Z.3g(A.N.1o.S+a*b,A.N.1v.1h.7x),A.N.1v.1h.7y)},bN:C(a){G Z.3k(Z.3g(a,A.N.1v.1h.7x),A.N.1v.1h.7y)},7g:C(e){if(A.N.1v==P){G}1A=A.12.3W(e);dx=1A.x-A.N.1A.x;dy=1A.y-A.N.1A.y;1B={V:A.N.1o.V,S:A.N.1o.S};2s={O:A.N.T.O,M:A.N.T.M};2X(A.N.3A){19\'e\':1B.V=A.N.5N(dx,1);1n;19\'eH\':1B.V=A.N.5N(dx,1);1B.S=A.N.5M(dy,1);1n;19\'w\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'9R\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1B.S=A.N.5M(dy,1);1n;19\'7a\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'n\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1n;19\'9Q\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,1);1n;19\'s\':1B.S=A.N.5M(dy,1);1n}if(A.N.1v.1h.44){if(A.N.3A==\'n\'||A.N.3A==\'s\')43=1B.S*A.N.1v.1h.44;L 43=1B.V;4z=A.N.bN(43*A.N.1v.1h.44);43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.S=4z;1B.V=43}if(2s.O<A.N.1v.1h.6F){4z=1B.S+2s.O-A.N.1v.1h.6F;2s.O=A.N.1v.1h.6F;if(A.N.1v.1h.44){43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.V=43}1B.S=4z}if(2s.M<A.N.1v.1h.6u){43=1B.V+2s.M-A.N.1v.1h.6u;2s.M=A.N.1v.1h.6u;if(A.N.1v.1h.44){4z=43*A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}1B.S=4z}1B.V=43}if(2s.O+1B.S>A.N.1v.1h.7d){1B.S=A.N.1v.1h.7d-2s.O;if(A.N.1v.1h.44){1B.V=1B.S/A.N.1v.1h.44}}if(2s.M+1B.V>A.N.1v.1h.7c){1B.V=A.N.1v.1h.7c-2s.M;if(A.N.1v.1h.44){1B.S=1B.V*A.N.1v.1h.44}}F a=H;if(A.N.1v.1h.eG){a=A.N.1v.1h.eG.1x(A.N.1v,[1B,2s]);if(a){if(a.1o){A.1U(1B,a.1o)}if(a.T){A.1U(2s,a.T)}}}8f=A.N.1v.Y;8f.M=2s.M+\'Q\';8f.O=2s.O+\'Q\';8f.V=1B.V+\'Q\';8f.S=1B.S+\'Q\';G H},2l:C(b){if(!b||!b.3G||b.3G.1F!=6E){G}G B.1y(C(){F a=B;a.1h=b;a.1h.8O=b.8O||10;a.1h.7x=b.7x||10;a.1h.5R=b.5R||5P;a.1h.7y=b.7y||5P;a.1h.6F=b.6F||-8V;a.1h.6u=b.6u||-8V;a.1h.7c=b.7c||5P;a.1h.7d=b.7d||5P;bK=A(a).E(\'T\');if(!(bK==\'2i\'||bK==\'1J\')){a.Y.T=\'2i\'}eE=/n|9Q|e|eH|s|9R|w|7a/g;1V(i in a.1h.3G){if(i.5u().aD(eE)!=P){if(a.1h.3G[i].1F==8t){3c=A(a.1h.3G[i]);if(3c.1N()>0){a.1h.3G[i]=3c.I(0)}}if(a.1h.3G[i].4D){a.1h.3G[i].1v=a;a.1h.3G[i].3A=i;A(a.1h.3G[i]).1C(\'4R\',A.N.2b)}}}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){9N=A(a.1h.5k);if(9N.1N()>0){9N.1y(C(){B.9T=a});9N.1C(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).1C(\'4R\',A.N.7f)}}})},4v:C(){G B.1y(C(){F a=B;1V(i in a.1h.3G){a.1h.3G[i].1v=P;a.1h.3G[i].3A=P;A(a.1h.3G[i]).3h(\'4R\',A.N.2b)}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){3c=A(a.1h.5k);if(3c.1N()>0){3c.3h(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).3h(\'4R\',A.N.7f)}}a.1h=P})}};A.fn.1U({jk:A.N.2l,jj:A.N.4v});A.2t=P;A.6J=H;A.31=P;A.6B=[];A.9L=C(e){F a=e.6S||e.6R||-1;if(a==17||a==16){A.6J=14}};A.9J=C(e){A.6J=H};A.eB=C(e){B.f.1A=A.12.3W(e);B.f.1I=A.1U(A.12.3a(B),A.12.2f(B));B.f.4p=A.12.5O(B);B.f.1A.x-=B.f.1I.x;B.f.1A.y-=B.f.1I.y;A(B).1L(A.2t.I(0));if(B.f.hc)A.2t.2H(B.f.hc).E(\'11\',\'2v\');A.2t.E({11:\'2v\',V:\'2G\',S:\'2G\'});if(B.f.o){A.2t.E(\'1E\',B.f.o)}A.31=B;A.7A=H;A.6B=[];B.f.el.1y(C(){B.1I={x:B.7Y+(B.4u&&!A.2R.6l?R(B.4u.4y)||0:0)+(A.31.2P||0),y:B.7t+(B.4u&&!A.2R.6l?R(B.4u.4x)||0:0)+(A.31.2T||0),1D:B.3P,hb:B.5r};if(B.s==14){if(A.6J==H){B.s=H;A(B).3S(A.31.f.71)}L{A.7A=14;A.6B[A.6B.1b]=A.1m(B,\'id\')}}});A.9H.1x(B,[e]);A(1c).1C(\'3t\',A.9H).1C(\'5n\',A.bI);G H};A.9H=C(e){if(!A.31)G;A.eA.1x(A.31,[e])};A.eA=C(e){if(!A.31)G;F a=A.12.3W(e);F b=A.12.5O(A.31);a.x+=b.l-B.f.4p.l-B.f.1I.x;a.y+=b.t-B.f.4p.t-B.f.1I.y;F c=Z.3k(a.x,B.f.1A.x);F d=Z.3k(Z.3B(a.x-B.f.1A.x),Z.3B(B.f.4p.w-c));F f=Z.3k(a.y,B.f.1A.y);F g=Z.3k(Z.3B(a.y-B.f.1A.y),Z.3B(B.f.4p.h-f));if(B.2T>0&&a.y-20<B.2T){F h=Z.3k(b.t,10);f-=h;g+=h;B.2T-=h}L if(B.2T+B.f.1I.h<B.f.4p.h&&a.y+20>B.2T+B.f.1I.h){F h=Z.3k(B.f.4p.h-B.2T,10);B.2T+=h;if(B.2T!=b.t)g+=h}if(B.2P>0&&a.x-20<B.2P){F h=Z.3k(b.l,10);c-=h;d+=h;B.2P-=h}L if(B.2P+B.f.1I.w<B.f.4p.w&&a.x+20>B.2P+B.f.1I.w){F h=Z.3k(B.f.4p.w-B.2P,10);B.2P+=h;if(B.2P!=b.l)d+=h}A.2t.E({M:c+\'Q\',O:f+\'Q\',V:d+\'Q\',S:g+\'Q\'});A.2t.l=c+B.f.4p.l;A.2t.t=f+B.f.4p.t;A.2t.r=A.2t.l+d;A.2t.b=A.2t.t+g;A.7A=H;B.f.el.1y(C(){9G=A.6B.3o(A.1m(B,\'id\'));if(!(B.1I.x>A.2t.r||(B.1I.x+B.1I.1D)<A.2t.l||B.1I.y>A.2t.b||(B.1I.y+B.1I.hb)<A.2t.t)){A.7A=14;if(B.s!=14){B.s=14;A(B).2H(A.31.f.71)}if(9G!=-1){B.s=H;A(B).3S(A.31.f.71)}}L if((B.s==14)&&(9G==-1)){B.s=H;A(B).3S(A.31.f.71)}L if((!B.s)&&(A.6J==14)&&(9G!=-1)){B.s=14;A(B).2H(A.31.f.71)}});G H};A.bI=C(e){if(!A.31)G;A.ez.1x(A.31,[e])};A.ez=C(e){A(1c).3h(\'3t\',A.9H).3h(\'5n\',A.bI);if(!A.31)G;A.2t.E(\'11\',\'1k\');if(B.f.hc)A.2t.3S(B.f.hc);A.31=H;A(\'23\').1L(A.2t.I(0));if(A.7A==14){if(B.f.8d)B.f.8d(A.bF(A.1m(B,\'id\')))}L{if(B.f.8c)B.f.8c(A.bF(A.1m(B,\'id\')))}A.6B=[]};A.bF=C(s){F h=\'\';F o=[];if(a=A(\'#\'+s)){a.I(0).f.el.1y(C(){if(B.s==14){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[o.1b]=A.1m(B,\'id\')}})}G{6A:h,o:o}};A.fn.jg=C(o){if(!A.2t){A(\'23\',1c).1L(\'<1W id="2t"></1W>\').1C(\'70\',A.9L).1C(\'5Q\',A.9J);A.2t=A(\'#2t\');A.2t.E({T:\'1J\',11:\'1k\'});if(1P.3N){A(\'23\',1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}L{A(1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}}if(!o){o={}}G B.1y(C(){if(B.ey)G;B.ey=14;B.f={a:o.3r,o:o.1E?2c(o.1E):H,71:o.ex?o.ex:H,hc:o.4G?o.4G:H,8d:o.8d?o.8d:H,8c:o.8c?o.8c:H};B.f.el=A(\'.\'+o.3r);A(B).1C(\'4R\',A.eB).E(\'T\',\'2i\')})};A.2Q={aT:1,ew:C(b){F b=b;G B.1y(C(){B.4g.69.1y(C(a){A.2Q.4s(B,b[a])})})},I:C(){F e=[];B.1y(C(b){if(B.bD){e[b]=[];F c=B;F d=A.12.2f(B);B.4g.69.1y(C(a){F x=B.7Y;F y=B.7t;7B=R(x*1Y/(d.w-B.3P));7C=R(y*1Y/(d.h-B.5r));e[b][a]=[7B||0,7C||0,x||0,y||0]})}});G e},ad:C(a){a.D.ep=a.D.1Z.w-a.D.1w.1D;a.D.eo=a.D.1Z.h-a.D.1w.hb;if(a.92.4g.bB){8Z=a.92.4g.69.I(a.bA+1);if(8Z){a.D.1Z.w=(R(A(8Z).E(\'M\'))||0)+a.D.1w.1D;a.D.1Z.h=(R(A(8Z).E(\'O\'))||0)+a.D.1w.hb}9f=a.92.4g.69.I(a.bA-1);if(9f){F b=R(A(9f).E(\'M\'))||0;F c=R(A(9f).E(\'M\'))||0;a.D.1Z.x+=b;a.D.1Z.y+=c;a.D.1Z.w-=b;a.D.1Z.h-=c}}a.D.ek=a.D.1Z.w-a.D.1w.1D;a.D.ej=a.D.1Z.h-a.D.1w.hb;if(a.D.2C){a.D.gx=((a.D.1Z.w-a.D.1w.1D)/a.D.2C)||1;a.D.gy=((a.D.1Z.h-a.D.1w.hb)/a.D.2C)||1;a.D.d1=a.D.ek/a.D.2C;a.D.d0=a.D.ej/a.D.2C}a.D.1Z.dx=a.D.1Z.x-a.D.22.x;a.D.1Z.dy=a.D.1Z.y-a.D.22.y;A.X.18.E(\'7z\',\'8T\')},3n:C(a,x,y){if(a.D.2C){d9=R(x/a.D.d1);7B=d9*1Y/a.D.2C;d5=R(y/a.D.d0);7C=d5*1Y/a.D.2C}L{7B=R(x*1Y/a.D.ep);7C=R(y*1Y/a.D.eo)}a.D.aa=[7B||0,7C||0,x||0,y||0];if(a.D.3n)a.D.3n.1x(a,a.D.aa)},d3:C(a){6K=a.6S||a.6R||-1;2X(6K){19 35:A.2Q.4s(B.3H,[91,91]);1n;19 36:A.2Q.4s(B.3H,[-91,-91]);1n;19 37:A.2Q.4s(B.3H,[-B.3H.D.gx||-1,0]);1n;19 38:A.2Q.4s(B.3H,[0,-B.3H.D.gy||-1]);1n;19 39:A.2Q.4s(B.3H,[B.3H.D.gx||1,0]);1n;19 40:A.X.4s(B.3H,[0,B.3H.D.gy||1]);1n}},4s:C(a,b){if(!a.D){G}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.49=A.E(a,\'T\');if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){a.Y.T=\'2i\'}A.X.ah(a);A.2Q.ad(a);dx=R(b[0])||0;dy=R(b[1])||0;2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.2C){57=A.X.a9.1x(a,[2n,2j,dx,dy]);if(57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy}57=A.X.ae.1x(a,[2n,2j,dx,dy]);if(57&&57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,2n,2j)}2n=!a.D.2g||a.D.2g==\'3Z\'?2n:a.D.22.x||0;2j=!a.D.2g||a.D.2g==\'3K\'?2j:a.D.22.y||0;a.Y.M=2n+\'Q\';a.Y.O=2j+\'Q\'},2l:C(o){G B.1y(C(){if(B.bD==14||!o.3r||!A.12||!A.X||!A.1s){G}4Y=A(o.3r,B);if(4Y.1N()==0){G}F b={2e:\'7X\',4P:14,3n:o.3n&&o.3n.1F==2w?o.3n:P,2I:o.2I&&o.2I.1F==2w?o.2I:P,3c:B,1E:o.1E||H};if(o.2C&&R(o.2C)){b.2C=R(o.2C)||1;b.2C=b.2C>0?b.2C:1}if(4Y.1N()==1)4Y.6r(b);L{A(4Y.I(0)).6r(b);b.3c=P;4Y.6r(b)}4Y.70(A.2Q.d3);4Y.1m(\'aT\',A.2Q.aT++);B.bD=14;B.4g={};B.4g.ec=b.ec;B.4g.2C=b.2C;B.4g.69=4Y;B.4g.bB=o.bB?14:H;by=B;by.4g.69.1y(C(a){B.bA=a;B.92=by});if(o.5f&&o.5f.1F==6h){1V(i=o.5f.1b-1;i>=0;i--){if(o.5f[i].1F==6h&&o.5f[i].1b==2){el=B.4g.69.I(i);if(el.4D){A.2Q.4s(el,o.5f[i])}}}}})}};A.fn.1U({jc:A.2Q.2l,jb:A.2Q.ew,ja:A.2Q.I});A.2p={56:[],ea:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},di:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d-1;1R=A(\'3O\',1d.J.4O);if(1u<1){1u=1d.J.1R.1b}1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},2A:C(c){1d=1c.7o(c);if(1d.J.63){1u=1d.J.3d;6k(1u==1d.J.3d){1u=1+R(Z.63()*1d.J.1R.1b)}}L{1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},go:C(o){F a;if(o&&o.1F==6E){if(o.21){a=1c.7o(o.21.1d);5v=1P.j8.2U.6W("#");o.21.5J=P;if(5v.1b==2){1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}L{1u=1}}if(o.84){o.84.4W();a=o.84.2S.2S;id=A.1m(a,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}5v=o.84.2U.6W("#");1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}if(a.J.1R.1b<1u||1u<1){1u=1}a.J.3d=1u;4t=A.12.2f(a);e4=A.12.9y(a);e3=A.12.6b(a);if(a.J.3e){a.J.3e.o.E(\'11\',\'1k\')}if(a.J.3b){a.J.3b.o.E(\'11\',\'1k\')}if(a.J.21){y=R(e4.t)+R(e3.t);if(a.J.1Q){if(a.J.1Q.4J==\'O\'){y+=a.J.1Q.45.hb}L{4t.h-=a.J.1Q.45.hb}}if(a.J.2o){if(a.J.2o&&a.J.2o.5V==\'O\'){y+=a.J.2o.45.hb}L{4t.h-=a.J.2o.45.hb}}if(!a.J.bu){a.J.e1=o.21?o.21.S:(R(a.J.21.E(\'S\'))||0);a.J.bu=o.21?o.21.V:(R(a.J.21.E(\'V\'))||0)}a.J.21.E(\'O\',y+(4t.h-a.J.e1)/2+\'Q\');a.J.21.E(\'M\',(4t.1D-a.J.bu)/2+\'Q\');a.J.21.E(\'11\',\'2v\')}1R=A(\'3O\',a.J.4O);if(1R.1N()>0){1R.6d(a.J.3F,A.2p.7J)}L{9w=A(\'a\',a.J.1Q.o).I(1u-1);A(9w).2H(a.J.1Q.5s);F b=W 8M();b.1d=A.1m(a,\'id\');b.1u=1u-1;b.2E=a.J.1R[a.J.3d-1].2E;if(b.1T){b.5J=P;A.2p.11.1x(b)}L{b.5J=A.2p.11}if(a.J.2o){a.J.2o.o.3i(a.J.1R[1u-1].5W)}}}},7J:C(){1d=B.2S.2S;1d.J.4O.E(\'11\',\'1k\');if(1d.J.1Q.5s){9w=A(\'a\',1d.J.1Q.o).3S(1d.J.1Q.5s).I(1d.J.3d-1);A(9w).2H(1d.J.1Q.5s)}F a=W 8M();a.1d=A.1m(1d,\'id\');a.1u=1d.J.3d-1;a.2E=1d.J.1R[1d.J.3d-1].2E;if(a.1T){a.5J=P;A.2p.11.1x(a)}L{a.5J=A.2p.11}if(1d.J.2o){1d.J.2o.o.3i(1d.J.1R[1d.J.3d-1].5W)}},11:C(){1d=1c.7o(B.1d);if(1d.J.3e){1d.J.3e.o.E(\'11\',\'1k\')}if(1d.J.3b){1d.J.3b.o.E(\'11\',\'1k\')}4t=A.12.2f(1d);y=0;if(1d.J.1Q){if(1d.J.1Q.4J==\'O\'){y+=1d.J.1Q.45.hb}L{4t.h-=1d.J.1Q.45.hb}}if(1d.J.2o){if(1d.J.2o&&1d.J.2o.5V==\'O\'){y+=1d.J.2o.45.hb}L{4t.h-=1d.J.2o.45.hb}}j4=A(\'.bt\',1d);y=y+(4t.h-B.S)/2;x=(4t.1D-B.V)/2;1d.J.4O.E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').3i(\'<3O 2E="\'+B.2E+\'" />\');1d.J.4O.6U(1d.J.3F);3b=1d.J.3d+1;if(3b>1d.J.1R.1b){3b=1}3e=1d.J.3d-1;if(3e<1){3e=1d.J.1R.1b}1d.J.3b.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+2*B.V/3+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3b-1].5W);1d.J.3b.o.I(0).2U=\'#\'+3b+A.1m(1d,\'id\');1d.J.3e.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3e-1].5W);1d.J.3e.o.I(0).2U=\'#\'+3e+A.1m(1d,\'id\')},2l:C(o){if(!o||!o.2q||A.2p.56[o.2q])G;F a=A(\'#\'+o.2q);F c=a.I(0);if(c.Y.T!=\'1J\'&&c.Y.T!=\'2i\'){c.Y.T=\'2i\'}c.Y.2N=\'2B\';if(a.1N()==0)G;c.J={};c.J.1R=o.1R?o.1R:[];c.J.63=o.63&&o.63==14||H;7T=c.dj(\'j3\');1V(i=0;i<7T.1b;i++){6e=c.J.1R.1b;c.J.1R[6e]={2E:7T[i].2E,5W:7T[i].3T||7T[i].j2||\'\'}}if(c.J.1R.1b==0){G}c.J.49=A.1U(A.12.3a(c),A.12.2f(c));c.J.bp=A.12.9y(c);c.J.bo=A.12.6b(c);t=R(c.J.bp.t)+R(c.J.bo.t);b=R(c.J.bp.b)+R(c.J.bo.b);A(\'3O\',c).9U();c.J.3F=o.3F?o.3F:ch;if(o.4J||o.82||o.5s){c.J.1Q={};a.1L(\'<1W 68="dZ"></1W>\');c.J.1Q.o=A(\'.dZ\',c);if(o.82){c.J.1Q.82=o.82;c.J.1Q.o.2H(o.82)}if(o.5s){c.J.1Q.5s=o.5s}c.J.1Q.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.4J&&o.4J==\'O\'){c.J.1Q.4J=\'O\';c.J.1Q.o.E(\'O\',t+\'Q\')}L{c.J.1Q.4J=\'4e\';c.J.1Q.o.E(\'4e\',b+\'Q\')}c.J.1Q.9v=o.9v?o.9v:\' \';1V(F i=0;i<c.J.1R.1b;i++){6e=R(i)+1;c.J.1Q.o.1L(\'<a 2U="#\'+6e+o.2q+\'" 68="iY" 3T="\'+c.J.1R[i].5W+\'">\'+6e+\'</a>\'+(6e!=c.J.1R.1b?c.J.1Q.9v:\'\'))}A(\'a\',c.J.1Q.o).1C(\'4U\',C(){A.2p.go({84:B})});c.J.1Q.45=A.12.2f(c.J.1Q.o.I(0))}if(o.5V||o.81){c.J.2o={};a.1L(\'<1W 68="dW">&6G;</1W>\');c.J.2o.o=A(\'.dW\',c);if(o.81){c.J.2o.81=o.81;c.J.2o.o.2H(o.81)}c.J.2o.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.5V&&o.5V==\'O\'){c.J.2o.5V=\'O\';c.J.2o.o.E(\'O\',(c.J.1Q&&c.J.1Q.4J==\'O\'?c.J.1Q.45.hb+t:t)+\'Q\')}L{c.J.2o.5V=\'4e\';c.J.2o.o.E(\'4e\',(c.J.1Q&&c.J.1Q.4J==\'4e\'?c.J.1Q.45.hb+b:b)+\'Q\')}c.J.2o.45=A.12.2f(c.J.2o.o.I(0))}if(o.9j){c.J.3b={9j:o.9j};a.1L(\'<a 2U="#2\'+o.2q+\'" 68="dV">&6G;</a>\');c.J.3b.o=A(\'.dV\',c);c.J.3b.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3b.9j);c.J.3b.o.1C(\'4U\',A.2p.ea)}if(o.9t){c.J.3e={9t:o.9t};a.1L(\'<a 2U="#0\'+o.2q+\'" 68="dS">&6G;</a>\');c.J.3e.o=A(\'.dS\',c);c.J.3e.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3e.9t);c.J.3e.o.1C(\'4U\',A.2p.di)}a.aJ(\'<1W 68="bt"></1W>\');c.J.4O=A(\'.bt\',c);c.J.4O.E(\'T\',\'1J\').E(\'O\',\'2G\').E(\'M\',\'2G\').E(\'11\',\'1k\');if(o.21){a.aJ(\'<1W 68="dz" Y="11: 1k;"><3O 2E="\'+o.21+\'" /></1W>\');c.J.21=A(\'.dz\',c);c.J.21.E(\'T\',\'1J\');F d=W 8M();d.1d=o.2q;d.2E=o.21;if(d.1T){d.5J=P;A.2p.go({21:d})}L{d.5J=C(){A.2p.go({21:B})}}}L{A.2p.go({2q:c})}if(o.ba){dQ=R(o.ba)*8V}A.2p.56[o.2q]=o.ba?1P.5Y(\'A.2p.2A(\\\'\'+o.2q+\'\\\')\',dQ):P}};A.1d=A.2p.2l;A.1p={73:[],54:{},18:H,6X:P,2b:C(){if(A.X.1g==P){G}F a,3s,c,cs;A.1p.18.I(0).2Z=A.X.1g.D.5z;a=A.1p.18.I(0).Y;a.11=\'2v\';A.1p.18.1w=A.1U(A.12.3a(A.1p.18.I(0)),A.12.2f(A.1p.18.I(0)));a.V=A.X.1g.D.1w.1D+\'Q\';a.S=A.X.1g.D.1w.hb+\'Q\';3s=A.12.b2(A.X.1g);a.4M=3s.t;a.53=3s.r;a.4L=3s.b;a.4K=3s.l;if(A.X.1g.D.3L==14){c=A(A.X.1g).cA(14).I(0);cs=c.Y;cs.4M=\'2G\';cs.53=\'2G\';cs.4L=\'2G\';cs.4K=\'2G\';cs.11=\'2v\';A.1p.18.58().1L(c)}A(A.X.1g).dO(A.1p.18.I(0));A.X.1g.Y.11=\'1k\'},c7:C(e){if(!e.D.3I&&A.1s.4T.bC){if(e.D.3C)e.D.3C.1x(1g);A(e).E(\'T\',e.D.av||e.D.49);A(e).8j();A(A.1s.4T).dN(e)}A.1p.18.3S(e.D.5z).3i(\'&6G;\');A.1p.6X=P;F a=A.1p.18.I(0).Y;a.11=\'1k\';A.1p.18.dO(e);if(e.D.fx>0){A(e).6U(e.D.fx)}A(\'23\').1L(A.1p.18.I(0));F b=[];F c=H;1V(F i=0;i<A.1p.73.1b;i++){F d=A.1s.3p[A.1p.73[i]].I(0);F f=A.1m(d,\'id\');F g=A.1p.8g(f);if(d.1f.9P!=g.6A){d.1f.9P=g.6A;if(c==H&&d.1f.2I){c=d.1f.2I}g.id=f;b[b.1b]=g}}A.1p.73=[];if(c!=H&&b.1b>0){c(b)}},8n:C(e,o){if(!A.X.1g)G;F a=H;F i=0;if(e.1f.el.1N()>0){1V(i=e.1f.el.1N();i>0;i--){if(e.1f.el.I(i-1)!=A.X.1g){if(!e.5t.bb){if((e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}L{1n}}L{if((e.1f.el.I(i-1).1I.x+e.1f.el.I(i-1).1I.1D/2)>A.X.1g.D.2n&&(e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}}}}}if(a&&A.1p.6X!=a){A.1p.6X=a;A(a).iT(A.1p.18.I(0))}L if(!a&&(A.1p.6X!=P||A.1p.18.I(0).2S!=e)){A.1p.6X=P;A(e).1L(A.1p.18.I(0))}A.1p.18.I(0).Y.11=\'2v\'},bM:C(e){if(A.X.1g==P){G}e.1f.el.1y(C(){B.1I=A.1U(A.12.6w(B),A.12.6x(B))})},8g:C(s){F i;F h=\'\';F o={};if(s){if(A.1p.54[s]){o[s]=[];A(\'#\'+s+\' .\'+A.1p.54[s]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[s][o[s].1b]=A.1m(B,\'id\')})}L{1V(a in s){if(A.1p.54[s[a]]){o[s[a]]=[];A(\'#\'+s[a]+\' .\'+A.1p.54[s[a]]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s[a]+\'[]=\'+A.1m(B,\'id\');o[s[a]][o[s[a]].1b]=A.1m(B,\'id\')})}}}}L{1V(i in A.1p.54){o[i]=[];A(\'#\'+i+\' .\'+A.1p.54[i]).1y(C(){if(h.1b>0){h+=\'&\'}h+=i+\'[]=\'+A.1m(B,\'id\');o[i][o[i].1b]=A.1m(B,\'id\')})}}G{6A:h,o:o}},dL:C(e){if(!e.ci){G}G B.1y(C(){if(!B.5t||!A(e).is(\'.\'+B.5t.3r))A(e).2H(B.5t.3r);A(e).6r(B.5t.D)})},4v:C(){G B.1y(C(){A(\'.\'+B.5t.3r).8j();A(B).ei();B.5t=P;B.dK=P})},2l:C(o){if(o.3r&&A.12&&A.X&&A.1s){if(!A.1p.18){A(\'23\',1c).1L(\'<1W id="dJ">&6G;</1W>\');A.1p.18=A(\'#dJ\');A.1p.18.I(0).Y.11=\'1k\'}B.ee({3r:o.3r,9F:o.9F?o.9F:H,8X:o.8X?o.8X:H,4G:o.4G?o.4G:H,76:o.76||o.ev,6C:o.6C||o.er,bC:14,2I:o.2I||o.iR,fx:o.fx?o.fx:H,3L:o.3L?14:H,5T:o.5T?o.5T:\'9S\'});G B.1y(C(){F a={5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,4c:o.4c&&o.4c.1F==2w?o.4c:H,4h:o.4h&&o.4h.1F==2w?o.4h:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:H,2M:o.2M?o.2M:H};A(\'.\'+o.3r,B).6r(a);B.dK=14;B.5t={3r:o.3r,5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,bb:o.bb?14:H,D:a}})}}};A.fn.1U({iP:A.1p.2l,dN:A.1p.dL,iO:A.1p.4v});A.iN=A.1p.8g;A.2k={62:P,9o:H,9p:P,6a:C(e){A.2k.9o=14;A.2k.1S(e,B,14)},bk:C(e){if(A.2k.62!=B)G;A.2k.9o=H;A.2k.2x(e,B)},1S:C(e,a,b){if(A.2k.62!=P)G;if(!a){a=B}A.2k.62=a;1I=A.1U(A.12.3a(a),A.12.2f(a));7U=A(a);3T=7U.1m(\'3T\');2U=7U.1m(\'2U\');if(3T){A.2k.9p=3T;7U.1m(\'3T\',\'\');A(\'#dE\').3i(3T);if(2U)A(\'#bj\').3i(2U.48(\'iI://\',\'\'));L A(\'#bj\').3i(\'\');18=A(\'#7S\');if(a.4m.2Z){18.I(0).2Z=a.4m.2Z}L{18.I(0).2Z=\'\'}bi=A.12.2f(18.I(0));dD=b&&a.4m.T==\'bn\'?\'4e\':a.4m.T;2X(dD){19\'O\':2j=1I.y-bi.hb;2n=1I.x;1n;19\'M\':2j=1I.y;2n=1I.x-bi.1D;1n;19\'2D\':2j=1I.y;2n=1I.x+1I.1D;1n;19\'bn\':A(\'23\').1C(\'3t\',A.2k.3t);1A=A.12.3W(e);2j=1A.y+15;2n=1A.x+15;1n;8T:2j=1I.y+1I.hb;2n=1I.x;1n}18.E({O:2j+\'Q\',M:2n+\'Q\'});if(a.4m.4w==H){18.1S()}L{18.6U(a.4m.4w)}if(a.4m.2K)a.4m.2K.1x(a);7U.1C(\'86\',A.2k.2x).1C(\'4W\',A.2k.bk)}},3t:C(e){if(A.2k.62==P){A(\'23\').3h(\'3t\',A.2k.3t);G}1A=A.12.3W(e);A(\'#7S\').E({O:1A.y+15+\'Q\',M:1A.x+15+\'Q\'})},2x:C(e,a){if(!a){a=B}if(A.2k.9o!=14&&A.2k.62==a){A.2k.62=P;A(\'#7S\').6d(1);A(a).1m(\'3T\',A.2k.9p).3h(\'86\',A.2k.2x).3h(\'4W\',A.2k.bk);if(a.4m.2V)a.4m.2V.1x(a);A.2k.9p=P}},2l:C(b){if(!A.2k.18){A(\'23\').1L(\'<1W id="7S"><1W id="dE"></1W><1W id="bj"></1W></1W>\');A(\'#7S\').E({T:\'1J\',3j:5P,11:\'1k\'});A.2k.18=14}G B.1y(C(){if(A.1m(B,\'3T\')){B.4m={T:/O|4e|M|2D|bn/.3M(b.T)?b.T:\'4e\',2Z:b.2Z?b.2Z:H,4w:b.4w?b.4w:H,2K:b.2K&&b.2K.1F==2w?b.2K:H,2V:b.2V&&b.2V.1F==2w?b.2V:H};F a=A(B);a.1C(\'9r\',A.2k.1S);a.1C(\'6a\',A.2k.6a)}})}};A.fn.iH=A.2k.2l;A.7O={bl:C(e){6K=e.6S||e.6R||-1;if(6K==9){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(B.9q){1c.64.dv().3D="\\t";B.dB=C(){B.6a();B.dB=P}}L if(B.9m){2b=B.88;3m=B.dA;B.2m=B.2m.iG(0,2b)+"\\t"+B.2m.iF(3m);B.9m(2b+1,2b+1);B.6a()}G H}},4v:C(){G B.1y(C(){if(B.6V&&B.6V==14){A(B).3h(\'70\',A.7O.bl);B.6V=H}})},2l:C(){G B.1y(C(){if(B.4D==\'bs\'&&(!B.6V||B.6V==H)){A(B).1C(\'70\',A.7O.bl);B.6V=14}})}};A.fn.1U({iD:A.7O.2l,iC:A.7O.4v});A.12={3a:C(e){F x=0;F y=0;F a=e.Y;F b=H;if(A(e).E(\'11\')==\'1k\'){F c=a.2W;F d=a.T;b=14;a.2W=\'2B\';a.11=\'2v\';a.T=\'1J\'}F f=e;6k(f){x+=f.7Y+(f.4u&&!A.2R.6l?R(f.4u.4y)||0:0);y+=f.7t+(f.4u&&!A.2R.6l?R(f.4u.4x)||0:0);f=f.dY}f=e;6k(f&&f.4D&&f.4D.5u()!=\'23\'){x-=f.2P||0;y-=f.2T||0;f=f.2S}if(b==14){a.11=\'1k\';a.T=d;a.2W=c}G{x:x,y:y}},6x:C(a){F x=0,y=0;6k(a){x+=a.7Y||0;y+=a.7t||0;a=a.dY}G{x:x,y:y}},2f:C(e){F w=A.E(e,\'V\');F h=A.E(e,\'S\');F a=0;F b=0;F c=e.Y;if(A(e).E(\'11\')!=\'1k\'){a=e.3P;b=e.5r}L{F d=c.2W;F f=c.T;c.2W=\'2B\';c.11=\'2v\';c.T=\'1J\';a=e.3P;b=e.5r;c.11=\'1k\';c.T=f;c.2W=d}G{w:w,h:h,1D:a,hb:b}},6w:C(a){G{1D:a.3P||0,hb:a.5r||0}},a5:C(e){F h,w,de;if(e){w=e.83;h=e.7P}L{de=1c.4A;w=1P.bg||9z.bg||(de&&de.83)||1c.23.83;h=1P.bf||9z.bf||(de&&de.7P)||1c.23.7P}G{w:w,h:h}},5O:C(e){F t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.98.5u()!=\'23\'){t=e.2T;l=e.2P;w=e.be;h=e.bd;iw=0;ih=0}L{if(1c.4A){t=1c.4A.2T;l=1c.4A.2P;w=1c.4A.be;h=1c.4A.bd}L if(1c.23){t=1c.23.2T;l=1c.23.2P;w=1c.23.be;h=1c.23.bd}iw=9z.bg||1c.4A.83||1c.23.83||0;ih=9z.bf||1c.4A.7P||1c.23.7P||0}G{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},b2:C(e,a){F c=A(e);F t=c.E(\'4M\')||\'\';F r=c.E(\'53\')||\'\';F b=c.E(\'4L\')||\'\';F l=c.E(\'4K\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},9y:C(e,a){F c=A(e);F t=c.E(\'5b\')||\'\';F r=c.E(\'5g\')||\'\';F b=c.E(\'4Q\')||\'\';F l=c.E(\'4F\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},6b:C(e,a){F c=A(e);F t=c.E(\'4x\')||\'\';F r=c.E(\'5i\')||\'\';F b=c.E(\'5d\')||\'\';F l=c.E(\'4y\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)||0};L G{t:t,r:r,b:b,l:l}},3W:C(a){F x=a.iB||(a.iz+(1c.4A.2P||1c.23.2P))||0;F y=a.iy||(a.ix+(1c.4A.2T||1c.23.2T))||0;G{x:x,y:y}},bH:C(a,b){b(a);a=a.6M;6k(a){A.12.bH(a,b);a=a.iv}},ji:C(c){A.12.bH(c,C(a){1V(F b in a){if(28 a[b]===\'C\'){a[b]=P}}})},ir:C(a,b){F c=A.12.5O();F d=A.12.2f(a);if(!b||b==\'3K\')A(a).E({O:c.t+((Z.3g(c.h,c.ih)-c.t-d.hb)/2)+\'Q\'});if(!b||b==\'3Z\')A(a).E({M:c.l+((Z.3g(c.w,c.iw)-c.l-d.1D)/2)+\'Q\'})},iq:C(a,b){F c=A(\'3O[@2E*="7q"]\',a||1c),7q;c.1y(C(){7q=B.2E;B.2E=b;B.Y.4X="9x:9C.9E.ip(2E=\'"+7q+"\')"})}};[].3o||(6h.jn.3o=C(v,n){n=(n==P)?0:n;F m=B.1b;1V(F i=n;i<m;i++)if(B[i]==v)G i;G-1});',62,1202,'||||||||||||||||||||||||||||||||||||jQuery|this|function|dragCfg|css|var|return|false|get|ss|iAuto|else|left|iResize|top|null|px|parseInt|height|position|oldStyle|width|new|iDrag|style|Math||display|iUtil||true||||helper|case|autoCFG|length|document|slideshow|easing|dropCfg|dragged|resizeOptions|carouselCfg|interfaceFX|none|speed|attr|break|sizes|iSort|ImageBox|queue|iDrop|iAutoscroller|slide|resizeElement|oC|apply|each|fisheyeCfg|pointer|newSizes|bind|wb|opacity|constructor|custom|duration|pos|absolute|type|append|items|size|255|window|slideslinks|images|show|complete|extend|for|div|elsToScroll|100|cont||loader|oR|body|options||oldP||typeof|callback|accordionCfg|start|parseFloat||containment|getSize|axis|selectedItem|relative|ny|iTooltip|build|value|nx|slideCaption|islideshow|container|subject|newPosition|selectHelper|border|block|Function|hide|itemWidth|dequeue|timer|hidden|fractions|right|src|PI|0px|addClass|onChange|parentData|onShow|result|cursorAt|overflow|transferHelper|scrollLeft|iSlider|browser|parentNode|scrollTop|href|onHide|visibility|switch|wrapper|className|pre|selectdrug|||||||||getPosition|nextslide|handle|currentslide|prevslide|step|max|unbind|html|zIndex|min|iExpander|end|onSlide|indexOf|zones|iframe|accept|margins|mousemove|canvas|to|item|createElement|multipleSeparator|highlighted|resizeDirection|abs|onStop|text|toggle|fadeDuration|handlers|dragElem|so|distance|vertically|ghosting|test|event|img|offsetWidth|startLeft|pageSize|removeClass|title|out|startTop|getPointer|lastSuggestion|DropOutDirectiont|horizontally||down||nWidth|ratio|dimm|msie||replace|oP|fontSize|lastValue|onStart|currentPointer|bottom|ifxFirstDisplay|slideCfg|onDrag|clear|context|elToScroll|up|tooltipCFG|fxCheckTag|rel|scr|onclick|endLeft|dragmoveBy|slidePos|currentStyle|destroy|delay|borderTopWidth|borderLeftWidth|nHeight|documentElement|string|containerW|tagName|iteration|paddingLeft|helperclass|endTop|halign|linksPosition|marginLeft|marginBottom|marginTop|OpenClose|holder|si|paddingBottom|mousedown|animate|overzone|click|onDragModifier|blur|filter|toDrag|getAttribute||cos|cnt|marginRight|collected||slideshows|newCoords|empty|containerH|elementData|paddingTop|puff|borderBottomWidth|animationHandler|values|paddingRight|clearInterval|borderRightWidth|pow|dragHandle|BlindDirection|post|mouseup|close|onSelect|fxh|offsetHeight|activeLinkClass|sortCfg|toLowerCase|url|currentPanel|point|grid|hpc|currentRel|revert|captionText|snapDistance|Scale|nextImage|prevImage|imageEl|orig|onload|iFisheye|parseColor|getHeight|getWidth|getScroll|3000|keyup|maxWidth|curCSS|tolerance|reflections|captionPosition|caption|margin|setInterval|outerContainer||itemHeight|current|random|selection|limit|Expander|128|class|sliders|focus|getBorder|newTop|fadeOut|indic|user|init|Array|frameClass|ActiveXObject|while|opera|from|open|oD|Date|proximity|Draggable|0x|F0|minLeft|rgb|getSizeLite|getPositionLite|getTime|positionItems|hash|selectCurrent|onOut|onClick|Object|minTop|nbsp|onHighlight|np|selectKeyHelper|pressedKey|accordionPos|firstChild|139|scrollIntoView|backgroundColor|oldStyleAttr|keyCode|charCode|direction|fadeIn|hasTabsEnabled|split|inFrontOf|radiusY|captionEl|keydown|sc|selectClass|changed|times||onHover|newLeft||efx|nw|li|maxRight|maxBottom|classname|startDrag|move|ImageBoxNextImage|nRx|ImageBoxPrevImage|nRy|opened|animationInProgress|400|getElementById|count|png|overlay|alpha|offsetTop|containerSize|cssSides|stop|minHeight|maxHeight|cursor|selectedone|xproc|yproc|bounceout|padding|gallery|increment|namedColors|applyOn|showImage|reflectionSize|sin|object|directionIncrement|iTTabs|clientHeight|select|activeClass|tooltipHelper|imgs|jEl|insideParent|content|parent|offsetLeft|parentBorders||captionClass|linksClass|clientWidth|link||mouseout|fontWeight|selectionStart|expand|panels|createTextNode|onselectstop|onselect|hight|elS|serialize|dir|diffHeight|DraggableDestroy|nextImageEl|prevImageEl|ImageBoxOuterContainer|checkhover|blind|iCarousel|hideImage|hidehelper|diffWidth|String|sl|st|prot|auto|diffY|diffX|headers|rule|getFieldValues|styleSheets|borderColor|positionContainer|image|getValues|dragstop|linkRel|itemsText|isDraggable|Image|minchars|minWidth|panelSelector|exec|192|isDroppable|default|211|1000|5625|hoverclass|headerSelector|next|ul|2000|SliderContainer|protectRotation|childs|oldVisibility|source|setTimeout|nodeName|stopPropagation|startTime|preventDefault|hoverClass|cssText|1px|prev|unfold|DoFold|unit|nextslideClass|multiple|itemMinWidth|setSelectionRange|destroyWrapper|focused|oldTitle|createTextRange|mouseover|inCache|prevslideClass|buildWrapper|linksSeparator|lnk|progid|getPadding|self|ScrollTo|9999|DXImageTransform|helperClass|Microsoft|activeclass|iIndex|selectcheck|onDrop|selectKeyUp|autofill|selectKeyDown|panelHeight|handleEl|onActivate|os|ne|sw|intersect|dragEl|remove|data|textAlign|ImageBoxCaption|closeEl|captionImages|ImageBoxOverlay|ImageBoxIframe|clearTimeout|keyPressed|fade|getClient|Alpha|shake|Shake|snapToGrid|lastSi|scroll||modifyContainer|fitToContainer|currentValue|zoom|getContainment|firstStep|paddingLeftSize|paddingBottomSize|paddingRightSize|paddingTopSize|borderLeftSize|borderBottomSize|borderRightSize|borderTopSize|autoSize|shrink|pulse|Pulsate|initialPosition|imageSrc|parseStyle|sliderPos|center|ImageBoxCurrentImage|loadImage|parentPos|match|dragmove|stopAnim|pause|Color|unselectable|prepend|borderWidth|cssSidesEnd|draginit|stopDrag|moveDrag|asin|bouncein|paddingY|paddingX|tabindex|writeItems|INPUT|10000|169|index|sliderSize|no|linear|getMargins|spacer|rotationSpeed|returnValue|cancelBubble|transparent|angle|autocomplete|autoplay|floats|extraWidth|scrollHeight|scrollWidth|innerHeight|innerWidth|character|helperSize|tooltipURL|hidefocused|doTab|Number|mouse|oBor|oPad|entities||TEXTAREA|slideshowHolder|loaderWidth|inputWidth|RegExp|letterSpacing|sliderEl|300|SliderIteration|restricted|sortable|isSlider|bounce|Selectserialize|idsa|traverseDOM|selectstop|elm|elPosition|restore|measure|getHeightMinMax|onDragStart|fit|clientSize|field|fadeTo|ImageBoxContainer|on|listStyle|ImageBoxLoader|dragHelper|ImageBoxCaptionImages|getContext|ImageBoxCaptionText|update|imagebox|BlindUp|hrefAttr|relAttr|SlideOutUp|check|checkdrop|textImageFrom|textImage|overlayOpacity|jpg|closeHTML|gif|loaderSRC|imageTypes|500|childNodes|itransferTo|highlight|visible|horizontal|vertical|parts|paddingLeftUnit|paddingBottomUnit|paddingRightUnit||paddingTopUnit|borderLeftUnit|borderBottomUnit|borderRightUnit|borderTopUnit|fontUnit|grow|clone|sqrt|textDecoration|dragstart|trim|isFunction|valign|userSelect|fxe|KhtmlUserSelect|Width|captionSize|dhe|colorCssProps|onDragStop|iAccordion|cssProps|doScroll|144|224|230|keypress|off|150|140|107|fracH|fracW|easeout|dragmoveByKey|autocompleteHelper|yfrac|165|scrolling|radiusX|xfrac|frameborder|245|javascript|240||autocompleteIframe|999|protect|goprev|getElementsByTagName|styleFloat||parte|insertBefore|itemZIndex|interfaceColorFX|fold|mousex|leftUnit|topUnit|fakeAccordionClass|createRange|getSelectionStart|||slideshowLoader|selectionEnd|onblur|moveStart|filteredPosition|tooltipTitle|togglehor|togglever|inputValue|zindex|sortHelper|isSortable|addItem|checkCache|SortableAddItem|after|BlindDown|time|SlideInUp|slideshowPrevslide|elType|30px|slideshowNextSlide|slideshowCaption|expanderHelper|offsetParent|slideshowLinks|boxModel|loaderHeight||slideBor|slidePad|htmlEntities|wordSpacing|fontVariant|fontStretch|fontStyle|gonext|fontFamily|onslide|clickItem|Droppable||rgba||DroppableDestroy|maxy|maxx|||hoverItem|containerMaxy|containerMaxx||onout|addColorStop||iBounce|onhover|set|selectedclass|isSelectable|selectstopApply|selectcheckApply|selectstart|shc|360|directions|remeasure|onResize|se|array|scale|success|param|translate|POST|number|load|ajax|save|name|khtml|moz|find|ondragstart|onselectstart|lineHeigt|mozUserSelect|ImageBoxClose|bmp|jpeg|finishx|112|starty|first|last|firstResize|startx|imageLoaded|Showing|finishOpacity|110|Accordion|loading|TransferTo|SlideToggleRight|SlideOutRight|SlideInRight|SlideToggleLeft|SlideOutLeft|SlideInLeft||SlideToggleDown|SlideOutDown|SlideInDown|SlideToggleUp|scrollTo|ScrollToAnchors|flipv|pt|Puff||Shrink|Fisheye||Grow|OpenHorizontally|OpenVertically|SwitchVertically|SwitchHorizontally|CloseHorizontally|CloseVertically|toUpperCase|100000000|selectorText|rules|cssRules|borderStyle|outset|inset|ridge|resize|groove|double|solid|dashed|dotted|isNaN|fromHandler|stopAll|MozUserSelect|Left|Bottom|Right|Top|outlineColor|color|borderTopColor|borderRightColor|borderLeftColor|borderBottomColor|textIndent|outlineWidth|elasticboth|outlineOffset|wh|elasticout|lineHeight|yellow|white|silver|red|purple|203||pink|orange|olive|navy||maroon|magenta|lime|||elasticin|lightyellow|193|182|lightpink|bounceboth|lightgrey|238|lightgreen|lightcyan|Autocomplete|216|173|200|984375|lightblue|khaki|130|625|indigo|green|215|9375|gold|fuchsia|148|darkviolet|122|233|darksalmon|darkred|204|153|darkorchid|darkorange|30002|list|darkolivegreen|||darkmagenta|183|189|darkkhaki|easeboth|darkgreen|30001|darkgrey|darkcyan|darkblue|cyan|easein|brown|blue||black|hover|220|beige|azure|aqua|appendChild|cssFloat|fxWrapper|ol|table|fix|form|button|nodeValue|textarea|input|w_|float|Carousel|removeChild|meta|optgroup|option|frameset|frame|script|header|th|colgroup|col|tfoot|thead|tbody|td|tr|Highlight|FoldToggle|UnFold|Fold|DropToggleRight|DropInRight|DropOutRight|DropToggleLeft|DropInLeft|DropOutLeft|DropToggleUp||DropInUp||DropOutUp||DropToggleDown|100000|DropInDown|duplicate|DropOutDown||120|AlphaImageLoader|fixPNG|centerEl||rotationTimer|maxRotation|nextSibling||clientY|pageY|clientX|Bounce|pageX|DisableTabs|EnableTabs|moveEnd|substr|substring|ToolTip|http|collapse|BlindToggleHorizontally|BlindRight|BlindLeft|SortSerialize|SortableDestroy|Sortable|BlindToggleVertically|onchange|fillRect|before|Autoexpand|fill|password|WebKit|slideshowLink|quot|lt|amp|alt|IMG|par|appVersion|pW|navigator|location|fillStyle|SliderGetValues|SliderSetValues|Slider|recallDroppables|ondrop|createLinearGradient|Selectable|destination|purgeEvents|ResizableDestroy|Resizable|globalCompositeOperation|drawImage|prototype'.split('|'),0,{}));
index 06c214b5af3358d5d03c10681d72f2348072932b..00999f685a75edbe60c5970ec3b8616cfdcaba63 100644 (file)
-/*
- * jQuery JavaScript Library v1.3.2
+/*!
+ * jQuery JavaScript Library v1.4.2
  * http://jquery.com/
  *
- * Copyright (c) 2009 John Resig
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
- * Revision: 6246
- */
-(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
-/*
- * Sizzle CSS Selector Engine - v0.9.3
- *  Copyright 2009, The Dojo Foundation
- *  Released under the MIT, BSD, and GPL Licenses.
- *  More information: http://sizzlejs.com/
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Sat Feb 13 22:33:48 2010 -0500
  */
-(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
-jQuery.noConflict();
+(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
+e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
+j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
+"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
+true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
+Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
+(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
+a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
+"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
+function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
+c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
+L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
+"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
+d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
+a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
+!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
+true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
+parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
+s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
+applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
+else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
+a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
+w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
+cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
+i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
+" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
+this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
+e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
+function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
+k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
+C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
+null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
+e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
+f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
+if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
+"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
+a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
+isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
+{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
+if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
+e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
+"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
+d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
+!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
+toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
+u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
+function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
+if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
+t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
+g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
+for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
+1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
+relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
+l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
+h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
+CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
+g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
+text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
+setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
+h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
+m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
+"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
+h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
+!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
+h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
+q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
+if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
+(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
+function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
+gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
+c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
+{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
+"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
+d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
+a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
+1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
+a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
+""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
+this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
+u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
+1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
+return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
+""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
+c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
+c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
+function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
+Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
+"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
+a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
+a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
+"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
+serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
+function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
+e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
+"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
+false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
+false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
+c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
+d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
+g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
+1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
+"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
+if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
+this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
+"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
+animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
+j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
+this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
+"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
+c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
+this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
+e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
+c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
+function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
+this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
+k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
+f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
+d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
+f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
+"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);jQuery.noConflict();
index e76c811ef78c90685c7c10145f26dee10d1758d9..7f46cbc643f4b1e070489082025d2762482a16e0 100644 (file)
                        if ( options.multiple ) {
                                multipleSepPos = q.lastIndexOf(options.multipleSep);
                                if ( multipleSepPos != -1 ) {
-                                       q = q.substr(multipleSepPos + options.multipleSep.length);
+                                       q = $.trim(q.substr(multipleSepPos + options.multipleSep.length));
                                }
                        }
                        if (q.length >= options.minchars) {
index bc3c90688bf8c5b1c9865148acf33e1ad106c699..5e15c430e2b1b252e31a179197a2ab8f75a55e42 100644 (file)
@@ -1 +1 @@
-(function(a){a.suggest=function(o,g){var c,f,n,d,q,p;c=a(o).attr("autocomplete","off");f=a(document.createElement("ul"));n=false;d=0;q=[];p=0;f.addClass(g.resultsClass).appendTo("body");j();a(window).load(j).resize(j);c.blur(function(){setTimeout(function(){f.hide()},200)});if(a.browser.msie){try{f.bgiframe()}catch(s){}}if(a.browser.mozilla){c.keypress(m)}else{c.keydown(m)}function j(){var e=c.offset();f.css({top:(e.top+o.offsetHeight)+"px",left:e.left+"px"})}function m(w){if((/27$|38$|40$/.test(w.keyCode)&&f.is(":visible"))||(/^13$|^9$/.test(w.keyCode)&&u())){if(w.preventDefault){w.preventDefault()}if(w.stopPropagation){w.stopPropagation()}w.cancelBubble=true;w.returnValue=false;switch(w.keyCode){case 38:k();break;case 40:t();break;case 9:case 13:r();break;case 27:f.hide();break}}else{if(c.val().length!=d){if(n){clearTimeout(n)}n=setTimeout(l,g.delay);d=c.val().length}}}function l(){var x=a.trim(c.val()),w,e;if(g.multiple){w=x.lastIndexOf(g.multipleSep);if(w!=-1){x=x.substr(w+g.multipleSep.length)}}if(x.length>=g.minchars){cached=v(x);if(cached){i(cached.items)}else{a.get(g.source,{q:x},function(y){f.hide();e=b(y,x);i(e);h(x,e,y.length)})}}else{f.hide()}}function v(w){var e;for(e=0;e<q.length;e++){if(q[e]["q"]==w){q.unshift(q.splice(e,1)[0]);return q[0]}}return false}function h(y,e,w){var x;while(q.length&&(p+w>g.maxCacheSize)){x=q.pop();p-=x.size}q.push({q:y,size:w,items:e});p+=w}function i(e){var x="",w;if(!e){return}if(!e.length){f.hide();return}j();for(w=0;w<e.length;w++){x+="<li>"+e[w]+"</li>"}f.html(x).show();f.children("li").mouseover(function(){f.children("li").removeClass(g.selectClass);a(this).addClass(g.selectClass)}).click(function(y){y.preventDefault();y.stopPropagation();r()})}function b(e,z){var w=[],A=e.split(g.delimiter),y,x;for(y=0;y<A.length;y++){x=a.trim(A[y]);if(x){x=x.replace(new RegExp(z,"ig"),function(B){return'<span class="'+g.matchClass+'">'+B+"</span>"});w[w.length]=x}}return w}function u(){var e;if(!f.is(":visible")){return false}e=f.children("li."+g.selectClass);if(!e.length){e=false}return e}function r(){$currentResult=u();if($currentResult){if(g.multiple){if(c.val().indexOf(g.multipleSep)!=-1){$currentVal=c.val().substr(0,(c.val().lastIndexOf(g.multipleSep)+g.multipleSep.length))}else{$currentVal=""}c.val($currentVal+$currentResult.text()+g.multipleSep);c.focus()}else{c.val($currentResult.text())}f.hide();if(g.onSelect){g.onSelect.apply(c[0])}}}function t(){$currentResult=u();if($currentResult){$currentResult.removeClass(g.selectClass).next().addClass(g.selectClass)}else{f.children("li:first-child").addClass(g.selectClass)}}function k(){var e=u();if(e){e.removeClass(g.selectClass).prev().addClass(g.selectClass)}else{f.children("li:last-child").addClass(g.selectClass)}}};a.fn.suggest=function(c,b){if(!c){return}b=b||{};b.multiple=b.multiple||false;b.multipleSep=b.multipleSep||", ";b.source=c;b.delay=b.delay||100;b.resultsClass=b.resultsClass||"ac_results";b.selectClass=b.selectClass||"ac_over";b.matchClass=b.matchClass||"ac_match";b.minchars=b.minchars||2;b.delimiter=b.delimiter||"\n";b.onSelect=b.onSelect||false;b.maxCacheSize=b.maxCacheSize||65536;this.each(function(){new a.suggest(this,b)});return this}})(jQuery);
\ No newline at end of file
+(function($){$.suggest=function(input,options){var $input,$results,timeout,prevLength,cache,cacheSize;$input=$(input).attr("autocomplete","off");$results=$(document.createElement("ul"));timeout=false;prevLength=0;cache=[];cacheSize=0;$results.addClass(options.resultsClass).appendTo("body");resetPosition();$(window).load(resetPosition).resize(resetPosition);$input.blur(function(){setTimeout(function(){$results.hide()},200)});if($.browser.msie){try{$results.bgiframe()}catch(e){}}if($.browser.mozilla){$input.keypress(processKey)}else{$input.keydown(processKey)}function resetPosition(){var offset=$input.offset();$results.css({top:(offset.top+input.offsetHeight)+"px",left:offset.left+"px"})}function processKey(e){if((/27$|38$|40$/.test(e.keyCode)&&$results.is(":visible"))||(/^13$|^9$/.test(e.keyCode)&&getCurrentResult())){if(e.preventDefault){e.preventDefault()}if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true;e.returnValue=false;switch(e.keyCode){case 38:prevResult();break;case 40:nextResult();break;case 9:case 13:selectCurrentResult();break;case 27:$results.hide();break}}else{if($input.val().length!=prevLength){if(timeout){clearTimeout(timeout)}timeout=setTimeout(suggest,options.delay);prevLength=$input.val().length}}}function suggest(){var q=$.trim($input.val()),multipleSepPos,items;if(options.multiple){multipleSepPos=q.lastIndexOf(options.multipleSep);if(multipleSepPos!=-1){q=$.trim(q.substr(multipleSepPos+options.multipleSep.length))}}if(q.length>=options.minchars){cached=checkCache(q);if(cached){displayItems(cached.items)}else{$.get(options.source,{q:q},function(txt){$results.hide();items=parseTxt(txt,q);displayItems(items);addToCache(q,items,txt.length)})}}else{$results.hide()}}function checkCache(q){var i;for(i=0;i<cache.length;i++){if(cache[i]["q"]==q){cache.unshift(cache.splice(i,1)[0]);return cache[0]}}return false}function addToCache(q,items,size){var cached;while(cache.length&&(cacheSize+size>options.maxCacheSize)){cached=cache.pop();cacheSize-=cached.size}cache.push({q:q,size:size,items:items});cacheSize+=size}function displayItems(items){var html="",i;if(!items){return}if(!items.length){$results.hide();return}resetPosition();for(i=0;i<items.length;i++){html+="<li>"+items[i]+"</li>"}$results.html(html).show();$results.children("li").mouseover(function(){$results.children("li").removeClass(options.selectClass);$(this).addClass(options.selectClass)}).click(function(e){e.preventDefault();e.stopPropagation();selectCurrentResult()})}function parseTxt(txt,q){var items=[],tokens=txt.split(options.delimiter),i,token;for(i=0;i<tokens.length;i++){token=$.trim(tokens[i]);if(token){token=token.replace(new RegExp(q,"ig"),function(q){return'<span class="'+options.matchClass+'">'+q+"</span>"});items[items.length]=token}}return items}function getCurrentResult(){var $currentResult;if(!$results.is(":visible")){return false}$currentResult=$results.children("li."+options.selectClass);if(!$currentResult.length){$currentResult=false}return $currentResult}function selectCurrentResult(){$currentResult=getCurrentResult();if($currentResult){if(options.multiple){if($input.val().indexOf(options.multipleSep)!=-1){$currentVal=$input.val().substr(0,($input.val().lastIndexOf(options.multipleSep)+options.multipleSep.length))}else{$currentVal=""}$input.val($currentVal+$currentResult.text()+options.multipleSep);$input.focus()}else{$input.val($currentResult.text())}$results.hide();if(options.onSelect){options.onSelect.apply($input[0])}}}function nextResult(){$currentResult=getCurrentResult();if($currentResult){$currentResult.removeClass(options.selectClass).next().addClass(options.selectClass)}else{$results.children("li:first-child").addClass(options.selectClass)}}function prevResult(){var $currentResult=getCurrentResult();if($currentResult){$currentResult.removeClass(options.selectClass).prev().addClass(options.selectClass)}else{$results.children("li:last-child").addClass(options.selectClass)}}};$.fn.suggest=function(source,options){if(!source){return}options=options||{};options.multiple=options.multiple||false;options.multipleSep=options.multipleSep||", ";options.source=source;options.delay=options.delay||100;options.resultsClass=options.resultsClass||"ac_results";options.selectClass=options.selectClass||"ac_over";options.matchClass=options.matchClass||"ac_match";options.minchars=options.minchars||2;options.delimiter=options.delimiter||"\n";options.onSelect=options.onSelect||false;options.maxCacheSize=options.maxCacheSize||65536;this.each(function(){new $.suggest(this,options)});return this}})(jQuery);
\ No newline at end of file
index f510100ec94b15d70c7acbf9a985f5babaccfca6..0aecd2a0b113c1f20accdd57b281e767bd8734ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI 1.7.1
+ * jQuery UI 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -7,4 +7,4 @@
  *
  * http://docs.jquery.com/UI
  */
-jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
\ No newline at end of file
+jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.3",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(j,k){return this.each(function(){if(!k){if(!j||c.filter(j,[this]).length){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")})}}return i.call(c(this),j,k)})},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
index acf0960e4c713fe2aacbeb54a30594c67bbfa4e4..cb0a63e7a5c0cbdda2d1467242cacacefe8b8ef1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Dialog 1.7.1
+ * jQuery UI Dialog 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -12,4 +12,4 @@
  *     ui.draggable.js
  *     ui.resizable.js
  */
-(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(e){var d=this;if(false===d._trigger("beforeclose",e)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)}):d.uiDialog.hide()&&d._trigger("close",e));c.ui.dialog.overlay.resize();d._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove()},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
\ No newline at end of file
+(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(f){var d=this;if(false===d._trigger("beforeclose",f)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",f)}):d.uiDialog.hide()&&d._trigger("close",f));c.ui.dialog.overlay.resize();d._isOpen=false;if(d.options.modal){var e=0;c(".ui-dialog").each(function(){if(this!=d.uiDialog[0]){e=Math.max(e,c(this).css("z-index"))}});c.ui.dialog.maxZ=e}},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.3",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){if(c.ui.dialog.overlay.instances.length){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})}},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove();var e=0;c.each(this.instances,function(){e=Math.max(e,this.css("z-index"))});this.maxZ=e},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
index 31ef4ef713e98d3d145bcb3c2bb2cc46dc2e6ec5..21c4b66523493c37ae31a93f4f1afabf910223ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Draggable 1.7.1
+ * jQuery UI Draggable 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -10,4 +10,4 @@
  * Depends:
  *     ui.core.js
  */
-(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.1",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);
\ No newline at end of file
+(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.3",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);
index 58459611ab28db789b6a08d4314a36f66ce7d530..cf12930a682feee7096469a277caab61917d9a2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Droppable 1.7.1
+ * jQuery UI Droppable 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -11,4 +11,4 @@
  *     ui.core.js
  *     ui.draggable.js
  */
-(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.1",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);
\ No newline at end of file
+(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.3",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);
index aa2f487753acfab004f258470633d54b00773c2e..13cd12b601d3d114df95b3df8e6195d6e839be74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Resizable 1.7.1
+ * jQuery UI Resizable 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -10,4 +10,4 @@
  * Depends:
  *     ui.core.js
  */
-(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.1",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);
\ No newline at end of file
+(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.3",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);
index 69caa92b4081c05684c20030087ff18151c47f73..90202165b4142d992bb82e30a4e107025e49b23e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Selectable 1.7.1
+ * jQuery UI Selectable 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -10,4 +10,4 @@
  * Depends:
  *     ui.core.js
  */
-(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.1",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);
\ No newline at end of file
+(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.3",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);
index d30880639532ad3386aac04969daf51622c8cbf2..0b0a1b307fdfd690ae235e6f9cfcc9e11184d7f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Sortable 1.7.1
+ * jQuery UI Sortable 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -10,4 +10,4 @@
  * Depends:
  *     ui.core.js
  */
-(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.1",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);
\ No newline at end of file
+(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.3",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);
index 5796f0bbd9abdda3cf4262c067064687154fa83c..13cb7f2ec8a816daa3d4b32e60df36d447252c40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Tabs 1.7.1
+ * jQuery UI Tabs 1.7.3
  *
  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -10,4 +10,4 @@
  * Depends:
  *     ui.core.js
  */
-(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);
\ No newline at end of file
+(function(c){var b=0,a=0;c.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(d,e){if(d=="selected"){if(this.options.collapsible&&e==this.options.selected){return}this.select(e)}else{this.options[d]=e;if(d=="deselectable"){this.options.collapsible=e}this._tabify()}},_tabId:function(d){return d.title&&d.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+(++b)},_sanitizeSelector:function(d){return d.replace(/:/g,"\\:")},_cookie:function(){var d=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+(++a));return c.cookie.apply(null,[d].concat(c.makeArray(arguments)))},_ui:function(e,d){return{tab:e,panel:d,index:this.anchors.index(e)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var d=c(this);d.html(d.data("label.tabs")).removeData("label.tabs")})},_tabify:function(q){this.list=this.element.children("ul:first");this.lis=c("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return c("a",this)[0]});this.panels=c([]);var r=this,f=this.options;var e=/^#.+/;this.anchors.each(function(u,o){var s=c(o).attr("href");var v=s.split("#")[0],w;if(v&&(v===location.toString().split("#")[0]||(w=c("base")[0])&&v===w.href)){s=o.hash;o.href=s}if(e.test(s)){r.panels=r.panels.add(r._sanitizeSelector(s))}else{if(s!="#"){c.data(o,"href.tabs",s);c.data(o,"load.tabs",s.replace(/#.*$/,""));var y=r._tabId(o);o.href="#"+y;var x=c("#"+y);if(!x.length){x=c(f.panelTemplate).attr("id",y).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(r.panels[u-1]||r.list);x.data("destroy.tabs",true)}r.panels=r.panels.add(x)}else{f.disabled.push(u)}}});if(q){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(f.selected===undefined){if(location.hash){this.anchors.each(function(s,o){if(o.hash==location.hash){f.selected=s;return false}})}if(typeof f.selected!="number"&&f.cookie){f.selected=parseInt(r._cookie(),10)}if(typeof f.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){f.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}f.selected=f.selected||0}else{if(f.selected===null){f.selected=-1}}f.selected=((f.selected>=0&&this.anchors[f.selected])||f.selected<0)?f.selected:0;f.disabled=c.unique(f.disabled.concat(c.map(this.lis.filter(".ui-state-disabled"),function(s,o){return r.lis.index(s)}))).sort();if(c.inArray(f.selected,f.disabled)!=-1){f.disabled.splice(c.inArray(f.selected,f.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(f.selected>=0&&this.anchors.length){this.panels.eq(f.selected).removeClass("ui-tabs-hide");this.lis.eq(f.selected).addClass("ui-tabs-selected ui-state-active");r.element.queue("tabs",function(){r._trigger("show",null,r._ui(r.anchors[f.selected],r.panels[f.selected]))});this.load(f.selected)}c(window).bind("unload",function(){r.lis.add(r.anchors).unbind(".tabs");r.lis=r.anchors=r.panels=null})}else{f.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[f.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(f.cookie){this._cookie(f.selected,f.cookie)}for(var j=0,p;(p=this.lis[j]);j++){c(p)[c.inArray(j,f.disabled)!=-1&&!c(p).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(f.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(f.event!="mouseover"){var h=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var l=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){h("hover",c(this))});this.lis.bind("mouseout.tabs",function(){l("hover",c(this))});this.anchors.bind("focus.tabs",function(){h("focus",c(this).closest("li"))});this.anchors.bind("blur.tabs",function(){l("focus",c(this).closest("li"))})}var d,k;if(f.fx){if(c.isArray(f.fx)){d=f.fx[0];k=f.fx[1]}else{d=k=f.fx}}function g(i,o){i.css({display:""});if(c.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var m=k?function(i,o){c(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(k,k.duration||"normal",function(){g(o,k);r._trigger("show",null,r._ui(i,o[0]))})}:function(i,o){c(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");r._trigger("show",null,r._ui(i,o[0]))};var n=d?function(o,i){i.animate(d,d.duration||"normal",function(){r.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");g(i,d);r.element.dequeue("tabs")})}:function(o,i,s){r.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");r.element.dequeue("tabs")};this.anchors.bind(f.event+".tabs",function(){var o=this,u=c(this).closest("li"),i=r.panels.filter(":not(.ui-tabs-hide)"),s=c(r._sanitizeSelector(this.hash));if((u.hasClass("ui-tabs-selected")&&!f.collapsible)||u.hasClass("ui-state-disabled")||u.hasClass("ui-state-processing")||r._trigger("select",null,r._ui(this,s[0]))===false){this.blur();return false}f.selected=r.anchors.index(this);r.abort();if(f.collapsible){if(u.hasClass("ui-tabs-selected")){f.selected=-1;if(f.cookie){r._cookie(f.selected,f.cookie)}r.element.queue("tabs",function(){n(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(f.cookie){r._cookie(f.selected,f.cookie)}r.element.queue("tabs",function(){m(o,s)});r.load(r.anchors.index(this));this.blur();return false}}}if(f.cookie){r._cookie(f.selected,f.cookie)}if(s.length){if(i.length){r.element.queue("tabs",function(){n(o,i)})}r.element.queue("tabs",function(){m(o,s)});r.load(r.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(c.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var d=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=c.data(this,"href.tabs");if(e){this.href=e}var f=c(this).unbind(".tabs");c.each(["href","load","cache"],function(g,h){f.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(c.data(this,"destroy.tabs")){c(this).remove()}else{c(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(d.cookie){this._cookie(null,d.cookie)}},add:function(g,f,e){if(e===undefined){e=this.anchors.length}var d=this,i=this.options,k=c(i.tabTemplate.replace(/#\{href\}/g,g).replace(/#\{label\}/g,f)),j=!g.indexOf("#")?g.replace("#",""):this._tabId(c("a",k)[0]);k.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var h=c("#"+j);if(!h.length){h=c(i.panelTemplate).attr("id",j).data("destroy.tabs",true)}h.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(e>=this.lis.length){k.appendTo(this.list);h.appendTo(this.list[0].parentNode)}else{k.insertBefore(this.lis[e]);h.insertBefore(this.panels[e])}i.disabled=c.map(i.disabled,function(m,l){return m>=e?++m:m});this._tabify();if(this.anchors.length==1){k.addClass("ui-tabs-selected ui-state-active");h.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[0],d.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]))},remove:function(d){var f=this.options,g=this.lis.eq(d).remove(),e=this.panels.eq(d).remove();if(g.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(d+(d+1<this.anchors.length?1:-1))}f.disabled=c.map(c.grep(f.disabled,function(j,h){return j!=d}),function(j,h){return j>=d?--j:j});this._tabify();this._trigger("remove",null,this._ui(g.find("a")[0],e[0]))},enable:function(d){var e=this.options;if(c.inArray(d,e.disabled)==-1){return}this.lis.eq(d).removeClass("ui-state-disabled");e.disabled=c.grep(e.disabled,function(g,f){return g!=d});this._trigger("enable",null,this._ui(this.anchors[d],this.panels[d]))},disable:function(e){var d=this,f=this.options;if(e!=f.selected){this.lis.eq(e).addClass("ui-state-disabled");f.disabled.push(e);f.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[e],this.panels[e]))}},select:function(d){if(typeof d=="string"){d=this.anchors.index(this.anchors.filter("[href$="+d+"]"))}else{if(d===null){d=-1}}if(d==-1&&this.options.collapsible){d=this.options.selected}this.anchors.eq(d).trigger(this.options.event+".tabs")},load:function(g){var e=this,i=this.options,d=this.anchors.eq(g)[0],f=c.data(d,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&c.data(d,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(g).addClass("ui-state-processing");if(i.spinner){var h=c("span",d);h.data("label.tabs",h.html()).html(i.spinner)}this.xhr=c.ajax(c.extend({},i.ajaxOptions,{url:f,success:function(k,j){c(e._sanitizeSelector(d.hash)).html(k);e._cleanup();if(i.cache){c.data(d,"cache.tabs",true)}e._trigger("load",null,e._ui(e.anchors[g],e.panels[g]));try{i.ajaxOptions.success(k,j)}catch(l){}e.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(e,d){this.anchors.eq(e).removeData("cache.tabs").data("load.tabs",d)},length:function(){return this.anchors.length}});c.extend(c.ui.tabs,{version:"1.7.3",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});c.extend(c.ui.tabs.prototype,{rotation:null,rotate:function(f,h){var d=this,i=this.options;var e=d._rotate||(d._rotate=function(j){clearTimeout(d.rotation);d.rotation=setTimeout(function(){var k=i.selected;d.select(++k<d.anchors.length?k:0)},f);if(j){j.stopPropagation()}});var g=d._unrotate||(d._unrotate=!h?function(j){if(j.clientX){d.rotate(null)}}:function(j){t=i.selected;e()});if(f){this.element.bind("tabsshow",e);this.anchors.bind(i.event+".tabs",g);e()}else{clearTimeout(d.rotation);this.element.unbind("tabsshow",e);this.anchors.unbind(i.event+".tabs",g);delete this._rotate;delete this._unrotate}}})})(jQuery);
index 5c73462946b96cd5f44fa74aae64895b99e14eb6..9fe6e1243bc0a7cf652985c3edd0d4dc9d8bdfb8 100644 (file)
@@ -1,5 +1,5 @@
-/*  Prototype JavaScript framework, version 1.6.0
- *  (c) 2005-2007 Sam Stephenson
+/*  Prototype JavaScript framework, version 1.6.1
+ *  (c) 2005-2009 Sam Stephenson
  *
  *  Prototype is freely distributable under the terms of an MIT-style license.
  *  For details, see the Prototype web site: http://www.prototypejs.org/
@@ -7,23 +7,43 @@
  *--------------------------------------------------------------------------*/
 
 var Prototype = {
-  Version: '1.6.0',
-
-  Browser: {
-    IE:     !!(window.attachEvent && !window.opera),
-    Opera:  !!window.opera,
-    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
-    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
-    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
-  },
+  Version: '1.6.1',
+
+  Browser: (function(){
+    var ua = navigator.userAgent;
+    var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+    return {
+      IE:             !!window.attachEvent && !isOpera,
+      Opera:          isOpera,
+      WebKit:         ua.indexOf('AppleWebKit/') > -1,
+      Gecko:          ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+      MobileSafari:   /Apple.*Mobile.*Safari/.test(ua)
+    }
+  })(),
 
   BrowserFeatures: {
     XPath: !!document.evaluate,
-    ElementExtensions: !!window.HTMLElement,
-    SpecificElementExtensions:
-      document.createElement('div').__proto__ &&
-      document.createElement('div').__proto__ !==
-        document.createElement('form').__proto__
+    SelectorsAPI: !!document.querySelector,
+    ElementExtensions: (function() {
+      var constructor = window.Element || window.HTMLElement;
+      return !!(constructor && constructor.prototype);
+    })(),
+    SpecificElementExtensions: (function() {
+      if (typeof window.HTMLDivElement !== 'undefined')
+        return true;
+
+      var div = document.createElement('div');
+      var form = document.createElement('form');
+      var isSupported = false;
+
+      if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+        isSupported = true;
+      }
+
+      div = form = null;
+
+      return isSupported;
+    })()
   },
 
   ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
@@ -36,12 +56,31 @@ var Prototype = {
 if (Prototype.Browser.MobileSafari)
   Prototype.BrowserFeatures.SpecificElementExtensions = false;
 
-if (Prototype.Browser.WebKit)
-  Prototype.BrowserFeatures.XPath = false;
+
+var Abstract = { };
+
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) { }
+    }
+
+    return returnValue;
+  }
+};
 
 /* Based on Alex Arnell's inheritance implementation. */
-var Class = {
-  create: function() {
+
+var Class = (function() {
+  function subclass() {};
+  function create() {
     var parent = null, properties = $A(arguments);
     if (Object.isFunction(properties[0]))
       parent = properties.shift();
@@ -55,7 +94,6 @@ var Class = {
     klass.subclasses = [];
 
     if (parent) {
-      var subclass = function() { };
       subclass.prototype = parent.prototype;
       klass.prototype = new subclass;
       parent.subclasses.push(klass);
@@ -68,58 +106,67 @@ var Class = {
       klass.prototype.initialize = Prototype.emptyFunction;
 
     klass.prototype.constructor = klass;
-
     return klass;
   }
-};
 
-Class.Methods = {
-  addMethods: function(source) {
+  function addMethods(source) {
     var ancestor   = this.superclass && this.superclass.prototype;
     var properties = Object.keys(source);
 
-    if (!Object.keys({ toString: true }).length)
-      properties.push("toString", "valueOf");
+    if (!Object.keys({ toString: true }).length) {
+      if (source.toString != Object.prototype.toString)
+        properties.push("toString");
+      if (source.valueOf != Object.prototype.valueOf)
+        properties.push("valueOf");
+    }
 
     for (var i = 0, length = properties.length; i < length; i++) {
       var property = properties[i], value = source[property];
       if (ancestor && Object.isFunction(value) &&
           value.argumentNames().first() == "$super") {
-        var method = value, value = Object.extend((function(m) {
-          return function() { return ancestor[m].apply(this, arguments) };
-        })(property).wrap(method), {
-          valueOf:  function() { return method },
-          toString: function() { return method.toString() }
-        });
+        var method = value;
+        value = (function(m) {
+          return function() { return ancestor[m].apply(this, arguments); };
+        })(property).wrap(method);
+
+        value.valueOf = method.valueOf.bind(method);
+        value.toString = method.toString.bind(method);
       }
       this.prototype[property] = value;
     }
 
     return this;
   }
-};
 
-var Abstract = { };
+  return {
+    create: create,
+    Methods: {
+      addMethods: addMethods
+    }
+  };
+})();
+(function() {
 
-Object.extend = function(destination, source) {
-  for (var property in source)
-    destination[property] = source[property];
-  return destination;
-};
+  var _toString = Object.prototype.toString;
+
+  function extend(destination, source) {
+    for (var property in source)
+      destination[property] = source[property];
+    return destination;
+  }
 
-Object.extend(Object, {
-  inspect: function(object) {
+  function inspect(object) {
     try {
-      if (object === undefined) return 'undefined';
+      if (isUndefined(object)) return 'undefined';
       if (object === null) return 'null';
-      return object.inspect ? object.inspect() : object.toString();
+      return object.inspect ? object.inspect() : String(object);
     } catch (e) {
       if (e instanceof RangeError) return '...';
       throw e;
     }
-  },
+  }
 
-  toJSON: function(object) {
+  function toJSON(object) {
     var type = typeof object;
     switch (type) {
       case 'undefined':
@@ -130,126 +177,180 @@ Object.extend(Object, {
 
     if (object === null) return 'null';
     if (object.toJSON) return object.toJSON();
-    if (Object.isElement(object)) return;
+    if (isElement(object)) return;
 
     var results = [];
     for (var property in object) {
-      var value = Object.toJSON(object[property]);
-      if (value !== undefined)
+      var value = toJSON(object[property]);
+      if (!isUndefined(value))
         results.push(property.toJSON() + ': ' + value);
     }
 
     return '{' + results.join(', ') + '}';
-  },
+  }
 
-  toQueryString: function(object) {
+  function toQueryString(object) {
     return $H(object).toQueryString();
-  },
+  }
 
-  toHTML: function(object) {
+  function toHTML(object) {
     return object && object.toHTML ? object.toHTML() : String.interpret(object);
-  },
+  }
 
-  keys: function(object) {
-    var keys = [];
+  function keys(object) {
+    var results = [];
     for (var property in object)
-      keys.push(property);
-    return keys;
-  },
+      results.push(property);
+    return results;
+  }
 
-  values: function(object) {
-    var values = [];
+  function values(object) {
+    var results = [];
     for (var property in object)
-      values.push(object[property]);
-    return values;
-  },
+      results.push(object[property]);
+    return results;
+  }
 
-  clone: function(object) {
-    return Object.extend({ }, object);
-  },
+  function clone(object) {
+    return extend({ }, object);
+  }
 
-  isElement: function(object) {
-    return object && object.nodeType == 1;
-  },
+  function isElement(object) {
+    return !!(object && object.nodeType == 1);
+  }
 
-  isArray: function(object) {
-    return object && object.constructor === Array;
-  },
+  function isArray(object) {
+    return _toString.call(object) == "[object Array]";
+  }
 
-  isHash: function(object) {
+
+  function isHash(object) {
     return object instanceof Hash;
-  },
+  }
 
-  isFunction: function(object) {
-    return typeof object == "function";
-  },
+  function isFunction(object) {
+    return typeof object === "function";
+  }
 
-  isString: function(object) {
-    return typeof object == "string";
-  },
+  function isString(object) {
+    return _toString.call(object) == "[object String]";
+  }
 
-  isNumber: function(object) {
-    return typeof object == "number";
-  },
+  function isNumber(object) {
+    return _toString.call(object) == "[object Number]";
+  }
 
-  isUndefined: function(object) {
-    return typeof object == "undefined";
+  function isUndefined(object) {
+    return typeof object === "undefined";
+  }
+
+  extend(Object, {
+    extend:        extend,
+    inspect:       inspect,
+    toJSON:        toJSON,
+    toQueryString: toQueryString,
+    toHTML:        toHTML,
+    keys:          keys,
+    values:        values,
+    clone:         clone,
+    isElement:     isElement,
+    isArray:       isArray,
+    isHash:        isHash,
+    isFunction:    isFunction,
+    isString:      isString,
+    isNumber:      isNumber,
+    isUndefined:   isUndefined
+  });
+})();
+Object.extend(Function.prototype, (function() {
+  var slice = Array.prototype.slice;
+
+  function update(array, args) {
+    var arrayLength = array.length, length = args.length;
+    while (length--) array[arrayLength + length] = args[length];
+    return array;
+  }
+
+  function merge(array, args) {
+    array = slice.call(array, 0);
+    return update(array, args);
   }
-});
 
-Object.extend(Function.prototype, {
-  argumentNames: function() {
-    var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
+  function argumentNames() {
+    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
+      .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
+      .replace(/\s+/g, '').split(',');
     return names.length == 1 && !names[0] ? [] : names;
-  },
+  }
 
-  bind: function() {
-    if (arguments.length < 2 && arguments[0] === undefined) return this;
-    var __method = this, args = $A(arguments), object = args.shift();
+  function bind(context) {
+    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+    var __method = this, args = slice.call(arguments, 1);
     return function() {
-      return __method.apply(object, args.concat($A(arguments)));
+      var a = merge(args, arguments);
+      return __method.apply(context, a);
     }
-  },
+  }
 
-  bindAsEventListener: function() {
-    var __method = this, args = $A(arguments), object = args.shift();
+  function bindAsEventListener(context) {
+    var __method = this, args = slice.call(arguments, 1);
     return function(event) {
-      return __method.apply(object, [event || window.event].concat(args));
+      var a = update([event || window.event], args);
+      return __method.apply(context, a);
     }
-  },
+  }
 
-  curry: function() {
+  function curry() {
     if (!arguments.length) return this;
-    var __method = this, args = $A(arguments);
+    var __method = this, args = slice.call(arguments, 0);
     return function() {
-      return __method.apply(this, args.concat($A(arguments)));
+      var a = merge(args, arguments);
+      return __method.apply(this, a);
     }
-  },
+  }
 
-  delay: function() {
-    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+  function delay(timeout) {
+    var __method = this, args = slice.call(arguments, 1);
+    timeout = timeout * 1000
     return window.setTimeout(function() {
       return __method.apply(__method, args);
     }, timeout);
-  },
+  }
+
+  function defer() {
+    var args = update([0.01], arguments);
+    return this.delay.apply(this, args);
+  }
 
-  wrap: function(wrapper) {
+  function wrap(wrapper) {
     var __method = this;
     return function() {
-      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+      var a = update([__method.bind(this)], arguments);
+      return wrapper.apply(this, a);
     }
-  },
+  }
 
-  methodize: function() {
+  function methodize() {
     if (this._methodized) return this._methodized;
     var __method = this;
     return this._methodized = function() {
-      return __method.apply(null, [this].concat($A(arguments)));
+      var a = update([this], arguments);
+      return __method.apply(null, a);
     };
   }
-});
 
-Function.prototype.defer = Function.prototype.delay.curry(0.01);
+  return {
+    argumentNames:       argumentNames,
+    bind:                bind,
+    bindAsEventListener: bindAsEventListener,
+    curry:               curry,
+    delay:               delay,
+    defer:               defer,
+    wrap:                wrap,
+    methodize:           methodize
+  }
+})());
+
 
 Date.prototype.toJSON = function() {
   return '"' + this.getUTCFullYear() + '-' +
@@ -260,30 +361,12 @@ Date.prototype.toJSON = function() {
     this.getUTCSeconds().toPaddedString(2) + 'Z"';
 };
 
-var Try = {
-  these: function() {
-    var returnValue;
-
-    for (var i = 0, length = arguments.length; i < length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) { }
-    }
-
-    return returnValue;
-  }
-};
 
 RegExp.prototype.match = RegExp.prototype.test;
 
 RegExp.escape = function(str) {
   return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
 };
-
-/*--------------------------------------------------------------------------*/
-
 var PeriodicalExecuter = Class.create({
   initialize: function(callback, frequency) {
     this.callback = callback;
@@ -312,8 +395,10 @@ var PeriodicalExecuter = Class.create({
       try {
         this.currentlyExecuting = true;
         this.execute();
-      } finally {
         this.currentlyExecuting = false;
+      } catch(e) {
+        this.currentlyExecuting = false;
+        throw e;
       }
     }
   }
@@ -332,10 +417,25 @@ Object.extend(String, {
   }
 });
 
-Object.extend(String.prototype, {
-  gsub: function(pattern, replacement) {
+Object.extend(String.prototype, (function() {
+
+  function prepareReplacement(replacement) {
+    if (Object.isFunction(replacement)) return replacement;
+    var template = new Template(replacement);
+    return function(match) { return template.evaluate(match) };
+  }
+
+  function gsub(pattern, replacement) {
     var result = '', source = this, match;
-    replacement = arguments.callee.prepareReplacement(replacement);
+    replacement = prepareReplacement(replacement);
+
+    if (Object.isString(pattern))
+      pattern = RegExp.escape(pattern);
+
+    if (!(pattern.length || pattern.source)) {
+      replacement = replacement('');
+      return replacement + source.split('').join(replacement) + replacement;
+    }
 
     while (source.length > 0) {
       if (match = source.match(pattern)) {
@@ -347,69 +447,64 @@ Object.extend(String.prototype, {
       }
     }
     return result;
-  },
+  }
 
-  sub: function(pattern, replacement, count) {
-    replacement = this.gsub.prepareReplacement(replacement);
-    count = count === undefined ? 1 : count;
+  function sub(pattern, replacement, count) {
+    replacement = prepareReplacement(replacement);
+    count = Object.isUndefined(count) ? 1 : count;
 
     return this.gsub(pattern, function(match) {
       if (--count < 0) return match[0];
       return replacement(match);
     });
-  },
+  }
 
-  scan: function(pattern, iterator) {
+  function scan(pattern, iterator) {
     this.gsub(pattern, iterator);
     return String(this);
-  },
+  }
 
-  truncate: function(length, truncation) {
+  function truncate(length, truncation) {
     length = length || 30;
-    truncation = truncation === undefined ? '...' : truncation;
+    truncation = Object.isUndefined(truncation) ? '...' : truncation;
     return this.length > length ?
       this.slice(0, length - truncation.length) + truncation : String(this);
-  },
+  }
 
-  strip: function() {
+  function strip() {
     return this.replace(/^\s+/, '').replace(/\s+$/, '');
-  },
+  }
 
-  stripTags: function() {
-    return this.replace(/<\/?[^>]+>/gi, '');
-  },
+  function stripTags() {
+    return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
+  }
 
-  stripScripts: function() {
+  function stripScripts() {
     return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
-  },
+  }
 
-  extractScripts: function() {
+  function extractScripts() {
     var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
     var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
     return (this.match(matchAll) || []).map(function(scriptTag) {
       return (scriptTag.match(matchOne) || ['', ''])[1];
     });
-  },
+  }
 
-  evalScripts: function() {
+  function evalScripts() {
     return this.extractScripts().map(function(script) { return eval(script) });
-  },
+  }
 
-  escapeHTML: function() {
-    var self = arguments.callee;
-    self.text.data = this;
-    return self.div.innerHTML;
-  },
+  function escapeHTML() {
+    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+  }
 
-  unescapeHTML: function() {
-    var div = new Element('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? (div.childNodes.length > 1 ?
-      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
-      div.childNodes[0].nodeValue) : '';
-  },
+  function unescapeHTML() {
+    return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
+  }
 
-  toQueryParams: function(separator) {
+
+  function toQueryParams(separator) {
     var match = this.strip().match(/([^?#]*)(#.*)?$/);
     if (!match) return { };
 
@@ -427,22 +522,22 @@ Object.extend(String.prototype, {
       }
       return hash;
     });
-  },
+  }
 
-  toArray: function() {
+  function toArray() {
     return this.split('');
-  },
+  }
 
-  succ: function() {
+  function succ() {
     return this.slice(0, this.length - 1) +
       String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
-  },
+  }
 
-  times: function(count) {
+  function times(count) {
     return count < 1 ? '' : new Array(count + 1).join(this);
-  },
+  }
 
-  camelize: function() {
+  function camelize() {
     var parts = this.split('-'), len = parts.length;
     if (len == 1) return parts[0];
 
@@ -454,99 +549,117 @@ Object.extend(String.prototype, {
       camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
 
     return camelized;
-  },
+  }
 
-  capitalize: function() {
+  function capitalize() {
     return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
-  },
+  }
 
-  underscore: function() {
-    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
-  },
+  function underscore() {
+    return this.replace(/::/g, '/')
+               .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
+               .replace(/([a-z\d])([A-Z])/g, '$1_$2')
+               .replace(/-/g, '_')
+               .toLowerCase();
+  }
 
-  dasherize: function() {
-    return this.gsub(/_/,'-');
-  },
+  function dasherize() {
+    return this.replace(/_/g, '-');
+  }
 
-  inspect: function(useDoubleQuotes) {
-    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
-      var character = String.specialChar[match[0]];
-      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+  function inspect(useDoubleQuotes) {
+    var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
+      if (character in String.specialChar) {
+        return String.specialChar[character];
+      }
+      return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
     });
     if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
     return "'" + escapedString.replace(/'/g, '\\\'') + "'";
-  },
+  }
 
-  toJSON: function() {
+  function toJSON() {
     return this.inspect(true);
-  },
+  }
 
-  unfilterJSON: function(filter) {
-    return this.sub(filter || Prototype.JSONFilter, '#{1}');
-  },
+  function unfilterJSON(filter) {
+    return this.replace(filter || Prototype.JSONFilter, '$1');
+  }
 
-  isJSON: function() {
-    var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+  function isJSON() {
+    var str = this;
+    if (str.blank()) return false;
+    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
     return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
-  },
+  }
 
-  evalJSON: function(sanitize) {
+  function evalJSON(sanitize) {
     var json = this.unfilterJSON();
     try {
       if (!sanitize || json.isJSON()) return eval('(' + json + ')');
     } catch (e) { }
     throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
-  },
+  }
 
-  include: function(pattern) {
+  function include(pattern) {
     return this.indexOf(pattern) > -1;
-  },
+  }
 
-  startsWith: function(pattern) {
+  function startsWith(pattern) {
     return this.indexOf(pattern) === 0;
-  },
+  }
 
-  endsWith: function(pattern) {
+  function endsWith(pattern) {
     var d = this.length - pattern.length;
     return d >= 0 && this.lastIndexOf(pattern) === d;
-  },
+  }
 
-  empty: function() {
+  function empty() {
     return this == '';
-  },
+  }
 
-  blank: function() {
+  function blank() {
     return /^\s*$/.test(this);
-  },
-
-  interpolate: function(object, pattern) {
-    return new Template(this, pattern).evaluate(object);
   }
-});
 
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
-  escapeHTML: function() {
-    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
-  },
-  unescapeHTML: function() {
-    return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
+  function interpolate(object, pattern) {
+    return new Template(this, pattern).evaluate(object);
   }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
-  if (Object.isFunction(replacement)) return replacement;
-  var template = new Template(replacement);
-  return function(match) { return template.evaluate(match) };
-};
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
-  div:  document.createElement('div'),
-  text: document.createTextNode('')
-});
 
-with (String.prototype.escapeHTML) div.appendChild(text);
+  return {
+    gsub:           gsub,
+    sub:            sub,
+    scan:           scan,
+    truncate:       truncate,
+    strip:          String.prototype.trim ? String.prototype.trim : strip,
+    stripTags:      stripTags,
+    stripScripts:   stripScripts,
+    extractScripts: extractScripts,
+    evalScripts:    evalScripts,
+    escapeHTML:     escapeHTML,
+    unescapeHTML:   unescapeHTML,
+    toQueryParams:  toQueryParams,
+    parseQuery:     toQueryParams,
+    toArray:        toArray,
+    succ:           succ,
+    times:          times,
+    camelize:       camelize,
+    capitalize:     capitalize,
+    underscore:     underscore,
+    dasherize:      dasherize,
+    inspect:        inspect,
+    toJSON:         toJSON,
+    unfilterJSON:   unfilterJSON,
+    isJSON:         isJSON,
+    evalJSON:       evalJSON,
+    include:        include,
+    startsWith:     startsWith,
+    endsWith:       endsWith,
+    empty:          empty,
+    blank:          blank,
+    interpolate:    interpolate
+  };
+})());
 
 var Template = Class.create({
   initialize: function(template, pattern) {
@@ -555,21 +668,22 @@ var Template = Class.create({
   },
 
   evaluate: function(object) {
-    if (Object.isFunction(object.toTemplateReplacements))
+    if (object && Object.isFunction(object.toTemplateReplacements))
       object = object.toTemplateReplacements();
 
     return this.template.gsub(this.pattern, function(match) {
-      if (object == null) return '';
+      if (object == null) return (match[1] + '');
 
       var before = match[1] || '';
       if (before == '\\') return match[2];
 
       var ctx = object, expr = match[3];
-      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
+      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+      match = pattern.exec(expr);
       if (match == null) return before;
 
       while (match != null) {
-        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+        var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
         ctx = ctx[comp];
         if (null == ctx || '' == match[3]) break;
         expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
@@ -577,101 +691,98 @@ var Template = Class.create({
       }
 
       return before + String.interpret(ctx);
-    }.bind(this));
+    });
   }
 });
 Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
 
 var $break = { };
 
-var Enumerable = {
-  each: function(iterator, context) {
+var Enumerable = (function() {
+  function each(iterator, context) {
     var index = 0;
-    iterator = iterator.bind(context);
     try {
       this._each(function(value) {
-        iterator(value, index++);
+        iterator.call(context, value, index++);
       });
     } catch (e) {
       if (e != $break) throw e;
     }
     return this;
-  },
+  }
 
-  eachSlice: function(number, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function eachSlice(number, iterator, context) {
     var index = -number, slices = [], array = this.toArray();
+    if (number < 1) return array;
     while ((index += number) < array.length)
       slices.push(array.slice(index, index+number));
     return slices.collect(iterator, context);
-  },
+  }
 
-  all: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function all(iterator, context) {
+    iterator = iterator || Prototype.K;
     var result = true;
     this.each(function(value, index) {
-      result = result && !!iterator(value, index);
+      result = result && !!iterator.call(context, value, index);
       if (!result) throw $break;
     });
     return result;
-  },
+  }
 
-  any: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function any(iterator, context) {
+    iterator = iterator || Prototype.K;
     var result = false;
     this.each(function(value, index) {
-      if (result = !!iterator(value, index))
+      if (result = !!iterator.call(context, value, index))
         throw $break;
     });
     return result;
-  },
+  }
 
-  collect: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function collect(iterator, context) {
+    iterator = iterator || Prototype.K;
     var results = [];
     this.each(function(value, index) {
-      results.push(iterator(value, index));
+      results.push(iterator.call(context, value, index));
     });
     return results;
-  },
+  }
 
-  detect: function(iterator, context) {
-    iterator = iterator.bind(context);
+  function detect(iterator, context) {
     var result;
     this.each(function(value, index) {
-      if (iterator(value, index)) {
+      if (iterator.call(context, value, index)) {
         result = value;
         throw $break;
       }
     });
     return result;
-  },
+  }
 
-  findAll: function(iterator, context) {
-    iterator = iterator.bind(context);
+  function findAll(iterator, context) {
     var results = [];
     this.each(function(value, index) {
-      if (iterator(value, index))
+      if (iterator.call(context, value, index))
         results.push(value);
     });
     return results;
-  },
+  }
 
-  grep: function(filter, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function grep(filter, iterator, context) {
+    iterator = iterator || Prototype.K;
     var results = [];
 
     if (Object.isString(filter))
-      filter = new RegExp(filter);
+      filter = new RegExp(RegExp.escape(filter));
 
     this.each(function(value, index) {
       if (filter.match(value))
-        results.push(iterator(value, index));
+        results.push(iterator.call(context, value, index));
     });
     return results;
-  },
+  }
 
-  include: function(object) {
+  function include(object) {
     if (Object.isFunction(this.indexOf))
       if (this.indexOf(object) != -1) return true;
 
@@ -683,96 +794,96 @@ var Enumerable = {
       }
     });
     return found;
-  },
+  }
 
-  inGroupsOf: function(number, fillWith) {
-    fillWith = fillWith === undefined ? null : fillWith;
+  function inGroupsOf(number, fillWith) {
+    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
     return this.eachSlice(number, function(slice) {
       while(slice.length < number) slice.push(fillWith);
       return slice;
     });
-  },
+  }
 
-  inject: function(memo, iterator, context) {
-    iterator = iterator.bind(context);
+  function inject(memo, iterator, context) {
     this.each(function(value, index) {
-      memo = iterator(memo, value, index);
+      memo = iterator.call(context, memo, value, index);
     });
     return memo;
-  },
+  }
 
-  invoke: function(method) {
+  function invoke(method) {
     var args = $A(arguments).slice(1);
     return this.map(function(value) {
       return value[method].apply(value, args);
     });
-  },
+  }
 
-  max: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function max(iterator, context) {
+    iterator = iterator || Prototype.K;
     var result;
     this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value >= result)
+      value = iterator.call(context, value, index);
+      if (result == null || value >= result)
         result = value;
     });
     return result;
-  },
+  }
 
-  min: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function min(iterator, context) {
+    iterator = iterator || Prototype.K;
     var result;
     this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value < result)
+      value = iterator.call(context, value, index);
+      if (result == null || value < result)
         result = value;
     });
     return result;
-  },
+  }
 
-  partition: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
+  function partition(iterator, context) {
+    iterator = iterator || Prototype.K;
     var trues = [], falses = [];
     this.each(function(value, index) {
-      (iterator(value, index) ?
+      (iterator.call(context, value, index) ?
         trues : falses).push(value);
     });
     return [trues, falses];
-  },
+  }
 
-  pluck: function(property) {
+  function pluck(property) {
     var results = [];
     this.each(function(value) {
       results.push(value[property]);
     });
     return results;
-  },
+  }
 
-  reject: function(iterator, context) {
-    iterator = iterator.bind(context);
+  function reject(iterator, context) {
     var results = [];
     this.each(function(value, index) {
-      if (!iterator(value, index))
+      if (!iterator.call(context, value, index))
         results.push(value);
     });
     return results;
-  },
+  }
 
-  sortBy: function(iterator, context) {
-    iterator = iterator.bind(context);
+  function sortBy(iterator, context) {
     return this.map(function(value, index) {
-      return {value: value, criteria: iterator(value, index)};
+      return {
+        value: value,
+        criteria: iterator.call(context, value, index)
+      };
     }).sort(function(left, right) {
       var a = left.criteria, b = right.criteria;
       return a < b ? -1 : a > b ? 1 : 0;
     }).pluck('value');
-  },
+  }
 
-  toArray: function() {
+  function toArray() {
     return this.map();
-  },
+  }
 
-  zip: function() {
+  function zip() {
     var iterator = Prototype.K, args = $A(arguments);
     if (Object.isFunction(args.last()))
       iterator = args.pop();
@@ -781,351 +892,423 @@ var Enumerable = {
     return this.map(function(value, index) {
       return iterator(collections.pluck(index));
     });
-  },
+  }
 
-  size: function() {
+  function size() {
     return this.toArray().length;
-  },
+  }
 
-  inspect: function() {
+  function inspect() {
     return '#<Enumerable:' + this.toArray().inspect() + '>';
   }
-};
 
-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  filter:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray,
-  every:   Enumerable.all,
-  some:    Enumerable.any
-});
+
+
+
+
+
+
+
+
+  return {
+    each:       each,
+    eachSlice:  eachSlice,
+    all:        all,
+    every:      all,
+    any:        any,
+    some:       any,
+    collect:    collect,
+    map:        collect,
+    detect:     detect,
+    findAll:    findAll,
+    select:     findAll,
+    filter:     findAll,
+    grep:       grep,
+    include:    include,
+    member:     include,
+    inGroupsOf: inGroupsOf,
+    inject:     inject,
+    invoke:     invoke,
+    max:        max,
+    min:        min,
+    partition:  partition,
+    pluck:      pluck,
+    reject:     reject,
+    sortBy:     sortBy,
+    toArray:    toArray,
+    entries:    toArray,
+    zip:        zip,
+    size:       size,
+    inspect:    inspect,
+    find:       detect
+  };
+})();
 function $A(iterable) {
   if (!iterable) return [];
-  if (iterable.toArray) return iterable.toArray();
-  var length = iterable.length, results = new Array(length);
+  if ('toArray' in Object(iterable)) return iterable.toArray();
+  var length = iterable.length || 0, results = new Array(length);
   while (length--) results[length] = iterable[length];
   return results;
 }
 
-if (Prototype.Browser.WebKit) {
-  function $A(iterable) {
-    if (!iterable) return [];
-    if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
-        iterable.toArray) return iterable.toArray();
-    var length = iterable.length, results = new Array(length);
-    while (length--) results[length] = iterable[length];
-    return results;
-  }
+function $w(string) {
+  if (!Object.isString(string)) return [];
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
 }
 
 Array.from = $A;
 
-Object.extend(Array.prototype, Enumerable);
 
-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+(function() {
+  var arrayProto = Array.prototype,
+      slice = arrayProto.slice,
+      _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
 
-Object.extend(Array.prototype, {
-  _each: function(iterator) {
+  function each(iterator) {
     for (var i = 0, length = this.length; i < length; i++)
       iterator(this[i]);
-  },
+  }
+  if (!_each) _each = each;
 
-  clear: function() {
+  function clear() {
     this.length = 0;
     return this;
-  },
+  }
 
-  first: function() {
+  function first() {
     return this[0];
-  },
+  }
 
-  last: function() {
+  function last() {
     return this[this.length - 1];
-  },
+  }
 
-  compact: function() {
+  function compact() {
     return this.select(function(value) {
       return value != null;
     });
-  },
+  }
 
-  flatten: function() {
+  function flatten() {
     return this.inject([], function(array, value) {
-      return array.concat(Object.isArray(value) ?
-        value.flatten() : [value]);
+      if (Object.isArray(value))
+        return array.concat(value.flatten());
+      array.push(value);
+      return array;
     });
-  },
+  }
 
-  without: function() {
-    var values = $A(arguments);
+  function without() {
+    var values = slice.call(arguments, 0);
     return this.select(function(value) {
       return !values.include(value);
     });
-  },
+  }
 
-  reverse: function(inline) {
+  function reverse(inline) {
     return (inline !== false ? this : this.toArray())._reverse();
-  },
-
-  reduce: function() {
-    return this.length > 1 ? this : this[0];
-  },
+  }
 
-  uniq: function(sorted) {
+  function uniq(sorted) {
     return this.inject([], function(array, value, index) {
       if (0 == index || (sorted ? array.last() != value : !array.include(value)))
         array.push(value);
       return array;
     });
-  },
+  }
 
-  intersect: function(array) {
+  function intersect(array) {
     return this.uniq().findAll(function(item) {
       return array.detect(function(value) { return item === value });
     });
-  },
+  }
 
-  clone: function() {
-    return [].concat(this);
-  },
 
-  size: function() {
+  function clone() {
+    return slice.call(this, 0);
+  }
+
+  function size() {
     return this.length;
-  },
+  }
 
-  inspect: function() {
+  function inspect() {
     return '[' + this.map(Object.inspect).join(', ') + ']';
-  },
+  }
 
-  toJSON: function() {
+  function toJSON() {
     var results = [];
     this.each(function(object) {
       var value = Object.toJSON(object);
-      if (value !== undefined) results.push(value);
+      if (!Object.isUndefined(value)) results.push(value);
     });
     return '[' + results.join(', ') + ']';
   }
-});
-
-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
-  Array.prototype._each = Array.prototype.forEach;
-
-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
-  i || (i = 0);
-  var length = this.length;
-  if (i < 0) i = length + i;
-  for (; i < length; i++)
-    if (this[i] === item) return i;
-  return -1;
-};
-
-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
-  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
-  var n = this.slice(0, i).reverse().indexOf(item);
-  return (n < 0) ? n : i - n - 1;
-};
 
-Array.prototype.toArray = Array.prototype.clone;
+  function indexOf(item, i) {
+    i || (i = 0);
+    var length = this.length;
+    if (i < 0) i = length + i;
+    for (; i < length; i++)
+      if (this[i] === item) return i;
+    return -1;
+  }
 
-function $w(string) {
-  if (!Object.isString(string)) return [];
-  string = string.strip();
-  return string ? string.split(/\s+/) : [];
-}
+  function lastIndexOf(item, i) {
+    i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+    var n = this.slice(0, i).reverse().indexOf(item);
+    return (n < 0) ? n : i - n - 1;
+  }
 
-if (Prototype.Browser.Opera){
-  Array.prototype.concat = function() {
-    var array = [];
-    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+  function concat() {
+    var array = slice.call(this, 0), item;
     for (var i = 0, length = arguments.length; i < length; i++) {
-      if (Object.isArray(arguments[i])) {
-        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
-          array.push(arguments[i][j]);
+      item = arguments[i];
+      if (Object.isArray(item) && !('callee' in item)) {
+        for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
+          array.push(item[j]);
       } else {
-        array.push(arguments[i]);
+        array.push(item);
       }
     }
     return array;
-  };
-}
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    return this.toPaddedString(2, 16);
-  },
-
-  succ: function() {
-    return this + 1;
-  },
+  }
 
-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  },
+  Object.extend(arrayProto, Enumerable);
+
+  if (!arrayProto._reverse)
+    arrayProto._reverse = arrayProto.reverse;
+
+  Object.extend(arrayProto, {
+    _each:     _each,
+    clear:     clear,
+    first:     first,
+    last:      last,
+    compact:   compact,
+    flatten:   flatten,
+    without:   without,
+    reverse:   reverse,
+    uniq:      uniq,
+    intersect: intersect,
+    clone:     clone,
+    toArray:   clone,
+    size:      size,
+    inspect:   inspect,
+    toJSON:    toJSON
+  });
 
-  toPaddedString: function(length, radix) {
-    var string = this.toString(radix || 10);
-    return '0'.times(length - string.length) + string;
-  },
+  var CONCAT_ARGUMENTS_BUGGY = (function() {
+    return [].concat(arguments)[0][0] !== 1;
+  })(1,2)
 
-  toJSON: function() {
-    return isFinite(this) ? this.toString() : 'null';
-  }
-});
+  if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
 
-$w('abs round ceil floor').each(function(method){
-  Number.prototype[method] = Math[method].methodize();
-});
+  if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
+  if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
+})();
 function $H(object) {
   return new Hash(object);
 };
 
 var Hash = Class.create(Enumerable, (function() {
-  if (function() {
-    var i = 0, Test = function(value) { this.key = value };
-    Test.prototype.key = 'foo';
-    for (var property in new Test('bar')) i++;
-    return i > 1;
-  }()) {
-    function each(iterator) {
-      var cache = [];
-      for (var key in this._object) {
-        var value = this._object[key];
-        if (cache.include(key)) continue;
-        cache.push(key);
-        var pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
-  } else {
-    function each(iterator) {
-      for (var key in this._object) {
-        var value = this._object[key], pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
+  function initialize(object) {
+    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+  }
+
+  function _each(iterator) {
+    for (var key in this._object) {
+      var value = this._object[key], pair = [key, value];
+      pair.key = key;
+      pair.value = value;
+      iterator(pair);
     }
   }
 
+  function set(key, value) {
+    return this._object[key] = value;
+  }
+
+  function get(key) {
+    if (this._object[key] !== Object.prototype[key])
+      return this._object[key];
+  }
+
+  function unset(key) {
+    var value = this._object[key];
+    delete this._object[key];
+    return value;
+  }
+
+  function toObject() {
+    return Object.clone(this._object);
+  }
+
+  function keys() {
+    return this.pluck('key');
+  }
+
+  function values() {
+    return this.pluck('value');
+  }
+
+  function index(value) {
+    var match = this.detect(function(pair) {
+      return pair.value === value;
+    });
+    return match && match.key;
+  }
+
+  function merge(object) {
+    return this.clone().update(object);
+  }
+
+  function update(object) {
+    return new Hash(object).inject(this, function(result, pair) {
+      result.set(pair.key, pair.value);
+      return result;
+    });
+  }
+
   function toQueryPair(key, value) {
     if (Object.isUndefined(value)) return key;
     return key + '=' + encodeURIComponent(String.interpret(value));
   }
 
-  return {
-    initialize: function(object) {
-      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
-    },
-
-    _each: each,
+  function toQueryString() {
+    return this.inject([], function(results, pair) {
+      var key = encodeURIComponent(pair.key), values = pair.value;
 
-    set: function(key, value) {
-      return this._object[key] = value;
-    },
+      if (values && typeof values == 'object') {
+        if (Object.isArray(values))
+          return results.concat(values.map(toQueryPair.curry(key)));
+      } else results.push(toQueryPair(key, values));
+      return results;
+    }).join('&');
+  }
 
-    get: function(key) {
-      return this._object[key];
-    },
+  function inspect() {
+    return '#<Hash:{' + this.map(function(pair) {
+      return pair.map(Object.inspect).join(': ');
+    }).join(', ') + '}>';
+  }
 
-    unset: function(key) {
-      var value = this._object[key];
-      delete this._object[key];
-      return value;
-    },
+  function toJSON() {
+    return Object.toJSON(this.toObject());
+  }
 
-    toObject: function() {
-      return Object.clone(this._object);
-    },
+  function clone() {
+    return new Hash(this);
+  }
 
-    keys: function() {
-      return this.pluck('key');
-    },
+  return {
+    initialize:             initialize,
+    _each:                  _each,
+    set:                    set,
+    get:                    get,
+    unset:                  unset,
+    toObject:               toObject,
+    toTemplateReplacements: toObject,
+    keys:                   keys,
+    values:                 values,
+    index:                  index,
+    merge:                  merge,
+    update:                 update,
+    toQueryString:          toQueryString,
+    inspect:                inspect,
+    toJSON:                 toJSON,
+    clone:                  clone
+  };
+})());
 
-    values: function() {
-      return this.pluck('value');
-    },
+Hash.from = $H;
+Object.extend(Number.prototype, (function() {
+  function toColorPart() {
+    return this.toPaddedString(2, 16);
+  }
 
-    index: function(value) {
-      var match = this.detect(function(pair) {
-        return pair.value === value;
-      });
-      return match && match.key;
-    },
+  function succ() {
+    return this + 1;
+  }
 
-    merge: function(object) {
-      return this.clone().update(object);
-    },
+  function times(iterator, context) {
+    $R(0, this, true).each(iterator, context);
+    return this;
+  }
 
-    update: function(object) {
-      return new Hash(object).inject(this, function(result, pair) {
-        result.set(pair.key, pair.value);
-        return result;
-      });
-    },
+  function toPaddedString(length, radix) {
+    var string = this.toString(radix || 10);
+    return '0'.times(length - string.length) + string;
+  }
 
-    toQueryString: function() {
-      return this.map(function(pair) {
-        var key = encodeURIComponent(pair.key), values = pair.value;
+  function toJSON() {
+    return isFinite(this) ? this.toString() : 'null';
+  }
 
-        if (values && typeof values == 'object') {
-          if (Object.isArray(values))
-            return values.map(toQueryPair.curry(key)).join('&');
-        }
-        return toQueryPair(key, values);
-      }).join('&');
-    },
+  function abs() {
+    return Math.abs(this);
+  }
 
-    inspect: function() {
-      return '#<Hash:{' + this.map(function(pair) {
-        return pair.map(Object.inspect).join(': ');
-      }).join(', ') + '}>';
-    },
+  function round() {
+    return Math.round(this);
+  }
 
-    toJSON: function() {
-      return Object.toJSON(this.toObject());
-    },
+  function ceil() {
+    return Math.ceil(this);
+  }
 
-    clone: function() {
-      return new Hash(this);
-    }
+  function floor() {
+    return Math.floor(this);
   }
+
+  return {
+    toColorPart:    toColorPart,
+    succ:           succ,
+    times:          times,
+    toPaddedString: toPaddedString,
+    toJSON:         toJSON,
+    abs:            abs,
+    round:          round,
+    ceil:           ceil,
+    floor:          floor
+  };
 })());
 
-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
-  initialize: function(start, end, exclusive) {
+function $R(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+}
+
+var ObjectRange = Class.create(Enumerable, (function() {
+  function initialize(start, end, exclusive) {
     this.start = start;
     this.end = end;
     this.exclusive = exclusive;
-  },
+  }
 
-  _each: function(iterator) {
+  function _each(iterator) {
     var value = this.start;
     while (this.include(value)) {
       iterator(value);
       value = value.succ();
     }
-  },
+  }
 
-  include: function(value) {
+  function include(value) {
     if (value < this.start)
       return false;
     if (this.exclusive)
       return value < this.end;
     return value <= this.end;
   }
-});
 
-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-};
+  return {
+    initialize: initialize,
+    _each:      _each,
+    include:    include
+  };
+})());
+
+
 
 var Ajax = {
   getTransport: function() {
@@ -1172,7 +1355,6 @@ Ajax.Responders.register({
   onCreate:   function() { Ajax.activeRequestCount++ },
   onComplete: function() { Ajax.activeRequestCount-- }
 });
-
 Ajax.Base = Class.create({
   initialize: function(options) {
     this.options = {
@@ -1187,11 +1369,13 @@ Ajax.Base = Class.create({
     Object.extend(this.options, options || { });
 
     this.options.method = this.options.method.toLowerCase();
+
     if (Object.isString(this.options.parameters))
       this.options.parameters = this.options.parameters.toQueryParams();
+    else if (Object.isHash(this.options.parameters))
+      this.options.parameters = this.options.parameters.toObject();
   }
 });
-
 Ajax.Request = Class.create(Ajax.Base, {
   _complete: false,
 
@@ -1207,7 +1391,6 @@ Ajax.Request = Class.create(Ajax.Base, {
     var params = Object.clone(this.options.parameters);
 
     if (!['get', 'post'].include(this.method)) {
-      // simulate other verbs over post
       params['_method'] = this.method;
       this.method = 'post';
     }
@@ -1215,7 +1398,6 @@ Ajax.Request = Class.create(Ajax.Base, {
     this.parameters = params;
 
     if (params = Object.toQueryString(params)) {
-      // when GET, append parameters to URL
       if (this.method == 'get')
         this.url += (this.url.include('?') ? '&' : '?') + params;
       else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
@@ -1274,7 +1456,6 @@ Ajax.Request = Class.create(Ajax.Base, {
             headers['Connection'] = 'close';
     }
 
-    // user-defined headers
     if (typeof this.options.requestHeaders == 'object') {
       var extras = this.options.requestHeaders;
 
@@ -1315,7 +1496,7 @@ Ajax.Request = Class.create(Ajax.Base, {
 
       var contentType = response.getHeader('Content-type');
       if (this.options.evalJS == 'force'
-          || (this.options.evalJS && contentType
+          || (this.options.evalJS && this.isSameOrigin() && contentType
           && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
         this.evalResponse();
     }
@@ -1328,15 +1509,23 @@ Ajax.Request = Class.create(Ajax.Base, {
     }
 
     if (state == 'Complete') {
-      // avoid memory leak in MSIE: clean up
       this.transport.onreadystatechange = Prototype.emptyFunction;
     }
   },
 
+  isSameOrigin: function() {
+    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+      protocol: location.protocol,
+      domain: document.domain,
+      port: location.port ? ':' + location.port : ''
+    }));
+  },
+
   getHeader: function(name) {
     try {
-      return this.transport.getResponseHeader(name);
-    } catch (e) { return null }
+      return this.transport.getResponseHeader(name) || null;
+    } catch (e) { return null; }
   },
 
   evalResponse: function() {
@@ -1356,6 +1545,13 @@ Ajax.Request = Class.create(Ajax.Base, {
 Ajax.Request.Events =
   ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
 
+
+
+
+
+
+
+
 Ajax.Response = Class.create({
   initialize: function(request){
     this.request = request;
@@ -1371,12 +1567,13 @@ Ajax.Response = Class.create({
 
     if(readyState == 4) {
       var xml = transport.responseXML;
-      this.responseXML  = xml === undefined ? null : xml;
+      this.responseXML  = Object.isUndefined(xml) ? null : xml;
       this.responseJSON = this._getResponseJSON();
     }
   },
 
   status:      0,
+
   statusText: '',
 
   getStatus: Ajax.Request.prototype.getStatus,
@@ -1408,7 +1605,8 @@ Ajax.Response = Class.create({
     if (!json) return null;
     json = decodeURIComponent(escape(json));
     try {
-      return json.evalJSON(this.request.options.sanitizeJSON);
+      return json.evalJSON(this.request.options.sanitizeJSON ||
+        !this.request.isSameOrigin());
     } catch (e) {
       this.request.dispatchException(e);
     }
@@ -1417,10 +1615,12 @@ Ajax.Response = Class.create({
   _getResponseJSON: function() {
     var options = this.request.options;
     if (!options.evalJSON || (options.evalJSON != 'force' &&
-      !(this.getHeader('Content-type') || '').include('application/json')))
-        return null;
+      !(this.getHeader('Content-type') || '').include('application/json')) ||
+        this.responseText.blank())
+          return null;
     try {
-      return this.transport.responseText.evalJSON(options.sanitizeJSON);
+      return this.responseText.evalJSON(options.sanitizeJSON ||
+        !this.request.isSameOrigin());
     } catch (e) {
       this.request.dispatchException(e);
     }
@@ -1434,11 +1634,11 @@ Ajax.Updater = Class.create(Ajax.Request, {
       failure: (container.failure || (container.success ? null : container))
     };
 
-    options = options || { };
+    options = Object.clone(options);
     var onComplete = options.onComplete;
-    options.onComplete = (function(response, param) {
+    options.onComplete = (function(response, json) {
       this.updateContent(response.responseText);
-      if (Object.isFunction(onComplete)) onComplete(response, param);
+      if (Object.isFunction(onComplete)) onComplete(response, json);
     }).bind(this);
 
     $super(url, options);
@@ -1460,10 +1660,6 @@ Ajax.Updater = Class.create(Ajax.Request, {
       }
       else receiver.update(responseText);
     }
-
-    if (this.success()) {
-      if (this.onComplete) this.onComplete.bind(this).defer();
-    }
   }
 });
 
@@ -1507,6 +1703,9 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
     this.updater = new Ajax.Updater(this.container, this.url, this.options);
   }
 });
+
+
+
 function $(element) {
   if (arguments.length > 1) {
     for (var i = 0, elements = [], length = arguments.length; i < length; i++)
@@ -1534,7 +1733,6 @@ if (Prototype.BrowserFeatures.XPath) {
 if (!window.Node) var Node = { };
 
 if (!Node.ELEMENT_NODE) {
-  // DOM level 2 ECMAScript Language Binding
   Object.extend(Node, {
     ELEMENT_NODE: 1,
     ATTRIBUTE_NODE: 2,
@@ -1551,13 +1749,30 @@ if (!Node.ELEMENT_NODE) {
   });
 }
 
-(function() {
-  var element = this.Element;
-  this.Element = function(tagName, attributes) {
+
+(function(global) {
+
+  var SETATTRIBUTE_IGNORES_NAME = (function(){
+    var elForm = document.createElement("form");
+    var elInput = document.createElement("input");
+    var root = document.documentElement;
+    elInput.setAttribute("name", "test");
+    elForm.appendChild(elInput);
+    root.appendChild(elForm);
+    var isBuggy = elForm.elements
+      ? (typeof elForm.elements.test == "undefined")
+      : null;
+    root.removeChild(elForm);
+    elForm = elInput = null;
+    return isBuggy;
+  })();
+
+  var element = global.Element;
+  global.Element = function(tagName, attributes) {
     attributes = attributes || { };
     tagName = tagName.toLowerCase();
     var cache = Element.cache;
-    if (Prototype.Browser.IE && attributes.name) {
+    if (SETATTRIBUTE_IGNORES_NAME && attributes.name) {
       tagName = '<' + tagName + ' name="' + attributes.name + '">';
       delete attributes.name;
       return Element.writeAttribute(document.createElement(tagName), attributes);
@@ -1565,10 +1780,12 @@ if (!Node.ELEMENT_NODE) {
     if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
     return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
   };
-  Object.extend(this.Element, element || { });
-}).call(window);
+  Object.extend(global.Element, element || { });
+  if (element) global.Element.prototype = element.prototype;
+})(this);
 
 Element.cache = { };
+Element.idCounter = 1;
 
 Element.Methods = {
   visible: function(element) {
@@ -1581,13 +1798,16 @@ Element.Methods = {
     return element;
   },
 
+
   hide: function(element) {
-    $(element).style.display = 'none';
+    element = $(element);
+    element.style.display = 'none';
     return element;
   },
 
   show: function(element) {
-    $(element).style.display = '';
+    element = $(element);
+    element.style.display = '';
     return element;
   },
 
@@ -1597,15 +1817,89 @@ Element.Methods = {
     return element;
   },
 
-  update: function(element, content) {
-    element = $(element);
-    if (content && content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-    content = Object.toHTML(content);
-    element.innerHTML = content.stripScripts();
-    content.evalScripts.bind(content).defer();
-    return element;
-  },
+  update: (function(){
+
+    var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
+      var el = document.createElement("select"),
+          isBuggy = true;
+      el.innerHTML = "<option value=\"test\">test</option>";
+      if (el.options && el.options[0]) {
+        isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
+      }
+      el = null;
+      return isBuggy;
+    })();
+
+    var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
+      try {
+        var el = document.createElement("table");
+        if (el && el.tBodies) {
+          el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
+          var isBuggy = typeof el.tBodies[0] == "undefined";
+          el = null;
+          return isBuggy;
+        }
+      } catch (e) {
+        return true;
+      }
+    })();
+
+    var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
+      var s = document.createElement("script"),
+          isBuggy = false;
+      try {
+        s.appendChild(document.createTextNode(""));
+        isBuggy = !s.firstChild ||
+          s.firstChild && s.firstChild.nodeType !== 3;
+      } catch (e) {
+        isBuggy = true;
+      }
+      s = null;
+      return isBuggy;
+    })();
+
+    function update(element, content) {
+      element = $(element);
+
+      if (content && content.toElement)
+        content = content.toElement();
+
+      if (Object.isElement(content))
+        return element.update().insert(content);
+
+      content = Object.toHTML(content);
+
+      var tagName = element.tagName.toUpperCase();
+
+      if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
+        element.text = content;
+        return element;
+      }
+
+      if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) {
+        if (tagName in Element._insertionTranslations.tags) {
+          while (element.firstChild) {
+            element.removeChild(element.firstChild);
+          }
+          Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+            .each(function(node) {
+              element.appendChild(node)
+            });
+        }
+        else {
+          element.innerHTML = content.stripScripts();
+        }
+      }
+      else {
+        element.innerHTML = content.stripScripts();
+      }
+
+      content.evalScripts.bind(content).defer();
+      return element;
+    }
+
+    return update;
+  })(),
 
   replace: function(element, content) {
     element = $(element);
@@ -1628,24 +1922,28 @@ Element.Methods = {
         Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
           insertions = {bottom:insertions};
 
-    var content, t, range;
+    var content, insert, tagName, childNodes;
 
-    for (position in insertions) {
+    for (var position in insertions) {
       content  = insertions[position];
       position = position.toLowerCase();
-      t = Element._insertionTranslations[position];
+      insert = Element._insertionTranslations[position];
 
       if (content && content.toElement) content = content.toElement();
       if (Object.isElement(content)) {
-        t.insert(element, content);
+        insert(element, content);
         continue;
       }
 
       content = Object.toHTML(content);
 
-      range = element.ownerDocument.createRange();
-      t.initializeRange(element, range);
-      t.insert(element, range.createContextualFragment(content.stripScripts()));
+      tagName = ((position == 'before' || position == 'after')
+        ? element.parentNode : element).tagName.toUpperCase();
+
+      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+      if (position == 'top' || position == 'after') childNodes.reverse();
+      childNodes.each(insert.curry(element));
 
       content.evalScripts.bind(content).defer();
     }
@@ -1686,11 +1984,11 @@ Element.Methods = {
   },
 
   ancestors: function(element) {
-    return $(element).recursivelyCollect('parentNode');
+    return Element.recursivelyCollect(element, 'parentNode');
   },
 
   descendants: function(element) {
-    return $A($(element).getElementsByTagName('*')).each(Element.extend);
+    return Element.select(element, "*");
   },
 
   firstDescendant: function(element) {
@@ -1707,16 +2005,17 @@ Element.Methods = {
   },
 
   previousSiblings: function(element) {
-    return $(element).recursivelyCollect('previousSibling');
+    return Element.recursivelyCollect(element, 'previousSibling');
   },
 
   nextSiblings: function(element) {
-    return $(element).recursivelyCollect('nextSibling');
+    return Element.recursivelyCollect(element, 'nextSibling');
   },
 
   siblings: function(element) {
     element = $(element);
-    return element.previousSiblings().reverse().concat(element.nextSiblings());
+    return Element.previousSiblings(element).reverse()
+      .concat(Element.nextSiblings(element));
   },
 
   match: function(element, selector) {
@@ -1728,51 +2027,51 @@ Element.Methods = {
   up: function(element, expression, index) {
     element = $(element);
     if (arguments.length == 1) return $(element.parentNode);
-    var ancestors = element.ancestors();
-    return expression ? Selector.findElement(ancestors, expression, index) :
-      ancestors[index || 0];
+    var ancestors = Element.ancestors(element);
+    return Object.isNumber(expression) ? ancestors[expression] :
+      Selector.findElement(ancestors, expression, index);
   },
 
   down: function(element, expression, index) {
     element = $(element);
-    if (arguments.length == 1) return element.firstDescendant();
-    var descendants = element.descendants();
-    return expression ? Selector.findElement(descendants, expression, index) :
-      descendants[index || 0];
+    if (arguments.length == 1) return Element.firstDescendant(element);
+    return Object.isNumber(expression) ? Element.descendants(element)[expression] :
+      Element.select(element, expression)[index || 0];
   },
 
   previous: function(element, expression, index) {
     element = $(element);
     if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
-    var previousSiblings = element.previousSiblings();
-    return expression ? Selector.findElement(previousSiblings, expression, index) :
-      previousSiblings[index || 0];
+    var previousSiblings = Element.previousSiblings(element);
+    return Object.isNumber(expression) ? previousSiblings[expression] :
+      Selector.findElement(previousSiblings, expression, index);
   },
 
   next: function(element, expression, index) {
     element = $(element);
     if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
-    var nextSiblings = element.nextSiblings();
-    return expression ? Selector.findElement(nextSiblings, expression, index) :
-      nextSiblings[index || 0];
+    var nextSiblings = Element.nextSiblings(element);
+    return Object.isNumber(expression) ? nextSiblings[expression] :
+      Selector.findElement(nextSiblings, expression, index);
   },
 
-  select: function() {
-    var args = $A(arguments), element = $(args.shift());
+
+  select: function(element) {
+    var args = Array.prototype.slice.call(arguments, 1);
     return Selector.findChildElements(element, args);
   },
 
-  adjacent: function() {
-    var args = $A(arguments), element = $(args.shift());
+  adjacent: function(element) {
+    var args = Array.prototype.slice.call(arguments, 1);
     return Selector.findChildElements(element.parentNode, args).without(element);
   },
 
   identify: function(element) {
     element = $(element);
-    var id = element.readAttribute('id'), self = arguments.callee;
+    var id = Element.readAttribute(element, 'id');
     if (id) return id;
-    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
-    element.writeAttribute('id', id);
+    do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
+    Element.writeAttribute(element, 'id', id);
     return id;
   },
 
@@ -1795,10 +2094,11 @@ Element.Methods = {
     var attributes = { }, t = Element._attributeTranslations.write;
 
     if (typeof name == 'object') attributes = name;
-    else attributes[name] = value === undefined ? true : value;
+    else attributes[name] = Object.isUndefined(value) ? true : value;
 
     for (var attr in attributes) {
-      var name = t.names[attr] || attr, value = attributes[attr];
+      name = t.names[attr] || attr;
+      value = attributes[attr];
       if (t.values[attr]) name = t.values[attr](element, value);
       if (value === false || value === null)
         element.removeAttribute(name);
@@ -1810,11 +2110,11 @@ Element.Methods = {
   },
 
   getHeight: function(element) {
-    return $(element).getDimensions().height;
+    return Element.getDimensions(element).height;
   },
 
   getWidth: function(element) {
-    return $(element).getDimensions().width;
+    return Element.getDimensions(element).width;
   },
 
   classNames: function(element) {
@@ -1830,7 +2130,7 @@ Element.Methods = {
 
   addClassName: function(element, className) {
     if (!(element = $(element))) return;
-    if (!element.hasClassName(className))
+    if (!Element.hasClassName(element, className))
       element.className += (element.className ? ' ' : '') + className;
     return element;
   },
@@ -1844,11 +2144,10 @@ Element.Methods = {
 
   toggleClassName: function(element, className) {
     if (!(element = $(element))) return;
-    return element[element.hasClassName(className) ?
-      'removeClassName' : 'addClassName'](className);
+    return Element[Element.hasClassName(element, className) ?
+      'removeClassName' : 'addClassName'](element, className);
   },
 
-  // removes whitespace-only text node children
   cleanWhitespace: function(element) {
     element = $(element);
     var node = element.firstChild;
@@ -1871,24 +2170,18 @@ Element.Methods = {
     if (element.compareDocumentPosition)
       return (element.compareDocumentPosition(ancestor) & 8) === 8;
 
-    if (element.sourceIndex && !Prototype.Browser.Opera) {
-      var e = element.sourceIndex, a = ancestor.sourceIndex,
-       nextAncestor = ancestor.nextSibling;
-      if (!nextAncestor) {
-        do { ancestor = ancestor.parentNode; }
-        while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
-      }
-      if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);
-    }
+    if (ancestor.contains)
+      return ancestor.contains(element) && ancestor !== element;
 
     while (element = element.parentNode)
       if (element == ancestor) return true;
+
     return false;
   },
 
   scrollTo: function(element) {
     element = $(element);
-    var pos = element.cumulativeOffset();
+    var pos = Element.cumulativeOffset(element);
     window.scrollTo(pos[0], pos[1]);
     return element;
   },
@@ -1897,7 +2190,7 @@ Element.Methods = {
     element = $(element);
     style = style == 'float' ? 'cssFloat' : style.camelize();
     var value = element.style[style];
-    if (!value) {
+    if (!value || value == 'auto') {
       var css = document.defaultView.getComputedStyle(element, null);
       value = css ? css[style] : null;
     }
@@ -1921,7 +2214,7 @@ Element.Methods = {
       if (property == 'opacity') element.setOpacity(styles[property]);
       else
         elementStyle[(property == 'float' || property == 'cssFloat') ?
-          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
+          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
             property] = styles[property];
 
     return element;
@@ -1936,18 +2229,17 @@ Element.Methods = {
 
   getDimensions: function(element) {
     element = $(element);
-    var display = $(element).getStyle('display');
+    var display = Element.getStyle(element, 'display');
     if (display != 'none' && display != null) // Safari bug
       return {width: element.offsetWidth, height: element.offsetHeight};
 
-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
     var els = element.style;
     var originalVisibility = els.visibility;
     var originalPosition = els.position;
     var originalDisplay = els.display;
     els.visibility = 'hidden';
-    els.position = 'absolute';
+    if (originalPosition != 'fixed') // Switching fixed to absolute causes issues in Safari
+      els.position = 'absolute';
     els.display = 'block';
     var originalWidth = element.clientWidth;
     var originalHeight = element.clientHeight;
@@ -1963,9 +2255,7 @@ Element.Methods = {
     if (pos == 'static' || !pos) {
       element._madePositioned = true;
       element.style.position = 'relative';
-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
+      if (Prototype.Browser.Opera) {
         element.style.top = 0;
         element.style.left = 0;
       }
@@ -2020,9 +2310,9 @@ Element.Methods = {
       valueL += element.offsetLeft || 0;
       element = element.offsetParent;
       if (element) {
-        if (element.tagName == 'BODY') break;
+        if (element.tagName.toUpperCase() == 'BODY') break;
         var p = Element.getStyle(element, 'position');
-        if (p == 'relative' || p == 'absolute') break;
+        if (p !== 'static') break;
       }
     } while (element);
     return Element._returnOffset(valueL, valueT);
@@ -2030,10 +2320,9 @@ Element.Methods = {
 
   absolutize: function(element) {
     element = $(element);
-    if (element.getStyle('position') == 'absolute') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
+    if (Element.getStyle(element, 'position') == 'absolute') return element;
 
-    var offsets = element.positionedOffset();
+    var offsets = Element.positionedOffset(element);
     var top     = offsets[1];
     var left    = offsets[0];
     var width   = element.clientWidth;
@@ -2054,8 +2343,7 @@ Element.Methods = {
 
   relativize: function(element) {
     element = $(element);
-    if (element.getStyle('position') == 'relative') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
+    if (Element.getStyle(element, 'position') == 'relative') return element;
 
     element.style.position = 'relative';
     var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
@@ -2097,7 +2385,6 @@ Element.Methods = {
       valueT += element.offsetTop  || 0;
       valueL += element.offsetLeft || 0;
 
-      // Safari fix
       if (element.offsetParent == document.body &&
         Element.getStyle(element, 'position') == 'absolute') break;
 
@@ -2105,7 +2392,7 @@ Element.Methods = {
 
     element = forElement;
     do {
-      if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
+      if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
         valueT -= element.scrollTop  || 0;
         valueL -= element.scrollLeft || 0;
       }
@@ -2124,28 +2411,22 @@ Element.Methods = {
       offsetLeft: 0
     }, arguments[2] || { });
 
-    // find page position of source
     source = $(source);
-    var p = source.viewportOffset();
+    var p = Element.viewportOffset(source);
 
-    // find coordinate system to use
     element = $(element);
     var delta = [0, 0];
     var parent = null;
-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
     if (Element.getStyle(element, 'position') == 'absolute') {
-      parent = element.getOffsetParent();
-      delta = parent.viewportOffset();
+      parent = Element.getOffsetParent(element);
+      delta = Element.viewportOffset(parent);
     }
 
-    // correct by body offsets (fixes Safari)
     if (parent == document.body) {
       delta[0] -= document.body.offsetLeft;
       delta[1] -= document.body.offsetTop;
     }
 
-    // set position
     if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
     if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
     if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
@@ -2154,10 +2435,9 @@ Element.Methods = {
   }
 };
 
-Element.Methods.identify.counter = 1;
-
 Object.extend(Element.Methods, {
   getElementsBySelector: Element.Methods.select,
+
   childElements: Element.Methods.immediateDescendants
 });
 
@@ -2171,72 +2451,72 @@ Element._attributeTranslations = {
   }
 };
 
-
-if (!document.createRange || Prototype.Browser.Opera) {
-  Element.Methods.insert = function(element, insertions) {
-    element = $(element);
-
-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
-          insertions = { bottom: insertions };
-
-    var t = Element._insertionTranslations, content, position, pos, tagName;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      pos      = t[position];
-
-      if (content && content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        pos.insert(element, content);
-        continue;
-      }
-
-      content = Object.toHTML(content);
-      tagName = ((position == 'before' || position == 'after')
-        ? element.parentNode : element).tagName.toUpperCase();
-
-      if (t.tags[tagName]) {
-        var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-        if (position == 'top' || position == 'after') fragments.reverse();
-        fragments.each(pos.insert.curry(element));
+if (Prototype.Browser.Opera) {
+  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+    function(proceed, element, style) {
+      switch (style) {
+        case 'left': case 'top': case 'right': case 'bottom':
+          if (proceed(element, 'position') === 'static') return null;
+        case 'height': case 'width':
+          if (!Element.visible(element)) return null;
+
+          var dim = parseInt(proceed(element, style), 10);
+
+          if (dim !== element['offset' + style.capitalize()])
+            return dim + 'px';
+
+          var properties;
+          if (style === 'height') {
+            properties = ['border-top-width', 'padding-top',
+             'padding-bottom', 'border-bottom-width'];
+          }
+          else {
+            properties = ['border-left-width', 'padding-left',
+             'padding-right', 'border-right-width'];
+          }
+          return properties.inject(dim, function(memo, property) {
+            var val = proceed(element, property);
+            return val === null ? memo : memo - parseInt(val, 10);
+          }) + 'px';
+        default: return proceed(element, style);
       }
-      else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
-
-      content.evalScripts.bind(content).defer();
     }
+  );
 
-    return element;
-  };
-}
-
-if (Prototype.Browser.Opera) {
-  Element.Methods._getStyle = Element.Methods.getStyle;
-  Element.Methods.getStyle = function(element, style) {
-    switch(style) {
-      case 'left':
-      case 'top':
-      case 'right':
-      case 'bottom':
-        if (Element._getStyle(element, 'position') == 'static') return null;
-      default: return Element._getStyle(element, style);
+  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+    function(proceed, element, attribute) {
+      if (attribute === 'title') return element.title;
+      return proceed(element, attribute);
     }
-  };
-  Element.Methods._readAttribute = Element.Methods.readAttribute;
-  Element.Methods.readAttribute = function(element, attribute) {
-    if (attribute == 'title') return element.title;
-    return Element._readAttribute(element, attribute);
-  };
+  );
 }
 
 else if (Prototype.Browser.IE) {
-  $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
+  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+    function(proceed, element) {
+      element = $(element);
+      try { element.offsetParent }
+      catch(e) { return $(document.body) }
+      var position = element.getStyle('position');
+      if (position !== 'static') return proceed(element);
+      element.setStyle({ position: 'relative' });
+      var value = proceed(element);
+      element.setStyle({ position: position });
+      return value;
+    }
+  );
+
+  $w('positionedOffset viewportOffset').each(function(method) {
     Element.Methods[method] = Element.Methods[method].wrap(
       function(proceed, element) {
         element = $(element);
+        try { element.offsetParent }
+        catch(e) { return Element._returnOffset(0,0) }
         var position = element.getStyle('position');
-        if (position != 'static') return proceed(element);
+        if (position !== 'static') return proceed(element);
+        var offsetParent = element.getOffsetParent();
+        if (offsetParent && offsetParent.getStyle('position') === 'fixed')
+          offsetParent.setStyle({ zoom: 1 });
         element.setStyle({ position: 'relative' });
         var value = proceed(element);
         element.setStyle({ position: position });
@@ -2245,6 +2525,14 @@ else if (Prototype.Browser.IE) {
     );
   });
 
+  Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
+    function(proceed, element) {
+      try { element.offsetParent }
+      catch(e) { return Element._returnOffset(0,0) }
+      return proceed(element);
+    }
+  );
+
   Element.Methods.getStyle = function(element, style) {
     element = $(element);
     style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
@@ -2286,39 +2574,98 @@ else if (Prototype.Browser.IE) {
     return element;
   };
 
-  Element._attributeTranslations = {
-    read: {
-      names: {
-        'class': 'className',
-        'for':   'htmlFor'
-      },
-      values: {
-        _getAttr: function(element, attribute) {
-          return element.getAttribute(attribute, 2);
-        },
-        _getAttrNode: function(element, attribute) {
-          var node = element.getAttributeNode(attribute);
-          return node ? node.value : "";
-        },
-        _getEv: function(element, attribute) {
-          var attribute = element.getAttribute(attribute);
-          return attribute ? attribute.toString().slice(23, -2) : null;
-        },
-        _flag: function(element, attribute) {
-          return $(element).hasAttribute(attribute) ? attribute : null;
-        },
-        style: function(element) {
-          return element.style.cssText.toLowerCase();
+  Element._attributeTranslations = (function(){
+
+    var classProp = 'className';
+    var forProp = 'for';
+
+    var el = document.createElement('div');
+
+    el.setAttribute(classProp, 'x');
+
+    if (el.className !== 'x') {
+      el.setAttribute('class', 'x');
+      if (el.className === 'x') {
+        classProp = 'class';
+      }
+    }
+    el = null;
+
+    el = document.createElement('label');
+    el.setAttribute(forProp, 'x');
+    if (el.htmlFor !== 'x') {
+      el.setAttribute('htmlFor', 'x');
+      if (el.htmlFor === 'x') {
+        forProp = 'htmlFor';
+      }
+    }
+    el = null;
+
+    return {
+      read: {
+        names: {
+          'class':      classProp,
+          'className':  classProp,
+          'for':        forProp,
+          'htmlFor':    forProp
         },
-        title: function(element) {
-          return element.title;
+        values: {
+          _getAttr: function(element, attribute) {
+            return element.getAttribute(attribute);
+          },
+          _getAttr2: function(element, attribute) {
+            return element.getAttribute(attribute, 2);
+          },
+          _getAttrNode: function(element, attribute) {
+            var node = element.getAttributeNode(attribute);
+            return node ? node.value : "";
+          },
+          _getEv: (function(){
+
+            var el = document.createElement('div');
+            el.onclick = Prototype.emptyFunction;
+            var value = el.getAttribute('onclick');
+            var f;
+
+            if (String(value).indexOf('{') > -1) {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                attribute = attribute.toString();
+                attribute = attribute.split('{')[1];
+                attribute = attribute.split('}')[0];
+                return attribute.strip();
+              };
+            }
+            else if (value === '') {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                return attribute.strip();
+              };
+            }
+            el = null;
+            return f;
+          })(),
+          _flag: function(element, attribute) {
+            return $(element).hasAttribute(attribute) ? attribute : null;
+          },
+          style: function(element) {
+            return element.style.cssText.toLowerCase();
+          },
+          title: function(element) {
+            return element.title;
+          }
         }
       }
     }
-  };
+  })();
 
   Element._attributeTranslations.write = {
-    names: Object.clone(Element._attributeTranslations.read.names),
+    names: Object.extend({
+      cellpadding: 'cellPadding',
+      cellspacing: 'cellSpacing'
+    }, Element._attributeTranslations.read.names),
     values: {
       checked: function(element, value) {
         element.checked = !!value;
@@ -2333,15 +2680,15 @@ else if (Prototype.Browser.IE) {
   Element._attributeTranslations.has = {};
 
   $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
-      'encType maxLength readOnly longDesc').each(function(attr) {
+      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
     Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
     Element._attributeTranslations.has[attr.toLowerCase()] = attr;
   });
 
   (function(v) {
     Object.extend(v, {
-      href:        v._getAttr,
-      src:         v._getAttr,
+      href:        v._getAttr2,
+      src:         v._getAttr2,
       type:        v._getAttr,
       action:      v._getAttrNode,
       disabled:    v._flag,
@@ -2368,6 +2715,26 @@ else if (Prototype.Browser.IE) {
       onchange:    v._getEv
     });
   })(Element._attributeTranslations.read.values);
+
+  if (Prototype.BrowserFeatures.ElementExtensions) {
+    (function() {
+      function _descendants(element) {
+        var nodes = element.getElementsByTagName('*'), results = [];
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.tagName !== "!") // Filter out comment nodes.
+            results.push(node);
+        return results;
+      }
+
+      Element.Methods.down = function(element, expression, index) {
+        element = $(element);
+        if (arguments.length == 1) return element.firstDescendant();
+        return Object.isNumber(expression) ? _descendants(element)[expression] :
+          Element.select(element, expression)[index || 0];
+      }
+    })();
+  }
+
 }
 
 else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
@@ -2386,7 +2753,7 @@ else if (Prototype.Browser.WebKit) {
       (value < 0.00001) ? 0 : value;
 
     if (value == 1)
-      if(element.tagName == 'IMG' && element.width) {
+      if(element.tagName.toUpperCase() == 'IMG' && element.width) {
         element.width++; element.width--;
       } else try {
         var n = document.createTextNode(' ');
@@ -2397,9 +2764,6 @@ else if (Prototype.Browser.WebKit) {
     return element;
   };
 
-  // Safari returns margins on body which is incorrect if the child is absolutely
-  // positioned.  For performance reasons, redefine Position.cumulativeOffset for
-  // KHTML/WebKit only.
   Element.Methods.cumulativeOffset = function(element) {
     var valueT = 0, valueL = 0;
     do {
@@ -2415,30 +2779,7 @@ else if (Prototype.Browser.WebKit) {
   };
 }
 
-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
-  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
-  Element.Methods.update = function(element, content) {
-    element = $(element);
-
-    if (content && content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-
-    content = Object.toHTML(content);
-    var tagName = element.tagName.toUpperCase();
-
-    if (tagName in Element._insertionTranslations.tags) {
-      $A(element.childNodes).each(function(node) { element.removeChild(node) });
-      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
-        .each(function(node) { element.appendChild(node) });
-    }
-    else element.innerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-if (document.createElement('div').outerHTML) {
+if ('outerHTML' in document.documentElement) {
   Element.Methods.replace = function(element, content) {
     element = $(element);
 
@@ -2476,45 +2817,25 @@ Element._returnOffset = function(l, t) {
 
 Element._getContentFromAnonymousElement = function(tagName, html) {
   var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
-  div.innerHTML = t[0] + html + t[1];
-  t[2].times(function() { div = div.firstChild });
+  if (t) {
+    div.innerHTML = t[0] + html + t[1];
+    t[2].times(function() { div = div.firstChild });
+  } else div.innerHTML = html;
   return $A(div.childNodes);
 };
 
 Element._insertionTranslations = {
-  before: {
-    adjacency: 'beforeBegin',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element);
-    },
-    initializeRange: function(element, range) {
-      range.setStartBefore(element);
-    }
+  before: function(element, node) {
+    element.parentNode.insertBefore(node, element);
   },
-  top: {
-    adjacency: 'afterBegin',
-    insert: function(element, node) {
-      element.insertBefore(node, element.firstChild);
-    },
-    initializeRange: function(element, range) {
-      range.selectNodeContents(element);
-      range.collapse(true);
-    }
+  top: function(element, node) {
+    element.insertBefore(node, element.firstChild);
   },
-  bottom: {
-    adjacency: 'beforeEnd',
-    insert: function(element, node) {
-      element.appendChild(node);
-    }
+  bottom: function(element, node) {
+    element.appendChild(node);
   },
-  after: {
-    adjacency: 'afterEnd',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element.nextSibling);
-    },
-    initializeRange: function(element, range) {
-      range.setStartAfter(element);
-    }
+  after: function(element, node) {
+    element.parentNode.insertBefore(node, element.nextSibling);
   },
   tags: {
     TABLE:  ['<table>',                '</table>',                   1],
@@ -2526,19 +2847,19 @@ Element._insertionTranslations = {
 };
 
 (function() {
-  this.bottom.initializeRange = this.top.initializeRange;
-  Object.extend(this.tags, {
-    THEAD: this.tags.TBODY,
-    TFOOT: this.tags.TBODY,
-    TH:    this.tags.TD
+  var tags = Element._insertionTranslations.tags;
+  Object.extend(tags, {
+    THEAD: tags.TBODY,
+    TFOOT: tags.TBODY,
+    TH:    tags.TD
   });
-}).call(Element._insertionTranslations);
+})();
 
 Element.Methods.Simulated = {
   hasAttribute: function(element, attribute) {
     attribute = Element._attributeTranslations.has[attribute] || attribute;
     var node = $(element).getAttributeNode(attribute);
-    return node && node.specified;
+    return !!(node && node.specified);
   }
 };
 
@@ -2546,41 +2867,81 @@ Element.Methods.ByTag = { };
 
 Object.extend(Element, Element.Methods);
 
-if (!Prototype.BrowserFeatures.ElementExtensions &&
-    document.createElement('div').__proto__) {
-  window.HTMLElement = { };
-  window.HTMLElement.prototype = document.createElement('div').__proto__;
-  Prototype.BrowserFeatures.ElementExtensions = true;
-}
+(function(div) {
+
+  if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
+    window.HTMLElement = { };
+    window.HTMLElement.prototype = div['__proto__'];
+    Prototype.BrowserFeatures.ElementExtensions = true;
+  }
+
+  div = null;
+
+})(document.createElement('div'))
 
 Element.extend = (function() {
-  if (Prototype.BrowserFeatures.SpecificElementExtensions)
+
+  function checkDeficiency(tagName) {
+    if (typeof window.Element != 'undefined') {
+      var proto = window.Element.prototype;
+      if (proto) {
+        var id = '_' + (Math.random()+'').slice(2);
+        var el = document.createElement(tagName);
+        proto[id] = 'x';
+        var isBuggy = (el[id] !== 'x');
+        delete proto[id];
+        el = null;
+        return isBuggy;
+      }
+    }
+    return false;
+  }
+
+  function extendElementWith(element, methods) {
+    for (var property in methods) {
+      var value = methods[property];
+      if (Object.isFunction(value) && !(property in element))
+        element[property] = value.methodize();
+    }
+  }
+
+  var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
+
+  if (Prototype.BrowserFeatures.SpecificElementExtensions) {
+    if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
+      return function(element) {
+        if (element && typeof element._extendedByPrototype == 'undefined') {
+          var t = element.tagName;
+          if (t && (/^(?:object|applet|embed)$/i.test(t))) {
+            extendElementWith(element, Element.Methods);
+            extendElementWith(element, Element.Methods.Simulated);
+            extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
+          }
+        }
+        return element;
+      }
+    }
     return Prototype.K;
+  }
 
   var Methods = { }, ByTag = Element.Methods.ByTag;
 
   var extend = Object.extend(function(element) {
-    if (!element || element._extendedByPrototype ||
+    if (!element || typeof element._extendedByPrototype != 'undefined' ||
         element.nodeType != 1 || element == window) return element;
 
     var methods = Object.clone(Methods),
-      tagName = element.tagName, property, value;
+        tagName = element.tagName.toUpperCase();
 
-    // extend methods for specific tags
     if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
 
-    for (property in methods) {
-      value = methods[property];
-      if (Object.isFunction(value) && !(property in element))
-        element[property] = value.methodize();
-    }
+    extendElementWith(element, methods);
 
     element._extendedByPrototype = Prototype.emptyFunction;
     return element;
 
   }, {
     refresh: function() {
-      // extend methods for all tags (Safari doesn't need this)
       if (!Prototype.BrowserFeatures.ElementExtensions) {
         Object.extend(Methods, Element.Methods);
         Object.extend(Methods, Element.Methods.Simulated);
@@ -2659,14 +3020,18 @@ Element.addMethods = function(methods) {
     klass = 'HTML' + tagName.capitalize() + 'Element';
     if (window[klass]) return window[klass];
 
-    window[klass] = { };
-    window[klass].prototype = document.createElement(tagName).__proto__;
-    return window[klass];
+    var element = document.createElement(tagName);
+    var proto = element['__proto__'] || element.constructor.prototype;
+    element = null;
+    return proto;
   }
 
+  var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
+   Element.prototype;
+
   if (F.ElementExtensions) {
-    copy(Element.Methods, HTMLElement.prototype);
-    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+    copy(Element.Methods, elementPrototype);
+    copy(Element.Methods.Simulated, elementPrototype, true);
   }
 
   if (F.SpecificElementExtensions) {
@@ -2680,52 +3045,191 @@ Element.addMethods = function(methods) {
   Object.extend(Element, Element.Methods);
   delete Element.ByTag;
 
-  if (Element.extend.refresh) Element.extend.refresh();
-  Element.cache = { };
-};
+  if (Element.extend.refresh) Element.extend.refresh();
+  Element.cache = { };
+};
+
+
+document.viewport = {
+
+  getDimensions: function() {
+    return { width: this.getWidth(), height: this.getHeight() };
+  },
+
+  getScrollOffsets: function() {
+    return Element._returnOffset(
+      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+      window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop);
+  }
+};
+
+(function(viewport) {
+  var B = Prototype.Browser, doc = document, element, property = {};
+
+  function getRootElement() {
+    if (B.WebKit && !doc.evaluate)
+      return document;
+
+    if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
+      return document.body;
+
+    return document.documentElement;
+  }
+
+  function define(D) {
+    if (!element) element = getRootElement();
+
+    property[D] = 'client' + D;
+
+    viewport['get' + D] = function() { return element[property[D]] };
+    return viewport['get' + D]();
+  }
+
+  viewport.getWidth  = define.curry('Width');
+
+  viewport.getHeight = define.curry('Height');
+})(document.viewport);
+
+
+Element.Storage = {
+  UID: 1
+};
+
+Element.addMethods({
+  getStorage: function(element) {
+    if (!(element = $(element))) return;
+
+    var uid;
+    if (element === window) {
+      uid = 0;
+    } else {
+      if (typeof element._prototypeUID === "undefined")
+        element._prototypeUID = [Element.Storage.UID++];
+      uid = element._prototypeUID[0];
+    }
+
+    if (!Element.Storage[uid])
+      Element.Storage[uid] = $H();
 
-document.viewport = {
-  getDimensions: function() {
-    var dimensions = { };
-    $w('width height').each(function(d) {
-      var D = d.capitalize();
-      dimensions[d] = self['inner' + D] ||
-       (document.documentElement['client' + D] || document.body['client' + D]);
-    });
-    return dimensions;
+    return Element.Storage[uid];
   },
 
-  getWidth: function() {
-    return this.getDimensions().width;
+  store: function(element, key, value) {
+    if (!(element = $(element))) return;
+
+    if (arguments.length === 2) {
+      Element.getStorage(element).update(key);
+    } else {
+      Element.getStorage(element).set(key, value);
+    }
+
+    return element;
   },
 
-  getHeight: function() {
-    return this.getDimensions().height;
+  retrieve: function(element, key, defaultValue) {
+    if (!(element = $(element))) return;
+    var hash = Element.getStorage(element), value = hash.get(key);
+
+    if (Object.isUndefined(value)) {
+      hash.set(key, defaultValue);
+      value = defaultValue;
+    }
+
+    return value;
   },
 
-  getScrollOffsets: function() {
-    return Element._returnOffset(
-      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
-      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
+  clone: function(element, deep) {
+    if (!(element = $(element))) return;
+    var clone = element.cloneNode(deep);
+    clone._prototypeUID = void 0;
+    if (deep) {
+      var descendants = Element.select(clone, '*'),
+          i = descendants.length;
+      while (i--) {
+        descendants[i]._prototypeUID = void 0;
+      }
+    }
+    return Element.extend(clone);
   }
-};
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
+});
+/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
  * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
  * license.  Please see http://www.yui-ext.com/ for more information. */
 
 var Selector = Class.create({
   initialize: function(expression) {
     this.expression = expression.strip();
-    this.compileMatcher();
+
+    if (this.shouldUseSelectorsAPI()) {
+      this.mode = 'selectorsAPI';
+    } else if (this.shouldUseXPath()) {
+      this.mode = 'xpath';
+      this.compileXPathMatcher();
+    } else {
+      this.mode = "normal";
+      this.compileMatcher();
+    }
+
   },
 
-  compileMatcher: function() {
-    // Selectors with namespaced attributes can't use the XPath version
-    if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression))
-      return this.compileXPathMatcher();
+  shouldUseXPath: (function() {
 
+    var IS_DESCENDANT_SELECTOR_BUGGY = (function(){
+      var isBuggy = false;
+      if (document.evaluate && window.XPathResult) {
+        var el = document.createElement('div');
+        el.innerHTML = '<ul><li></li></ul><div><ul><li></li></ul></div>';
+
+        var xpath = ".//*[local-name()='ul' or local-name()='UL']" +
+          "//*[local-name()='li' or local-name()='LI']";
+
+        var result = document.evaluate(xpath, el, null,
+          XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+
+        isBuggy = (result.snapshotLength !== 2);
+        el = null;
+      }
+      return isBuggy;
+    })();
+
+    return function() {
+      if (!Prototype.BrowserFeatures.XPath) return false;
+
+      var e = this.expression;
+
+      if (Prototype.Browser.WebKit &&
+       (e.include("-of-type") || e.include(":empty")))
+        return false;
+
+      if ((/(\[[\w-]*?:|:checked)/).test(e))
+        return false;
+
+      if (IS_DESCENDANT_SELECTOR_BUGGY) return false;
+
+      return true;
+    }
+
+  })(),
+
+  shouldUseSelectorsAPI: function() {
+    if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
+
+    if (Selector.CASE_INSENSITIVE_CLASS_NAMES) return false;
+
+    if (!Selector._div) Selector._div = new Element('div');
+
+    try {
+      Selector._div.querySelector(this.expression);
+    } catch(e) {
+      return false;
+    }
+
+    return true;
+  },
+
+  compileMatcher: function() {
     var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
-        c = Selector.criteria, le, p, m;
+        c = Selector.criteria, le, p, m, len = ps.length, name;
 
     if (Selector._cache[e]) {
       this.matcher = Selector._cache[e];
@@ -2737,11 +3241,12 @@ var Selector = Class.create({
 
     while (e && le != e && (/\S/).test(e)) {
       le = e;
-      for (var i in ps) {
-        p = ps[i];
+      for (var i = 0; i<len; i++) {
+        p = ps[i].re;
+        name = ps[i].name;
         if (m = e.match(p)) {
-          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
-             new Template(c[i]).evaluate(m));
+          this.matcher.push(Object.isFunction(c[name]) ? c[name](m) :
+            new Template(c[name]).evaluate(m));
           e = e.replace(m[0], '');
           break;
         }
@@ -2755,7 +3260,7 @@ var Selector = Class.create({
 
   compileXPathMatcher: function() {
     var e = this.expression, ps = Selector.patterns,
-        x = Selector.xpath, le, m;
+        x = Selector.xpath, le, m, len = ps.length, name;
 
     if (Selector._cache[e]) {
       this.xpath = Selector._cache[e]; return;
@@ -2764,10 +3269,11 @@ var Selector = Class.create({
     this.matcher = ['.//*'];
     while (e && le != e && (/\S/).test(e)) {
       le = e;
-      for (var i in ps) {
-        if (m = e.match(ps[i])) {
-          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
-            new Template(x[i]).evaluate(m));
+      for (var i = 0; i<len; i++) {
+        name = ps[i].name;
+        if (m = e.match(ps[i].re)) {
+          this.matcher.push(Object.isFunction(x[name]) ? x[name](m) :
+            new Template(x[name]).evaluate(m));
           e = e.replace(m[0], '');
           break;
         }
@@ -2780,29 +3286,43 @@ var Selector = Class.create({
 
   findElements: function(root) {
     root = root || document;
-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    return this.matcher(root);
+    var e = this.expression, results;
+
+    switch (this.mode) {
+      case 'selectorsAPI':
+        if (root !== document) {
+          var oldId = root.id, id = $(root).identify();
+          id = id.replace(/([\.:])/g, "\\$1");
+          e = "#" + id + " " + e;
+        }
+
+        results = $A(root.querySelectorAll(e)).map(Element.extend);
+        root.id = oldId;
+
+        return results;
+      case 'xpath':
+        return document._getElementsByXPath(this.xpath, root);
+      default:
+       return this.matcher(root);
+    }
   },
 
   match: function(element) {
     this.tokens = [];
 
     var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
-    var le, p, m;
+    var le, p, m, len = ps.length, name;
 
     while (e && le !== e && (/\S/).test(e)) {
       le = e;
-      for (var i in ps) {
-        p = ps[i];
+      for (var i = 0; i<len; i++) {
+        p = ps[i].re;
+        name = ps[i].name;
         if (m = e.match(p)) {
-          // use the Selector.assertions methods unless the selector
-          // is too complex.
-          if (as[i]) {
-            this.tokens.push([i, Object.clone(m)]);
+          if (as[name]) {
+            this.tokens.push([name, Object.clone(m)]);
             e = e.replace(m[0], '');
           } else {
-            // reluctantly do a document-wide search
-            // and look for a match in the array
             return this.findElements(document).include(element);
           }
         }
@@ -2829,6 +3349,21 @@ var Selector = Class.create({
   }
 });
 
+if (Prototype.BrowserFeatures.SelectorsAPI &&
+ document.compatMode === 'BackCompat') {
+  Selector.CASE_INSENSITIVE_CLASS_NAMES = (function(){
+    var div = document.createElement('div'),
+     span = document.createElement('span');
+
+    div.id = "prototype_test_id";
+    span.className = 'Test';
+    div.appendChild(span);
+    var isIgnored = (div.querySelector('#prototype_test_id .test') !== null);
+    div = span = null;
+    return isIgnored;
+  })();
+}
+
 Object.extend(Selector, {
   _cache: { },
 
@@ -2844,8 +3379,12 @@ Object.extend(Selector, {
     },
     className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
     id:           "[@id='#{1}']",
-    attrPresence: "[@#{1}]",
+    attrPresence: function(m) {
+      m[1] = m[1].toLowerCase();
+      return new Template("[@#{1}]").evaluate(m);
+    },
     attr: function(m) {
+      m[1] = m[1].toLowerCase();
       m[3] = m[5] || m[6];
       return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
     },
@@ -2868,20 +3407,21 @@ Object.extend(Selector, {
       'first-child': '[not(preceding-sibling::*)]',
       'last-child':  '[not(following-sibling::*)]',
       'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
-      'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
+      'empty':       "[count(*) = 0 and (count(text()) = 0)]",
       'checked':     "[@checked]",
-      'disabled':    "[@disabled]",
-      'enabled':     "[not(@disabled)]",
+      'disabled':    "[(@disabled) and (@type!='hidden')]",
+      'enabled':     "[not(@disabled) and (@type!='hidden')]",
       'not': function(m) {
         var e = m[6], p = Selector.patterns,
-            x = Selector.xpath, le, m, v;
+            x = Selector.xpath, le, v, len = p.length, name;
 
         var exclusion = [];
         while (e && le != e && (/\S/).test(e)) {
           le = e;
-          for (var i in p) {
-            if (m = e.match(p[i])) {
-              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
+          for (var i = 0; i<len; i++) {
+            name = p[i].name
+            if (m = e.match(p[i].re)) {
+              v = Object.isFunction(x[name]) ? x[name](m) : new Template(x[name]).evaluate(m);
               exclusion.push("(" + v.substring(1, v.length - 1) + ")");
               e = e.replace(m[0], '');
               break;
@@ -2931,13 +3471,13 @@ Object.extend(Selector, {
   },
 
   criteria: {
-    tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;',
-    className:    'n = h.className(n, r, "#{1}", c); c = false;',
-    id:           'n = h.id(n, r, "#{1}", c);        c = false;',
-    attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
+    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',
+    className:    'n = h.className(n, r, "#{1}", c);    c = false;',
+    id:           'n = h.id(n, r, "#{1}", c);           c = false;',
+    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
     attr: function(m) {
       m[3] = (m[5] || m[6]);
-      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
+      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
     },
     pseudo: function(m) {
       if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
@@ -2949,24 +3489,20 @@ Object.extend(Selector, {
     laterSibling: 'c = "laterSibling";'
   },
 
-  patterns: {
-    // combinators must be listed first
-    // (and descendant needs to be last combinator)
-    laterSibling: /^\s*~\s*/,
-    child:        /^\s*>\s*/,
-    adjacent:     /^\s*\+\s*/,
-    descendant:   /^\s/,
+  patterns: [
+    { name: 'laterSibling', re: /^\s*~\s*/ },
+    { name: 'child',        re: /^\s*>\s*/ },
+    { name: 'adjacent',     re: /^\s*\+\s*/ },
+    { name: 'descendant',   re: /^\s/ },
 
-    // selectors follow
-    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
-    id:           /^#([\w\-\*]+)(\b|$)/,
-    className:    /^\.([\w\-\*]+)(\b|$)/,
-    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
-    attrPresence: /^\[([\w]+)\]/,
-    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
-  },
+    { name: 'tagName',      re: /^\s*(\*|[\w\-]+)(\b|$)?/ },
+    { name: 'id',           re: /^#([\w\-\*]+)(\b|$)/ },
+    { name: 'className',    re: /^\.([\w\-\*]+)(\b|$)/ },
+    { name: 'pseudo',       re: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/ },
+    { name: 'attrPresence', re: /^\[((?:[\w-]+:)?[\w-]+)\]/ },
+    { name: 'attr',         re: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }
+  ],
 
-  // for Selector.match and Element#match
   assertions: {
     tagName: function(element, matches) {
       return matches[1].toUpperCase() == element.tagName.toUpperCase();
@@ -2986,61 +3522,74 @@ Object.extend(Selector, {
 
     attr: function(element, matches) {
       var nodeValue = Element.readAttribute(element, matches[1]);
-      return Selector.operators[matches[2]](nodeValue, matches[3]);
+      return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
     }
   },
 
   handlers: {
-    // UTILITY FUNCTIONS
-    // joins two collections
     concat: function(a, b) {
       for (var i = 0, node; node = b[i]; i++)
         a.push(node);
       return a;
     },
 
-    // marks an array of nodes for counting
     mark: function(nodes) {
+      var _true = Prototype.emptyFunction;
       for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = true;
+        node._countedByPrototype = _true;
       return nodes;
     },
 
-    unmark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = undefined;
-      return nodes;
-    },
+    unmark: (function(){
+
+      var PROPERTIES_ATTRIBUTES_MAP = (function(){
+        var el = document.createElement('div'),
+            isBuggy = false,
+            propName = '_countedByPrototype',
+            value = 'x'
+        el[propName] = value;
+        isBuggy = (el.getAttribute(propName) === value);
+        el = null;
+        return isBuggy;
+      })();
+
+      return PROPERTIES_ATTRIBUTES_MAP ?
+        function(nodes) {
+          for (var i = 0, node; node = nodes[i]; i++)
+            node.removeAttribute('_countedByPrototype');
+          return nodes;
+        } :
+        function(nodes) {
+          for (var i = 0, node; node = nodes[i]; i++)
+            node._countedByPrototype = void 0;
+          return nodes;
+        }
+    })(),
 
-    // mark each child node with its position (for nth calls)
-    // "ofType" flag indicates whether we're indexing for nth-of-type
-    // rather than nth-child
     index: function(parentNode, reverse, ofType) {
-      parentNode._counted = true;
+      parentNode._countedByPrototype = Prototype.emptyFunction;
       if (reverse) {
         for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
           var node = nodes[i];
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
         }
       } else {
         for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
       }
     },
 
-    // filters out duplicates and extends all nodes
     unique: function(nodes) {
       if (nodes.length == 0) return nodes;
       var results = [], n;
       for (var i = 0, l = nodes.length; i < l; i++)
-        if (!(n = nodes[i])._counted) {
-          n._counted = true;
+        if (typeof (n = nodes[i])._countedByPrototype == 'undefined') {
+          n._countedByPrototype = Prototype.emptyFunction;
           results.push(Element.extend(n));
         }
       return Selector.handlers.unmark(results);
     },
 
-    // COMBINATOR FUNCTIONS
     descendant: function(nodes) {
       var h = Selector.handlers;
       for (var i = 0, results = [], node; node = nodes[i]; i++)
@@ -3051,7 +3600,7 @@ Object.extend(Selector, {
     child: function(nodes) {
       var h = Selector.handlers;
       for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
+        for (var j = 0, child; child = node.childNodes[j]; j++)
           if (child.nodeType == 1 && child.tagName != '!') results.push(child);
       }
       return results;
@@ -3074,7 +3623,7 @@ Object.extend(Selector, {
 
     nextElementSibling: function(node) {
       while (node = node.nextSibling)
-             if (node.nodeType == 1) return node;
+        if (node.nodeType == 1) return node;
       return null;
     },
 
@@ -3084,13 +3633,11 @@ Object.extend(Selector, {
       return null;
     },
 
-    // TOKEN FUNCTIONS
     tagName: function(nodes, root, tagName, combinator) {
-      tagName = tagName.toUpperCase();
+      var uTagName = tagName.toUpperCase();
       var results = [], h = Selector.handlers;
       if (nodes) {
         if (combinator) {
-          // fastlane for ordinary descendant combinators
           if (combinator == "descendant") {
             for (var i = 0, node; node = nodes[i]; i++)
               h.concat(results, node.getElementsByTagName(tagName));
@@ -3099,15 +3646,26 @@ Object.extend(Selector, {
           if (tagName == "*") return nodes;
         }
         for (var i = 0, node; node = nodes[i]; i++)
-          if (node.tagName.toUpperCase() == tagName) results.push(node);
+          if (node.tagName.toUpperCase() === uTagName) results.push(node);
         return results;
       } else return root.getElementsByTagName(tagName);
     },
 
     id: function(nodes, root, id, combinator) {
       var targetNode = $(id), h = Selector.handlers;
-      if (!targetNode) return [];
-      if (!nodes && root == document) return [targetNode];
+
+      if (root == document) {
+        if (!targetNode) return [];
+        if (!nodes) return [targetNode];
+      } else {
+        if (!root.sourceIndex || root.sourceIndex < 1) {
+          var nodes = root.getElementsByTagName('*');
+          for (var j = 0, node; node = nodes[j]; j++) {
+            if (node.id === id) return [node];
+          }
+        }
+      }
+
       if (nodes) {
         if (combinator) {
           if (combinator == 'child') {
@@ -3146,16 +3704,18 @@ Object.extend(Selector, {
       return results;
     },
 
-    attrPresence: function(nodes, root, attr) {
+    attrPresence: function(nodes, root, attr, combinator) {
       if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
       var results = [];
       for (var i = 0, node; node = nodes[i]; i++)
         if (Element.hasAttribute(node, attr)) results.push(node);
       return results;
     },
 
-    attr: function(nodes, root, attr, value, operator) {
+    attr: function(nodes, root, attr, value, operator, combinator) {
       if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
       var handler = Selector.operators[operator], results = [];
       for (var i = 0, node; node = nodes[i]; i++) {
         var nodeValue = Element.readAttribute(node, attr);
@@ -3217,7 +3777,6 @@ Object.extend(Selector, {
       return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
     },
 
-    // handles the an+b logic
     getIndices: function(a, b, total) {
       if (a == 0) return b > 0 ? [b] : [];
       return $R(1, total).inject([], function(memo, i) {
@@ -3226,7 +3785,6 @@ Object.extend(Selector, {
       });
     },
 
-    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
     nth: function(nodes, formula, root, reverse, ofType) {
       if (nodes.length == 0) return [];
       if (formula == 'even') formula = '2n+0';
@@ -3234,7 +3792,7 @@ Object.extend(Selector, {
       var h = Selector.handlers, results = [], indexed = [], m;
       h.mark(nodes);
       for (var i = 0, node; node = nodes[i]; i++) {
-        if (!node.parentNode._counted) {
+        if (!node.parentNode._countedByPrototype) {
           h.index(node.parentNode, reverse, ofType);
           indexed.push(node.parentNode);
         }
@@ -3260,8 +3818,7 @@ Object.extend(Selector, {
 
     'empty': function(nodes, value, root) {
       for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        // IE treats comments as element nodes
-        if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
+        if (node.tagName == '!' || node.firstChild) continue;
         results.push(node);
       }
       return results;
@@ -3272,14 +3829,15 @@ Object.extend(Selector, {
       var exclusions = new Selector(selector).findElements(root);
       h.mark(exclusions);
       for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node._counted) results.push(node);
+        if (!node._countedByPrototype) results.push(node);
       h.unmark(exclusions);
       return results;
     },
 
     'enabled': function(nodes, value, root) {
       for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node.disabled) results.push(node);
+        if (!node.disabled && (!node.type || node.type !== 'hidden'))
+          results.push(node);
       return results;
     },
 
@@ -3299,18 +3857,27 @@ Object.extend(Selector, {
   operators: {
     '=':  function(nv, v) { return nv == v; },
     '!=': function(nv, v) { return nv != v; },
-    '^=': function(nv, v) { return nv.startsWith(v); },
-    '$=': function(nv, v) { return nv.endsWith(v); },
-    '*=': function(nv, v) { return nv.include(v); },
+    '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
+    '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
+    '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
     '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
-    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
+    '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
+     '-').include('-' + (v || "").toUpperCase() + '-'); }
+  },
+
+  split: function(expression) {
+    var expressions = [];
+    expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+      expressions.push(m[1].strip());
+    });
+    return expressions;
   },
 
   matchElements: function(elements, expression) {
-    var matches = new Selector(expression).findElements(), h = Selector.handlers;
+    var matches = $$(expression), h = Selector.handlers;
     h.mark(matches);
     for (var i = 0, results = [], element; element = elements[i]; i++)
-      if (element._counted) results.push(element);
+      if (element._countedByPrototype) results.push(element);
     h.unmark(matches);
     return results;
   },
@@ -3323,10 +3890,7 @@ Object.extend(Selector, {
   },
 
   findChildElements: function(element, expressions) {
-    var exprs = expressions.join(','), expressions = [];
-    exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
-      expressions.push(m[1].strip());
-    });
+    expressions = Selector.split(expressions.join(','));
     var results = [], h = Selector.handlers;
     for (var i = 0, l = expressions.length, selector; i < l; i++) {
       selector = new Selector(expressions[i].strip());
@@ -3336,27 +3900,38 @@ Object.extend(Selector, {
   }
 });
 
+if (Prototype.Browser.IE) {
+  Object.extend(Selector.handlers, {
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        if (node.tagName !== "!") a.push(node);
+      return a;
+    }
+  });
+}
+
 function $$() {
   return Selector.findChildElements(document, $A(arguments));
 }
+
 var Form = {
   reset: function(form) {
-    $(form).reset();
+    form = $(form);
+    form.reset();
     return form;
   },
 
   serializeElements: function(elements, options) {
     if (typeof options != 'object') options = { hash: !!options };
-    else if (options.hash === undefined) options.hash = true;
+    else if (Object.isUndefined(options.hash)) options.hash = true;
     var key, value, submitted = false, submit = options.submit;
 
     var data = elements.inject({ }, function(result, element) {
       if (!element.disabled && element.name) {
         key = element.name; value = $(element).getValue();
-        if (value != null && (element.type != 'submit' || (!submitted &&
+        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
             submit !== false && (!submit || key == submit) && (submitted = true)))) {
           if (key in result) {
-            // a key is already present; construct an array of values
             if (!Object.isArray(result[key])) result[key] = [result[key]];
             result[key].push(value);
           }
@@ -3376,13 +3951,18 @@ Form.Methods = {
   },
 
   getElements: function(form) {
-    return $A($(form).getElementsByTagName('*')).inject([],
-      function(elements, child) {
-        if (Form.Element.Serializers[child.tagName.toLowerCase()])
-          elements.push(Element.extend(child));
-        return elements;
-      }
-    );
+    var elements = $(form).getElementsByTagName('*'),
+        element,
+        arr = [ ],
+        serializers = Form.Element.Serializers;
+    for (var i = 0; element = elements[i]; i++) {
+      arr.push(element);
+    }
+    return arr.inject([], function(elements, child) {
+      if (serializers[child.tagName.toLowerCase()])
+        elements.push(Element.extend(child));
+      return elements;
+    })
   },
 
   getInputs: function(form, typeName, name) {
@@ -3422,7 +4002,7 @@ Form.Methods = {
     }).sortBy(function(element) { return element.tabIndex }).first();
 
     return firstByIndex ? firstByIndex : elements.find(function(element) {
-      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+      return /^(?:input|select|textarea)$/i.test(element.tagName);
     });
   },
 
@@ -3453,6 +4033,7 @@ Form.Methods = {
 
 /*--------------------------------------------------------------------------*/
 
+
 Form.Element = {
   focus: function(element) {
     $(element).focus();
@@ -3466,6 +4047,7 @@ Form.Element = {
 };
 
 Form.Element.Methods = {
+
   serialize: function(element) {
     element = $(element);
     if (!element.disabled && element.name) {
@@ -3506,7 +4088,7 @@ Form.Element.Methods = {
     try {
       element.focus();
       if (element.select && (element.tagName.toLowerCase() != 'input' ||
-          !['button', 'reset', 'submit'].include(element.type)))
+          !(/^(?:button|reset|submit)$/i.test(element.type))))
         element.select();
     } catch (e) { }
     return element;
@@ -3514,7 +4096,6 @@ Form.Element.Methods = {
 
   disable: function(element) {
     element = $(element);
-    element.blur();
     element.disabled = true;
     return element;
   },
@@ -3529,6 +4110,7 @@ Form.Element.Methods = {
 /*--------------------------------------------------------------------------*/
 
 var Field = Form.Element;
+
 var $F = Form.Element.Methods.getValue;
 
 /*--------------------------------------------------------------------------*/
@@ -3545,31 +4127,31 @@ Form.Element.Serializers = {
   },
 
   inputSelector: function(element, value) {
-    if (value === undefined) return element.checked ? element.value : null;
+    if (Object.isUndefined(value)) return element.checked ? element.value : null;
     else element.checked = !!value;
   },
 
   textarea: function(element, value) {
-    if (value === undefined) return element.value;
+    if (Object.isUndefined(value)) return element.value;
     else element.value = value;
   },
 
-  select: function(element, index) {
-    if (index === undefined)
+  select: function(element, value) {
+    if (Object.isUndefined(value))
       return this[element.type == 'select-one' ?
         'selectOne' : 'selectMany'](element);
     else {
-      var opt, value, single = !Object.isArray(index);
+      var opt, currentValue, single = !Object.isArray(value);
       for (var i = 0, length = element.length; i < length; i++) {
         opt = element.options[i];
-        value = this.optionValue(opt);
+        currentValue = this.optionValue(opt);
         if (single) {
-          if (value == index) {
+          if (currentValue == value) {
             opt.selected = true;
             return;
           }
         }
-        else opt.selected = index.include(value);
+        else opt.selected = value.include(currentValue);
       }
     }
   },
@@ -3591,13 +4173,13 @@ Form.Element.Serializers = {
   },
 
   optionValue: function(opt) {
-    // extend element because hasAttribute may not be native
     return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
   }
 };
 
 /*--------------------------------------------------------------------------*/
 
+
 Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
   initialize: function($super, element, frequency, callback) {
     $super(callback, frequency);
@@ -3679,321 +4261,441 @@ Form.EventObserver = Class.create(Abstract.EventObserver, {
     return Form.serialize(this.element);
   }
 });
-if (!window.Event) var Event = { };
-
-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-  KEY_HOME:     36,
-  KEY_END:      35,
-  KEY_PAGEUP:   33,
-  KEY_PAGEDOWN: 34,
-  KEY_INSERT:   45,
-
-  cache: { },
-
-  relatedTarget: function(event) {
-    var element;
-    switch(event.type) {
-      case 'mouseover': element = event.fromElement; break;
-      case 'mouseout':  element = event.toElement;   break;
-      default: return null;
-    }
-    return Element.extend(element);
-  }
-});
+(function() {
+
+  var Event = {
+    KEY_BACKSPACE: 8,
+    KEY_TAB:       9,
+    KEY_RETURN:   13,
+    KEY_ESC:      27,
+    KEY_LEFT:     37,
+    KEY_UP:       38,
+    KEY_RIGHT:    39,
+    KEY_DOWN:     40,
+    KEY_DELETE:   46,
+    KEY_HOME:     36,
+    KEY_END:      35,
+    KEY_PAGEUP:   33,
+    KEY_PAGEDOWN: 34,
+    KEY_INSERT:   45,
+
+    cache: {}
+  };
 
-Event.Methods = (function() {
-  var isButton;
+  var docEl = document.documentElement;
+  var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
+    && 'onmouseleave' in docEl;
 
+  var _isButton;
   if (Prototype.Browser.IE) {
     var buttonMap = { 0: 1, 1: 4, 2: 2 };
-    isButton = function(event, code) {
-      return event.button == buttonMap[code];
+    _isButton = function(event, code) {
+      return event.button === buttonMap[code];
     };
-
   } else if (Prototype.Browser.WebKit) {
-    isButton = function(event, code) {
+    _isButton = function(event, code) {
       switch (code) {
         case 0: return event.which == 1 && !event.metaKey;
         case 1: return event.which == 1 && event.metaKey;
         default: return false;
       }
     };
-
   } else {
-    isButton = function(event, code) {
+    _isButton = function(event, code) {
       return event.which ? (event.which === code + 1) : (event.button === code);
     };
   }
 
-  return {
-    isLeftClick:   function(event) { return isButton(event, 0) },
-    isMiddleClick: function(event) { return isButton(event, 1) },
-    isRightClick:  function(event) { return isButton(event, 2) },
+  function isLeftClick(event)   { return _isButton(event, 0) }
 
-    element: function(event) {
-      var node = Event.extend(event).target;
-      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
-    },
+  function isMiddleClick(event) { return _isButton(event, 1) }
 
-    findElement: function(event, expression) {
-      var element = Event.element(event);
-      return element.match(expression) ? element : element.up(expression);
-    },
+  function isRightClick(event)  { return _isButton(event, 2) }
 
-    pointer: function(event) {
-      return {
-        x: event.pageX || (event.clientX +
-          (document.documentElement.scrollLeft || document.body.scrollLeft)),
-        y: event.pageY || (event.clientY +
-          (document.documentElement.scrollTop || document.body.scrollTop))
-      };
-    },
+  function element(event) {
+    event = Event.extend(event);
 
-    pointerX: function(event) { return Event.pointer(event).x },
-    pointerY: function(event) { return Event.pointer(event).y },
+    var node = event.target, type = event.type,
+     currentTarget = event.currentTarget;
 
-    stop: function(event) {
-      Event.extend(event);
-      event.preventDefault();
-      event.stopPropagation();
-      event.stopped = true;
+    if (currentTarget && currentTarget.tagName) {
+      if (type === 'load' || type === 'error' ||
+        (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
+          && currentTarget.type === 'radio'))
+            node = currentTarget;
     }
+
+    if (node.nodeType == Node.TEXT_NODE)
+      node = node.parentNode;
+
+    return Element.extend(node);
+  }
+
+  function findElement(event, expression) {
+    var element = Event.element(event);
+    if (!expression) return element;
+    var elements = [element].concat(element.ancestors());
+    return Selector.findElement(elements, expression, 0);
+  }
+
+  function pointer(event) {
+    return { x: pointerX(event), y: pointerY(event) };
+  }
+
+  function pointerX(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollLeft: 0 };
+
+    return event.pageX || (event.clientX +
+      (docElement.scrollLeft || body.scrollLeft) -
+      (docElement.clientLeft || 0));
+  }
+
+  function pointerY(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollTop: 0 };
+
+    return  event.pageY || (event.clientY +
+       (docElement.scrollTop || body.scrollTop) -
+       (docElement.clientTop || 0));
+  }
+
+
+  function stop(event) {
+    Event.extend(event);
+    event.preventDefault();
+    event.stopPropagation();
+
+    event.stopped = true;
+  }
+
+  Event.Methods = {
+    isLeftClick: isLeftClick,
+    isMiddleClick: isMiddleClick,
+    isRightClick: isRightClick,
+
+    element: element,
+    findElement: findElement,
+
+    pointer: pointer,
+    pointerX: pointerX,
+    pointerY: pointerY,
+
+    stop: stop
   };
-})();
 
-Event.extend = (function() {
+
   var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
     m[name] = Event.Methods[name].methodize();
     return m;
   });
 
   if (Prototype.Browser.IE) {
+    function _relatedTarget(event) {
+      var element;
+      switch (event.type) {
+        case 'mouseover': element = event.fromElement; break;
+        case 'mouseout':  element = event.toElement;   break;
+        default: return null;
+      }
+      return Element.extend(element);
+    }
+
     Object.extend(methods, {
       stopPropagation: function() { this.cancelBubble = true },
       preventDefault:  function() { this.returnValue = false },
-      inspect: function() { return "[object Event]" }
+      inspect: function() { return '[object Event]' }
     });
 
-    return function(event) {
+    Event.extend = function(event, element) {
       if (!event) return false;
       if (event._extendedByPrototype) return event;
 
       event._extendedByPrototype = Prototype.emptyFunction;
       var pointer = Event.pointer(event);
+
       Object.extend(event, {
-        target: event.srcElement,
-        relatedTarget: Event.relatedTarget(event),
+        target: event.srcElement || element,
+        relatedTarget: _relatedTarget(event),
         pageX:  pointer.x,
         pageY:  pointer.y
       });
+
       return Object.extend(event, methods);
     };
-
   } else {
-    Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
+    Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
     Object.extend(Event.prototype, methods);
-    return Prototype.K;
+    Event.extend = Prototype.K;
   }
-})();
-
-Object.extend(Event, (function() {
-  var cache = Event.cache;
 
-  function getEventID(element) {
-    if (element._eventID) return element._eventID;
-    arguments.callee.id = arguments.callee.id || 1;
-    return element._eventID = ++arguments.callee.id;
-  }
+  function _createResponder(element, eventName, handler) {
+    var registry = Element.retrieve(element, 'prototype_event_registry');
 
-  function getDOMEventName(eventName) {
-    if (eventName && eventName.include(':')) return "dataavailable";
-    return eventName;
-  }
+    if (Object.isUndefined(registry)) {
+      CACHE.push(element);
+      registry = Element.retrieve(element, 'prototype_event_registry', $H());
+    }
 
-  function getCacheForID(id) {
-    return cache[id] = cache[id] || { };
-  }
+    var respondersForEvent = registry.get(eventName);
+    if (Object.isUndefined(respondersForEvent)) {
+      respondersForEvent = [];
+      registry.set(eventName, respondersForEvent);
+    }
 
-  function getWrappersForEventName(id, eventName) {
-    var c = getCacheForID(id);
-    return c[eventName] = c[eventName] || [];
-  }
+    if (respondersForEvent.pluck('handler').include(handler)) return false;
 
-  function createWrapper(element, eventName, handler) {
-    var id = getEventID(element);
-    var c = getWrappersForEventName(id, eventName);
-    if (c.pluck("handler").include(handler)) return false;
+    var responder;
+    if (eventName.include(":")) {
+      responder = function(event) {
+        if (Object.isUndefined(event.eventName))
+          return false;
 
-    var wrapper = function(event) {
-      if (!Event || !Event.extend ||
-        (event.eventName && event.eventName != eventName))
+        if (event.eventName !== eventName)
           return false;
 
-      Event.extend(event);
-      handler.call(element, event)
-    };
+        Event.extend(event, element);
+        handler.call(element, event);
+      };
+    } else {
+      if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
+       (eventName === "mouseenter" || eventName === "mouseleave")) {
+        if (eventName === "mouseenter" || eventName === "mouseleave") {
+          responder = function(event) {
+            Event.extend(event, element);
+
+            var parent = event.relatedTarget;
+            while (parent && parent !== element) {
+              try { parent = parent.parentNode; }
+              catch(e) { parent = element; }
+            }
 
-    wrapper.handler = handler;
-    c.push(wrapper);
-    return wrapper;
-  }
+            if (parent === element) return;
 
-  function findWrapper(id, eventName, handler) {
-    var c = getWrappersForEventName(id, eventName);
-    return c.find(function(wrapper) { return wrapper.handler == handler });
-  }
+            handler.call(element, event);
+          };
+        }
+      } else {
+        responder = function(event) {
+          Event.extend(event, element);
+          handler.call(element, event);
+        };
+      }
+    }
 
-  function destroyWrapper(id, eventName, handler) {
-    var c = getCacheForID(id);
-    if (!c[eventName]) return false;
-    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
+    responder.handler = handler;
+    respondersForEvent.push(responder);
+    return responder;
   }
 
-  function destroyCache() {
-    for (var id in cache)
-      for (var eventName in cache[id])
-        cache[id][eventName] = null;
+  function _destroyCache() {
+    for (var i = 0, length = CACHE.length; i < length; i++) {
+      Event.stopObserving(CACHE[i]);
+      CACHE[i] = null;
+    }
   }
 
-  if (window.attachEvent) {
-    window.attachEvent("onunload", destroyCache);
+  var CACHE = [];
+
+  if (Prototype.Browser.IE)
+    window.attachEvent('onunload', _destroyCache);
+
+  if (Prototype.Browser.WebKit)
+    window.addEventListener('unload', Prototype.emptyFunction, false);
+
+
+  var _getDOMEventName = Prototype.K;
+
+  if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
+    _getDOMEventName = function(eventName) {
+      var translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
+      return eventName in translations ? translations[eventName] : eventName;
+    };
   }
 
-  return {
-    observe: function(element, eventName, handler) {
-      element = $(element);
-      var name = getDOMEventName(eventName);
+  function observe(element, eventName, handler) {
+    element = $(element);
 
-      var wrapper = createWrapper(element, eventName, handler);
-      if (!wrapper) return element;
+    var responder = _createResponder(element, eventName, handler);
 
-      if (element.addEventListener) {
-        element.addEventListener(name, wrapper, false);
-      } else {
-        element.attachEvent("on" + name, wrapper);
+    if (!responder) return element;
+
+    if (eventName.include(':')) {
+      if (element.addEventListener)
+        element.addEventListener("dataavailable", responder, false);
+      else {
+        element.attachEvent("ondataavailable", responder);
+        element.attachEvent("onfilterchange", responder);
       }
+    } else {
+      var actualEventName = _getDOMEventName(eventName);
 
-      return element;
-    },
+      if (element.addEventListener)
+        element.addEventListener(actualEventName, responder, false);
+      else
+        element.attachEvent("on" + actualEventName, responder);
+    }
 
-    stopObserving: function(element, eventName, handler) {
-      element = $(element);
-      var id = getEventID(element), name = getDOMEventName(eventName);
+    return element;
+  }
 
-      if (!handler && eventName) {
-        getWrappersForEventName(id, eventName).each(function(wrapper) {
-          element.stopObserving(eventName, wrapper.handler);
-        });
-        return element;
+  function stopObserving(element, eventName, handler) {
+    element = $(element);
 
-      } else if (!eventName) {
-        Object.keys(getCacheForID(id)).each(function(eventName) {
-          element.stopObserving(eventName);
-        });
-        return element;
-      }
+    var registry = Element.retrieve(element, 'prototype_event_registry');
 
-      var wrapper = findWrapper(id, eventName, handler);
-      if (!wrapper) return element;
+    if (Object.isUndefined(registry)) return element;
 
-      if (element.removeEventListener) {
-        element.removeEventListener(name, wrapper, false);
-      } else {
-        element.detachEvent("on" + name, wrapper);
-      }
+    if (eventName && !handler) {
+      var responders = registry.get(eventName);
 
-      destroyWrapper(id, eventName, handler);
+      if (Object.isUndefined(responders)) return element;
 
+      responders.each( function(r) {
+        Element.stopObserving(element, eventName, r.handler);
+      });
       return element;
-    },
+    } else if (!eventName) {
+      registry.each( function(pair) {
+        var eventName = pair.key, responders = pair.value;
 
-    fire: function(element, eventName, memo) {
-      element = $(element);
-      if (element == document && document.createEvent && !element.dispatchEvent)
-        element = document.documentElement;
+        responders.each( function(r) {
+          Element.stopObserving(element, eventName, r.handler);
+        });
+      });
+      return element;
+    }
 
-      if (document.createEvent) {
-        var event = document.createEvent("HTMLEvents");
-        event.initEvent("dataavailable", true, true);
-      } else {
-        var event = document.createEventObject();
-        event.eventType = "ondataavailable";
-      }
+    var responders = registry.get(eventName);
 
-      event.eventName = eventName;
-      event.memo = memo || { };
+    if (!responders) return;
 
-      if (document.createEvent) {
-        element.dispatchEvent(event);
-      } else {
-        element.fireEvent(event.eventType, event);
+    var responder = responders.find( function(r) { return r.handler === handler; });
+    if (!responder) return element;
+
+    var actualEventName = _getDOMEventName(eventName);
+
+    if (eventName.include(':')) {
+      if (element.removeEventListener)
+        element.removeEventListener("dataavailable", responder, false);
+      else {
+        element.detachEvent("ondataavailable", responder);
+        element.detachEvent("onfilterchange",  responder);
       }
+    } else {
+      if (element.removeEventListener)
+        element.removeEventListener(actualEventName, responder, false);
+      else
+        element.detachEvent('on' + actualEventName, responder);
+    }
+
+    registry.set(eventName, responders.without(responder));
+
+    return element;
+  }
+
+  function fire(element, eventName, memo, bubble) {
+    element = $(element);
+
+    if (Object.isUndefined(bubble))
+      bubble = true;
 
-      return event;
+    if (element == document && document.createEvent && !element.dispatchEvent)
+      element = document.documentElement;
+
+    var event;
+    if (document.createEvent) {
+      event = document.createEvent('HTMLEvents');
+      event.initEvent('dataavailable', true, true);
+    } else {
+      event = document.createEventObject();
+      event.eventType = bubble ? 'ondataavailable' : 'onfilterchange';
     }
-  };
-})());
 
-Object.extend(Event, Event.Methods);
+    event.eventName = eventName;
+    event.memo = memo || { };
 
-Element.addMethods({
-  fire:          Event.fire,
-  observe:       Event.observe,
-  stopObserving: Event.stopObserving
-});
+    if (document.createEvent)
+      element.dispatchEvent(event);
+    else
+      element.fireEvent(event.eventType, event);
 
-Object.extend(document, {
-  fire:          Element.Methods.fire.methodize(),
-  observe:       Element.Methods.observe.methodize(),
-  stopObserving: Element.Methods.stopObserving.methodize()
-});
+    return Event.extend(event);
+  }
+
+
+  Object.extend(Event, Event.Methods);
+
+  Object.extend(Event, {
+    fire:          fire,
+    observe:       observe,
+    stopObserving: stopObserving
+  });
+
+  Element.addMethods({
+    fire:          fire,
+
+    observe:       observe,
+
+    stopObserving: stopObserving
+  });
+
+  Object.extend(document, {
+    fire:          fire.methodize(),
+
+    observe:       observe.methodize(),
+
+    stopObserving: stopObserving.methodize(),
+
+    loaded:        false
+  });
+
+  if (window.Event) Object.extend(window.Event, Event);
+  else window.Event = Event;
+})();
 
 (function() {
   /* Support for the DOMContentLoaded event is based on work by Dan Webb,
-     Matthias Miller, Dean Edwards and John Resig. */
+     Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
 
-  var timer, fired = false;
+  var timer;
 
   function fireContentLoadedEvent() {
-    if (fired) return;
-    if (timer) window.clearInterval(timer);
-    document.fire("dom:loaded");
-    fired = true;
+    if (document.loaded) return;
+    if (timer) window.clearTimeout(timer);
+    document.loaded = true;
+    document.fire('dom:loaded');
   }
 
-  if (document.addEventListener) {
-    if (Prototype.Browser.WebKit) {
-      timer = window.setInterval(function() {
-        if (/loaded|complete/.test(document.readyState))
-          fireContentLoadedEvent();
-      }, 0);
-
-      Event.observe(window, "load", fireContentLoadedEvent);
+  function checkReadyState() {
+    if (document.readyState === 'complete') {
+      document.stopObserving('readystatechange', checkReadyState);
+      fireContentLoadedEvent();
+    }
+  }
 
-    } else {
-      document.addEventListener("DOMContentLoaded",
-        fireContentLoadedEvent, false);
+  function pollDoScroll() {
+    try { document.documentElement.doScroll('left'); }
+    catch(e) {
+      timer = pollDoScroll.defer();
+      return;
     }
+    fireContentLoadedEvent();
+  }
 
+  if (document.addEventListener) {
+    document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
   } else {
-    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
-    $("__onDOMContentLoaded").onreadystatechange = function() {
-      if (this.readyState == "complete") {
-        this.onreadystatechange = null;
-        fireContentLoadedEvent();
-      }
-    };
+    document.observe('readystatechange', checkReadyState);
+    if (window == top)
+      timer = pollDoScroll.defer();
   }
+
+  Event.observe(window, 'load', fireContentLoadedEvent);
 })();
+
+Element.addMethods();
+
 /*------------------------------- DEPRECATED -------------------------------*/
 
 Hash.toQueryString = Object.toQueryString;
@@ -4022,16 +4724,9 @@ var Insertion = {
 
 var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
 
-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
 var Position = {
-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
   includeScrollOffsets: false,
 
-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
   prepare: function() {
     this.deltaX =  window.pageXOffset
                 || document.documentElement.scrollLeft
@@ -4043,7 +4738,6 @@ var Position = {
                 || 0;
   },
 
-  // caches x/y coordinate pair to use with overlap
   within: function(element, x, y) {
     if (this.includeScrollOffsets)
       return this.withinIncludingScrolloffsets(element, x, y);
@@ -4070,7 +4764,6 @@ var Position = {
             this.xcomp <  this.offset[0] + element.offsetWidth);
   },
 
-  // within must be called directly before
   overlap: function(mode, element) {
     if (!mode) return 0;
     if (mode == 'vertical')
@@ -4081,7 +4774,6 @@ var Position = {
         element.offsetWidth;
   },
 
-  // Deprecation layer -- use newer Element methods now (1.5.2).
 
   cumulativeOffset: Element.Methods.cumulativeOffset,
 
@@ -4180,5 +4872,3 @@ Element.ClassNames.prototype = {
 Object.extend(Element.ClassNames.prototype, Enumerable);
 
 /*--------------------------------------------------------------------------*/
-
-Element.addMethods();
\ No newline at end of file
index 83a0237556bf58798b7d8e93d44f2bf7ce3c9809..48b7b6a18866ed319f5deba01d8acac7d10bd6f9 100644 (file)
@@ -333,7 +333,7 @@ function edInsertTag(myField, i) {
 
 function edInsertContent(myField, myValue) {
        var sel, startPos, endPos, scrollTop;
-       
+
        //IE support
        if (document.selection) {
                myField.focus();
index 384ca150ce248fc52586dc47610d1e21f0dbc626..60dc2d8230f43eb10098bf40e9cfb4f3a8bfbb7a 100644 (file)
@@ -1,4 +1,4 @@
-Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)\r
+Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)\r
 \r
 Permission is hereby granted, free of charge, to any person obtaining\r
 a copy of this software and associated documentation files (the\r
index 953b4a53221321d9c9a2049dca7947eef41894e9..f1f42b9ac6b5073dd5f9b30adc34589f3fc353cb 100644 (file)
@@ -1,6 +1,6 @@
-// script.aculo.us builder.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us builder.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
 //
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
 // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -26,7 +26,7 @@ var Builder = {
   //       due to a Firefox bug
   node: function(elementName) {
     elementName = elementName.toUpperCase();
-    
+
     // try innerHTML approach
     var parentTag = this.NODEMAP[elementName] || 'div';
     var parentElement = document.createElement(parentTag);
@@ -34,14 +34,14 @@ var Builder = {
       parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
     } catch(e) {}
     var element = parentElement.firstChild || null;
-      
+
     // see if browser added wrapping tags
     if(element && (element.tagName.toUpperCase() != elementName))
       element = element.getElementsByTagName(elementName)[0];
-    
+
     // fallback to createElement approach
     if(!element) element = document.createElement(elementName);
-    
+
     // abort if nothing could be created
     if(!element) return;
 
@@ -62,19 +62,19 @@ var Builder = {
             // workaround firefox 1.0.X bug
             if(!element) {
               element = document.createElement(elementName);
-              for(attr in arguments[1]) 
+              for(attr in arguments[1])
                 element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
             }
             if(element.tagName.toUpperCase() != elementName)
               element = parentElement.getElementsByTagName(elementName)[0];
           }
-        } 
+        }
 
     // text, or array of children
     if(arguments[2])
       this._children(element, arguments[2]);
 
-     return element;
+     return $(element);
   },
   _text: function(text) {
      return document.createTextNode(text);
@@ -100,7 +100,7 @@ var Builder = {
     if(typeof children=='object') { // array can hold nodes and text
       children.flatten().each( function(e) {
         if(typeof e=='object')
-          element.appendChild(e)
+          element.appendChild(e);
         else
           if(Builder._isStringOrNumber(e))
             element.appendChild(Builder._text(e));
@@ -117,20 +117,20 @@ var Builder = {
     $(element).update(html.strip());
     return element.down();
   },
-  dump: function(scope) { 
-    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 
-  
+  dump: function(scope) {
+    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
+
     var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
       "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
       "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
       "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
       "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
       "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
-  
-    tags.each( function(tag){ 
-      scope[tag] = function() { 
-        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
-      } 
+
+    tags.each( function(tag){
+      scope[tag] = function() {
+        return Builder.node.apply(Builder, [tag].concat($A(arguments)));
+      };
     });
   }
-}
+};
\ No newline at end of file
index 0088d18bb259d5e2b36b066f3117a09f7fa280b7..7392fb664c08a6350e59eb6ac6bc2013af03428c 100644 (file)
@@ -1,24 +1,24 @@
-// script.aculo.us controls.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-//           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+//           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
 // Contributors:
 //  Richard Livsey
 //  Rahul Bhargava
 //  Rob Wills
-// 
+//
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
 // For details, see the script.aculo.us web site: http://script.aculo.us/
 
-// Autocompleter.Base handles all the autocompletion functionality 
+// Autocompleter.Base handles all the autocompletion functionality
 // that's independent of the data source for autocompletion. This
 // includes drawing the autocompletion menu, observing keyboard
 // and mouse events, and similar.
 //
-// Specific autocompleters need to provide, at the very least, 
+// Specific autocompleters need to provide, at the very least,
 // a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method 
+// the text inside the monitored textbox changes. This method
 // should get the text for which to provide autocompletion by
 // invoking this.getToken(), NOT by directly accessing
 // this.element.value. This is to allow incremental tokenized
 // will incrementally autocomplete with a comma as the token.
 // Additionally, ',' in the above example can be replaced with
 // a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most 
-// useful when one of the tokens is \n (a newline), as it 
+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
 // allows smart autocompletion after linebreaks.
 
 if(typeof Effect == 'undefined')
   throw("controls.js requires including script.aculo.us' effects.js library");
 
-var Autocompleter = { }
+var Autocompleter = { };
 Autocompleter.Base = Class.create({
   baseInitialize: function(element, update, options) {
-    element          = $(element)
-    this.element     = element; 
-    this.update      = $(update);  
-    this.hasFocus    = false; 
-    this.changed     = false; 
-    this.active      = false; 
-    this.index       = 0;     
+    element          = $(element);
+    this.element     = element;
+    this.update      = $(update);
+    this.hasFocus    = false;
+    this.changed     = false;
+    this.active      = false;
+    this.index       = 0;
     this.entryCount  = 0;
     this.oldElementValue = this.element.value;
 
@@ -61,42 +61,42 @@ Autocompleter.Base = Class.create({
     this.options.tokens       = this.options.tokens || [];
     this.options.frequency    = this.options.frequency || 0.4;
     this.options.minChars     = this.options.minChars || 1;
-    this.options.onShow       = this.options.onShow || 
-      function(element, update){ 
+    this.options.onShow       = this.options.onShow ||
+      function(element, update){
         if(!update.style.position || update.style.position=='absolute') {
           update.style.position = 'absolute';
           Position.clone(element, update, {
-            setHeight: false, 
+            setHeight: false,
             offsetTop: element.offsetHeight
           });
         }
         Effect.Appear(update,{duration:0.15});
       };
-    this.options.onHide = this.options.onHide || 
+    this.options.onHide = this.options.onHide ||
       function(element, update){ new Effect.Fade(update,{duration:0.15}) };
 
-    if(typeof(this.options.tokens) == 'string') 
+    if(typeof(this.options.tokens) == 'string')
       this.options.tokens = new Array(this.options.tokens);
     // Force carriage returns as token delimiters anyway
     if (!this.options.tokens.include('\n'))
       this.options.tokens.push('\n');
 
     this.observer = null;
-    
+
     this.element.setAttribute('autocomplete','off');
 
     Element.hide(this.update);
 
     Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
-    Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this));
+    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
   },
 
   show: function() {
     if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
-    if(!this.iefix && 
+    if(!this.iefix &&
       (Prototype.Browser.IE) &&
       (Element.getStyle(this.update, 'position')=='absolute')) {
-      new Insertion.After(this.update, 
+      new Insertion.After(this.update,
        '<iframe id="' + this.update.id + '_iefix" '+
        'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
        'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
@@ -104,7 +104,7 @@ Autocompleter.Base = Class.create({
     }
     if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
   },
-  
+
   fixIEOverlapping: function() {
     Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
     this.iefix.style.zIndex = 1;
@@ -144,23 +144,23 @@ Autocompleter.Base = Class.create({
        case Event.KEY_UP:
          this.markPrevious();
          this.render();
-         if(Prototype.Browser.WebKit) Event.stop(event);
+         Event.stop(event);
          return;
        case Event.KEY_DOWN:
          this.markNext();
          this.render();
-         if(Prototype.Browser.WebKit) Event.stop(event);
+         Event.stop(event);
          return;
       }
-     else 
-       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 
+     else
+       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
          (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
 
     this.changed = true;
     this.hasFocus = true;
 
     if(this.observer) clearTimeout(this.observer);
-      this.observer = 
+      this.observer =
         setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
   },
 
@@ -172,35 +172,35 @@ Autocompleter.Base = Class.create({
 
   onHover: function(event) {
     var element = Event.findElement(event, 'LI');
-    if(this.index != element.autocompleteIndex) 
+    if(this.index != element.autocompleteIndex)
     {
         this.index = element.autocompleteIndex;
         this.render();
     }
     Event.stop(event);
   },
-  
+
   onClick: function(event) {
     var element = Event.findElement(event, 'LI');
     this.index = element.autocompleteIndex;
     this.selectEntry();
     this.hide();
   },
-  
+
   onBlur: function(event) {
     // needed to make click events working
     setTimeout(this.hide.bind(this), 250);
     this.hasFocus = false;
-    this.active = false;     
-  }, 
-  
+    this.active = false;
+  },
+
   render: function() {
     if(this.entryCount > 0) {
       for (var i = 0; i < this.entryCount; i++)
-        this.index==i ? 
-          Element.addClassName(this.getEntry(i),"selected") : 
+        this.index==i ?
+          Element.addClassName(this.getEntry(i),"selected") :
           Element.removeClassName(this.getEntry(i),"selected");
-      if(this.hasFocus) { 
+      if(this.hasFocus) {
         this.show();
         this.active = true;
       }
@@ -209,27 +209,27 @@ Autocompleter.Base = Class.create({
       this.hide();
     }
   },
-  
+
   markPrevious: function() {
-    if(this.index > 0) this.index--
+    if(this.index > 0) this.index--;
       else this.index = this.entryCount-1;
     this.getEntry(this.index).scrollIntoView(true);
   },
-  
+
   markNext: function() {
-    if(this.index < this.entryCount-1) this.index++
+    if(this.index < this.entryCount-1) this.index++;
       else this.index = 0;
     this.getEntry(this.index).scrollIntoView(false);
   },
-  
+
   getEntry: function(index) {
     return this.update.firstChild.childNodes[index];
   },
-  
+
   getCurrentEntry: function() {
     return this.getEntry(this.index);
   },
-  
+
   selectEntry: function() {
     this.active = false;
     this.updateElement(this.getCurrentEntry());
@@ -246,7 +246,7 @@ Autocompleter.Base = Class.create({
       if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
     } else
       value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-    
+
     var bounds = this.getTokenBounds();
     if (bounds[0] != -1) {
       var newValue = this.element.value.substr(0, bounds[0]);
@@ -259,7 +259,7 @@ Autocompleter.Base = Class.create({
     }
     this.oldElementValue = this.element.value;
     this.element.focus();
-    
+
     if (this.options.afterUpdateElement)
       this.options.afterUpdateElement(this.element, selectedElement);
   },
@@ -271,20 +271,20 @@ Autocompleter.Base = Class.create({
       Element.cleanWhitespace(this.update.down());
 
       if(this.update.firstChild && this.update.down().childNodes) {
-        this.entryCount = 
+        this.entryCount =
           this.update.down().childNodes.length;
         for (var i = 0; i < this.entryCount; i++) {
           var entry = this.getEntry(i);
           entry.autocompleteIndex = i;
           this.addObservers(entry);
         }
-      } else { 
+      } else {
         this.entryCount = 0;
       }
 
       this.stopIndicator();
       this.index = 0;
-      
+
       if(this.entryCount==1 && this.options.autoSelect) {
         this.selectEntry();
         this.hide();
@@ -300,7 +300,7 @@ Autocompleter.Base = Class.create({
   },
 
   onObserverEvent: function() {
-    this.changed = false;   
+    this.changed = false;
     this.tokenBounds = null;
     if(this.getToken().length>=this.options.minChars) {
       this.getUpdatedChoices();
@@ -353,16 +353,16 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
 
   getUpdatedChoices: function() {
     this.startIndicator();
-    
-    var entry = encodeURIComponent(this.options.paramName) + '=' + 
+
+    var entry = encodeURIComponent(this.options.paramName) + '=' +
       encodeURIComponent(this.getToken());
 
     this.options.parameters = this.options.callback ?
       this.options.callback(this.element, entry) : entry;
 
-    if(this.options.defaultParams) 
+    if(this.options.defaultParams)
       this.options.parameters += '&' + this.options.defaultParams;
-    
+
     new Ajax.Request(this.url, this.options);
   },
 
@@ -384,7 +384,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
 // - choices - How many autocompletion choices to offer
 //
 // - partialSearch - If false, the autocompleter will match entered
-//                    text only at the beginning of strings in the 
+//                    text only at the beginning of strings in the
 //                    autocomplete array. Defaults to true, which will
 //                    match text at the beginning of any *word* in the
 //                    strings in the autocomplete array. If you want to
@@ -401,7 +401,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
 // - ignoreCase - Whether to ignore case when autocompleting.
 //                 Defaults to true.
 //
-// It's possible to pass in a custom function as the 'selector' 
+// It's possible to pass in a custom function as the 'selector'
 // option, if you prefer to write your own autocompletion logic.
 // In that case, the other options above will not apply unless
 // you support them.
@@ -429,20 +429,20 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
         var entry     = instance.getToken();
         var count     = 0;
 
-        for (var i = 0; i < instance.options.array.length &&  
-          ret.length < instance.options.choices ; i++) { 
+        for (var i = 0; i < instance.options.array.length &&
+          ret.length < instance.options.choices ; i++) {
 
           var elem = instance.options.array[i];
-          var foundPos = instance.options.ignoreCase ? 
-            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
+          var foundPos = instance.options.ignoreCase ?
+            elem.toLowerCase().indexOf(entry.toLowerCase()) :
             elem.indexOf(entry);
 
           while (foundPos != -1) {
-            if (foundPos == 0 && elem.length != entry.length) { 
-              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 
+            if (foundPos == 0 && elem.length != entry.length) {
+              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
                 elem.substr(entry.length) + "</li>");
               break;
-            } else if (entry.length >= instance.options.partialChars && 
+            } else if (entry.length >= instance.options.partialChars &&
               instance.options.partialSearch && foundPos != -1) {
               if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
                 partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
@@ -452,14 +452,14 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
               }
             }
 
-            foundPos = instance.options.ignoreCase ? 
-              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 
+            foundPos = instance.options.ignoreCase ?
+              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
               elem.indexOf(entry, foundPos + 1);
 
           }
         }
         if (partial.length)
-          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
         return "<ul>" + ret.join('') + "</ul>";
       }
     }, options || { });
@@ -476,7 +476,7 @@ Field.scrollFreeActivate = function(field) {
   setTimeout(function() {
     Field.activate(field);
   }, 1);
-}
+};
 
 Ajax.InPlaceEditor = Class.create({
   initialize: function(element, url, options) {
@@ -606,7 +606,7 @@ Ajax.InPlaceEditor = Class.create({
     this.triggerCallback('onEnterHover');
   },
   getText: function() {
-    return this.element.innerHTML;
+    return this.element.innerHTML.unescapeHTML();
   },
   handleAJAXFailure: function(transport) {
     this.triggerCallback('onFailure', transport);
@@ -782,7 +782,7 @@ Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
       onSuccess: function(transport) {
         var js = transport.responseText.strip();
         if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
-          throw 'Server returned an invalid collection representation.';
+          throw('Server returned an invalid collection representation.');
         this._collection = eval(js);
         this.checkForExternalText();
       }.bind(this),
@@ -939,7 +939,7 @@ Ajax.InPlaceCollectionEditor.DefaultOptions = {
   loadingCollectionText: 'Loading options...'
 };
 
-// Delayed observer, like Form.Element.Observer, 
+// Delayed observer, like Form.Element.Observer,
 // but waits for delay after last key input
 // Ideal for live-search fields
 
@@ -949,7 +949,7 @@ Form.Element.DelayedObserver = Class.create({
     this.element   = $(element);
     this.callback  = callback;
     this.timer     = null;
-    this.lastValue = $F(this.element); 
+    this.lastValue = $F(this.element);
     Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
   },
   delayedListener: function(event) {
@@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
     this.timer = null;
     this.callback(this.element, $F(this.element));
   }
-});
+});
\ No newline at end of file
index 14ebc6f5c3031db5d58e5d16126b7c767fd82b7e..15c6dbca68ba56e5862fc38d2fd74e29aa699744 100644 (file)
@@ -1,8 +1,7 @@
-// script.aculo.us dragdrop.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-// 
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
 // For details, see the script.aculo.us web site: http://script.aculo.us/
 
@@ -34,7 +33,7 @@ var Droppables = {
         options._containers.push($(containment));
       }
     }
-    
+
     if(options.accept) options.accept = [options.accept].flatten();
 
     Element.makePositioned(element); // fix IE
@@ -42,34 +41,34 @@ var Droppables = {
 
     this.drops.push(options);
   },
-  
+
   findDeepestChild: function(drops) {
     deepest = drops[0];
-      
+
     for (i = 1; i < drops.length; ++i)
       if (Element.isParent(drops[i].element, deepest.element))
         deepest = drops[i];
-    
+
     return deepest;
   },
 
   isContained: function(element, drop) {
     var containmentNode;
     if(drop.tree) {
-      containmentNode = element.treeNode; 
+      containmentNode = element.treeNode;
     } else {
       containmentNode = element.parentNode;
     }
     return drop._containers.detect(function(c) { return containmentNode == c });
   },
-  
+
   isAffected: function(point, element, drop) {
     return (
       (drop.element!=element) &&
       ((!drop._containers) ||
         this.isContained(element, drop)) &&
       ((!drop.accept) ||
-        (Element.classNames(element).detect( 
+        (Element.classNames(element).detect(
           function(v) { return drop.accept.include(v) } ) )) &&
       Position.within(drop.element, point[0], point[1]) );
   },
@@ -89,12 +88,12 @@ var Droppables = {
   show: function(point, element) {
     if(!this.drops.length) return;
     var drop, affected = [];
-    
+
     this.drops.each( function(drop) {
       if(Droppables.isAffected(point, element, drop))
         affected.push(drop);
     });
-        
+
     if(affected.length>0)
       drop = Droppables.findDeepestChild(affected);
 
@@ -103,7 +102,7 @@ var Droppables = {
       Position.within(drop.element, point[0], point[1]);
       if(drop.onHover)
         drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-      
+
       if (drop != this.last_active) Droppables.activate(drop);
     }
   },
@@ -114,8 +113,8 @@ var Droppables = {
 
     if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
       if (this.last_active.onDrop) {
-        this.last_active.onDrop(element, this.last_active.element, event); 
-        return true; 
+        this.last_active.onDrop(element, this.last_active.element, event);
+        return true;
       }
   },
 
@@ -123,25 +122,25 @@ var Droppables = {
     if(this.last_active)
       this.deactivate(this.last_active);
   }
-}
+};
 
 var Draggables = {
   drags: [],
   observers: [],
-  
+
   register: function(draggable) {
     if(this.drags.length == 0) {
       this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
       this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
       this.eventKeypress  = this.keyPress.bindAsEventListener(this);
-      
+
       Event.observe(document, "mouseup", this.eventMouseUp);
       Event.observe(document, "mousemove", this.eventMouseMove);
       Event.observe(document, "keypress", this.eventKeypress);
     }
     this.drags.push(draggable);
   },
-  
+
   unregister: function(draggable) {
     this.drags = this.drags.reject(function(d) { return d==draggable });
     if(this.drags.length == 0) {
@@ -150,24 +149,24 @@ var Draggables = {
       Event.stopObserving(document, "keypress", this.eventKeypress);
     }
   },
-  
+
   activate: function(draggable) {
-    if(draggable.options.delay) { 
-      this._timeout = setTimeout(function() { 
-        Draggables._timeout = null; 
-        window.focus(); 
-        Draggables.activeDraggable = draggable; 
-      }.bind(this), draggable.options.delay); 
+    if(draggable.options.delay) {
+      this._timeout = setTimeout(function() {
+        Draggables._timeout = null;
+        window.focus();
+        Draggables.activeDraggable = draggable;
+      }.bind(this), draggable.options.delay);
     } else {
       window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
       this.activeDraggable = draggable;
     }
   },
-  
+
   deactivate: function() {
     this.activeDraggable = null;
   },
-  
+
   updateDrag: function(event) {
     if(!this.activeDraggable) return;
     var pointer = [Event.pointerX(event), Event.pointerY(event)];
@@ -175,36 +174,36 @@ var Draggables = {
     // the same coordinates, prevent needless redrawing (moz bug?)
     if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
     this._lastPointer = pointer;
-    
+
     this.activeDraggable.updateDrag(event, pointer);
   },
-  
+
   endDrag: function(event) {
-    if(this._timeout) { 
-      clearTimeout(this._timeout); 
-      this._timeout = null; 
+    if(this._timeout) {
+      clearTimeout(this._timeout);
+      this._timeout = null;
     }
     if(!this.activeDraggable) return;
     this._lastPointer = null;
     this.activeDraggable.endDrag(event);
     this.activeDraggable = null;
   },
-  
+
   keyPress: function(event) {
     if(this.activeDraggable)
       this.activeDraggable.keyPress(event);
   },
-  
+
   addObserver: function(observer) {
     this.observers.push(observer);
     this._cacheObserverCallbacks();
   },
-  
+
   removeObserver: function(element) {  // element instead of observer fixes mem leaks
     this.observers = this.observers.reject( function(o) { return o.element==element });
     this._cacheObserverCallbacks();
   },
-  
+
   notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
     if(this[eventName+'Count'] > 0)
       this.observers.each( function(o) {
@@ -212,7 +211,7 @@ var Draggables = {
       });
     if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
   },
-  
+
   _cacheObserverCallbacks: function() {
     ['onStart','onEnd','onDrag'].each( function(eventName) {
       Draggables[eventName+'Count'] = Draggables.observers.select(
@@ -220,7 +219,7 @@ var Draggables = {
       ).length;
     });
   }
-}
+};
 
 /*--------------------------------------------------------------------------*/
 
@@ -236,12 +235,12 @@ var Draggable = Class.create({
       },
       endeffect: function(element) {
         var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
-        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
+        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
           queue: {scope:'_draggable', position:'end'},
-          afterFinish: function(){ 
-            Draggable._dragging[element] = false 
+          afterFinish: function(){
+            Draggable._dragging[element] = false
           }
-        }); 
+        });
       },
       zindex: 1000,
       revert: false,
@@ -252,57 +251,57 @@ var Draggable = Class.create({
       snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
       delay: 0
     };
-    
+
     if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
       Object.extend(defaults, {
         starteffect: function(element) {
           element._opacity = Element.getOpacity(element);
           Draggable._dragging[element] = true;
-          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
+          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
         }
       });
-    
+
     var options = Object.extend(defaults, arguments[1] || { });
 
     this.element = $(element);
-    
+
     if(options.handle && Object.isString(options.handle))
       this.handle = this.element.down('.'+options.handle, 0);
-    
+
     if(!this.handle) this.handle = $(options.handle);
     if(!this.handle) this.handle = this.element;
-    
+
     if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
       options.scroll = $(options.scroll);
       this._isScrollChild = Element.childOf(this.element, options.scroll);
     }
 
-    Element.makePositioned(this.element); // fix IE    
+    Element.makePositioned(this.element); // fix IE
 
     this.options  = options;
-    this.dragging = false;   
+    this.dragging = false;
 
     this.eventMouseDown = this.initDrag.bindAsEventListener(this);
     Event.observe(this.handle, "mousedown", this.eventMouseDown);
-    
+
     Draggables.register(this);
   },
-  
+
   destroy: function() {
     Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
     Draggables.unregister(this);
   },
-  
+
   currentDelta: function() {
     return([
       parseInt(Element.getStyle(this.element,'left') || '0'),
       parseInt(Element.getStyle(this.element,'top') || '0')]);
   },
-  
+
   initDrag: function(event) {
     if(!Object.isUndefined(Draggable._dragging[this.element]) &&
       Draggable._dragging[this.element]) return;
-    if(Event.isLeftClick(event)) {    
+    if(Event.isLeftClick(event)) {
       // abort on form elements, fixes a Firefox issue
       var src = Event.element(event);
       if((tag_name = src.tagName.toUpperCase()) && (
@@ -311,34 +310,34 @@ var Draggable = Class.create({
         tag_name=='OPTION' ||
         tag_name=='BUTTON' ||
         tag_name=='TEXTAREA')) return;
-        
+
       var pointer = [Event.pointerX(event), Event.pointerY(event)];
-      var pos     = Position.cumulativeOffset(this.element);
+      var pos     = this.element.cumulativeOffset();
       this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-      
+
       Draggables.activate(this);
       Event.stop(event);
     }
   },
-  
+
   startDrag: function(event) {
     this.dragging = true;
     if(!this.delta)
       this.delta = this.currentDelta();
-    
+
     if(this.options.zindex) {
       this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
       this.element.style.zIndex = this.options.zindex;
     }
-    
+
     if(this.options.ghosting) {
       this._clone = this.element.cloneNode(true);
-      this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
-      if (!this.element._originallyAbsolute)
+      this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
+      if (!this._originallyAbsolute)
         Position.absolutize(this.element);
       this.element.parentNode.insertBefore(this._clone, this.element);
     }
-    
+
     if(this.options.scroll) {
       if (this.options.scroll == window) {
         var where = this._getWindowScroll(this.options.scroll);
@@ -349,28 +348,28 @@ var Draggable = Class.create({
         this.originalScrollTop = this.options.scroll.scrollTop;
       }
     }
-    
+
     Draggables.notify('onStart', this, event);
-        
+
     if(this.options.starteffect) this.options.starteffect(this.element);
   },
-  
+
   updateDrag: function(event, pointer) {
     if(!this.dragging) this.startDrag(event);
-    
+
     if(!this.options.quiet){
       Position.prepare();
       Droppables.show(pointer, this.element);
     }
-    
+
     Draggables.notify('onDrag', this, event);
-    
+
     this.draw(pointer);
     if(this.options.change) this.options.change(this);
-    
+
     if(this.options.scroll) {
       this.stopScrolling();
-      
+
       var p;
       if (this.options.scroll == window) {
         with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
@@ -388,16 +387,16 @@ var Draggable = Class.create({
       if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
       this.startScrolling(speed);
     }
-    
+
     // fix AppleWebKit rendering
     if(Prototype.Browser.WebKit) window.scrollBy(0,0);
-    
+
     Event.stop(event);
   },
-  
+
   finishDrag: function(event, success) {
     this.dragging = false;
-    
+
     if(this.options.quiet){
       Position.prepare();
       var pointer = [Event.pointerX(event), Event.pointerY(event)];
@@ -405,24 +404,24 @@ var Draggable = Class.create({
     }
 
     if(this.options.ghosting) {
-      if (!this.element._originallyAbsolute)
+      if (!this._originallyAbsolute)
         Position.relativize(this.element);
-      delete this.element._originallyAbsolute;
+      delete this._originallyAbsolute;
       Element.remove(this._clone);
       this._clone = null;
     }
 
-    var dropped = false; 
-    if(success) { 
-      dropped = Droppables.fire(event, this.element); 
-      if (!dropped) dropped = false; 
+    var dropped = false;
+    if(success) {
+      dropped = Droppables.fire(event, this.element);
+      if (!dropped) dropped = false;
     }
     if(dropped && this.options.onDropped) this.options.onDropped(this.element);
     Draggables.notify('onEnd', this, event);
 
     var revert = this.options.revert;
     if(revert && Object.isFunction(revert)) revert = revert(this.element);
-    
+
     var d = this.currentDelta();
     if(revert && this.options.reverteffect) {
       if (dropped == 0 || revert != 'failure')
@@ -435,67 +434,67 @@ var Draggable = Class.create({
     if(this.options.zindex)
       this.element.style.zIndex = this.originalZ;
 
-    if(this.options.endeffect) 
+    if(this.options.endeffect)
       this.options.endeffect(this.element);
-      
+
     Draggables.deactivate(this);
     Droppables.reset();
   },
-  
+
   keyPress: function(event) {
     if(event.keyCode!=Event.KEY_ESC) return;
     this.finishDrag(event, false);
     Event.stop(event);
   },
-  
+
   endDrag: function(event) {
     if(!this.dragging) return;
     this.stopScrolling();
     this.finishDrag(event, true);
     Event.stop(event);
   },
-  
+
   draw: function(point) {
-    var pos = Position.cumulativeOffset(this.element);
+    var pos = this.element.cumulativeOffset();
     if(this.options.ghosting) {
       var r   = Position.realOffset(this.element);
       pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
     }
-    
+
     var d = this.currentDelta();
     pos[0] -= d[0]; pos[1] -= d[1];
-    
+
     if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
       pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
       pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
     }
-    
-    var p = [0,1].map(function(i){ 
-      return (point[i]-pos[i]-this.offset[i]) 
+
+    var p = [0,1].map(function(i){
+      return (point[i]-pos[i]-this.offset[i])
     }.bind(this));
-    
+
     if(this.options.snap) {
       if(Object.isFunction(this.options.snap)) {
         p = this.options.snap(p[0],p[1],this);
       } else {
       if(Object.isArray(this.options.snap)) {
         p = p.map( function(v, i) {
-          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
+          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
       } else {
         p = p.map( function(v) {
-          return (v/this.options.snap).round()*this.options.snap }.bind(this))
+          return (v/this.options.snap).round()*this.options.snap }.bind(this));
       }
     }}
-    
+
     var style = this.element.style;
     if((!this.options.constraint) || (this.options.constraint=='horizontal'))
       style.left = p[0] + "px";
     if((!this.options.constraint) || (this.options.constraint=='vertical'))
       style.top  = p[1] + "px";
-    
+
     if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
   },
-  
+
   stopScrolling: function() {
     if(this.scrollInterval) {
       clearInterval(this.scrollInterval);
@@ -503,14 +502,14 @@ var Draggable = Class.create({
       Draggables._lastScrollPointer = null;
     }
   },
-  
+
   startScrolling: function(speed) {
     if(!(speed[0] || speed[1])) return;
     this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
     this.lastScrolled = new Date();
     this.scrollInterval = setInterval(this.scroll.bind(this), 10);
   },
-  
+
   scroll: function() {
     var current = new Date();
     var delta = current - this.lastScrolled;
@@ -526,7 +525,7 @@ var Draggable = Class.create({
       this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
       this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
     }
-    
+
     Position.prepare();
     Droppables.show(Draggables._lastPointer, this.element);
     Draggables.notify('onDrag', this);
@@ -540,10 +539,10 @@ var Draggable = Class.create({
         Draggables._lastScrollPointer[1] = 0;
       this.draw(Draggables._lastScrollPointer);
     }
-    
+
     if(this.options.change) this.options.change(this);
   },
-  
+
   _getWindowScroll: function(w) {
     var T, L, W, H;
     with (w.document) {
@@ -562,7 +561,7 @@ var Draggable = Class.create({
         H = documentElement.clientHeight;
       } else {
         W = body.offsetWidth;
-        H = body.offsetHeight
+        H = body.offsetHeight;
       }
     }
     return { top: T, left: L, width: W, height: H };
@@ -579,11 +578,11 @@ var SortableObserver = Class.create({
     this.observer  = observer;
     this.lastValue = Sortable.serialize(this.element);
   },
-  
+
   onStart: function() {
     this.lastValue = Sortable.serialize(this.element);
   },
-  
+
   onEnd: function() {
     Sortable.unmark();
     if(this.lastValue != Sortable.serialize(this.element))
@@ -593,11 +592,11 @@ var SortableObserver = Class.create({
 
 var Sortable = {
   SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-  
+
   sortables: { },
-  
+
   _findRootElement: function(element) {
-    while (element.tagName.toUpperCase() != "BODY") {  
+    while (element.tagName.toUpperCase() != "BODY") {
       if(element.id && Sortable.sortables[element.id]) return element;
       element = element.parentNode;
     }
@@ -608,22 +607,23 @@ var Sortable = {
     if(!element) return;
     return Sortable.sortables[element.id];
   },
-  
+
   destroy: function(element){
-    var s = Sortable.options(element);
-    
+    element = $(element);
+    var s = Sortable.sortables[element.id];
+
     if(s) {
       Draggables.removeObserver(s.element);
       s.droppables.each(function(d){ Droppables.remove(d) });
       s.draggables.invoke('destroy');
-      
+
       delete Sortable.sortables[s.element.id];
     }
   },
 
   create: function(element) {
     element = $(element);
-    var options = Object.extend({ 
+    var options = Object.extend({
       element:     element,
       tag:         'li',       // assumes li children, override with tag: 'tagname'
       dropOnEmpty: false,
@@ -637,17 +637,17 @@ var Sortable = {
       delay:       0,
       hoverclass:  null,
       ghosting:    false,
-      quiet:       false, 
+      quiet:       false,
       scroll:      false,
       scrollSensitivity: 20,
       scrollSpeed: 15,
       format:      this.SERIALIZE_RULE,
-      
-      // these take arrays of elements or ids and can be 
+
+      // these take arrays of elements or ids and can be
       // used for better initialization performance
       elements:    false,
       handles:     false,
-      
+
       onChange:    Prototype.emptyFunction,
       onUpdate:    Prototype.emptyFunction
     }, arguments[1] || { });
@@ -684,24 +684,24 @@ var Sortable = {
     if(options.zindex)
       options_for_draggable.zindex = options.zindex;
 
-    // build options for the droppables  
+    // build options for the droppables
     var options_for_droppable = {
       overlap:     options.overlap,
       containment: options.containment,
       tree:        options.tree,
       hoverclass:  options.hoverclass,
       onHover:     Sortable.onHover
-    }
-    
+    };
+
     var options_for_tree = {
       onHover:      Sortable.onEmptyHover,
       overlap:      options.overlap,
       containment:  options.containment,
       hoverclass:   options.hoverclass
-    }
+    };
 
     // fix for gecko engine
-    Element.cleanWhitespace(element); 
+    Element.cleanWhitespace(element);
 
     options.draggables = [];
     options.droppables = [];
@@ -714,14 +714,14 @@ var Sortable = {
 
     (options.elements || this.findElements(element, options) || []).each( function(e,i) {
       var handle = options.handles ? $(options.handles[i]) :
-        (options.handle ? $(e).select('.' + options.handle)[0] : e); 
+        (options.handle ? $(e).select('.' + options.handle)[0] : e);
       options.draggables.push(
         new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
       Droppables.add(e, options_for_droppable);
       if(options.tree) e.treeNode = element;
-      options.droppables.push(e);      
+      options.droppables.push(e);
     });
-    
+
     if(options.tree) {
       (Sortable.findTreeElements(element, options) || []).each( function(e) {
         Droppables.add(e, options_for_tree);
@@ -731,7 +731,7 @@ var Sortable = {
     }
 
     // keep reference
-    this.sortables[element.id] = options;
+    this.sortables[element.identify()] = options;
 
     // for onupdate
     Draggables.addObserver(new SortableObserver(element, options.onUpdate));
@@ -743,7 +743,7 @@ var Sortable = {
     return Element.findChildren(
       element, options.only, options.tree ? true : false, options.tag);
   },
-  
+
   findTreeElements: function(element, options) {
     return Element.findChildren(
       element, options.only, options.tree ? true : false, options.treeTag);
@@ -760,7 +760,7 @@ var Sortable = {
         var oldParentNode = element.parentNode;
         element.style.visibility = "hidden"; // fix gecko rendering
         dropon.parentNode.insertBefore(element, dropon);
-        if(dropon.parentNode!=oldParentNode) 
+        if(dropon.parentNode!=oldParentNode)
           Sortable.options(oldParentNode).onChange(element);
         Sortable.options(dropon.parentNode).onChange(element);
       }
@@ -771,26 +771,26 @@ var Sortable = {
         var oldParentNode = element.parentNode;
         element.style.visibility = "hidden"; // fix gecko rendering
         dropon.parentNode.insertBefore(element, nextElement);
-        if(dropon.parentNode!=oldParentNode) 
+        if(dropon.parentNode!=oldParentNode)
           Sortable.options(oldParentNode).onChange(element);
         Sortable.options(dropon.parentNode).onChange(element);
       }
     }
   },
-  
+
   onEmptyHover: function(element, dropon, overlap) {
     var oldParentNode = element.parentNode;
     var droponOptions = Sortable.options(dropon);
-        
+
     if(!Element.isParent(dropon, element)) {
       var index;
-      
+
       var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
       var child = null;
-            
+
       if(children) {
         var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-        
+
         for (index = 0; index < children.length; index += 1) {
           if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
             offset -= Element.offsetSize (children[index], droponOptions.overlap);
@@ -803,9 +803,9 @@ var Sortable = {
           }
         }
       }
-      
+
       dropon.insertBefore(element, child);
-      
+
       Sortable.options(oldParentNode).onChange(element);
       droponOptions.onChange(element);
     }
@@ -818,34 +818,34 @@ var Sortable = {
   mark: function(dropon, position) {
     // mark on ghosting only
     var sortable = Sortable.options(dropon.parentNode);
-    if(sortable && !sortable.ghosting) return; 
+    if(sortable && !sortable.ghosting) return;
 
     if(!Sortable._marker) {
-      Sortable._marker = 
+      Sortable._marker =
         ($('dropmarker') || Element.extend(document.createElement('DIV'))).
           hide().addClassName('dropmarker').setStyle({position:'absolute'});
       document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
-    }    
-    var offsets = Position.cumulativeOffset(dropon);
+    }
+    var offsets = dropon.cumulativeOffset();
     Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-    
+
     if(position=='after')
-      if(sortable.overlap == 'horizontal') 
+      if(sortable.overlap == 'horizontal')
         Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
       else
         Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-    
+
     Sortable._marker.show();
   },
-  
+
   _tree: function(element, options, parent) {
     var children = Sortable.findElements(element, options) || [];
-  
+
     for (var i = 0; i < children.length; ++i) {
       var match = children[i].id.match(options.format);
 
       if (!match) continue;
-      
+
       var child = {
         id: encodeURIComponent(match ? match[1] : null),
         element: element,
@@ -853,16 +853,16 @@ var Sortable = {
         children: [],
         position: parent.children.length,
         container: $(children[i]).down(options.treeTag)
-      }
-      
+      };
+
       /* Get the element containing the children and recurse over it */
       if (child.container)
-        this._tree(child.container, options, child)
-      
+        this._tree(child.container, options, child);
+
       parent.children.push (child);
     }
 
-    return parent; 
+    return parent;
   },
 
   tree: function(element) {
@@ -875,15 +875,15 @@ var Sortable = {
       name: element.id,
       format: sortableOptions.format
     }, arguments[1] || { });
-    
+
     var root = {
       id: null,
       parent: null,
       children: [],
       container: element,
       position: 0
-    }
-    
+    };
+
     return Sortable._tree(element, options, root);
   },
 
@@ -899,7 +899,7 @@ var Sortable = {
   sequence: function(element) {
     element = $(element);
     var options = Object.extend(this.options(element), arguments[1] || { });
-    
+
     return $(this.findElements(element, options) || []).map( function(item) {
       return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
     });
@@ -908,14 +908,14 @@ var Sortable = {
   setSequence: function(element, new_sequence) {
     element = $(element);
     var options = Object.extend(this.options(element), arguments[2] || { });
-    
+
     var nodeMap = { };
     this.findElements(element, options).each( function(n) {
         if (n.id.match(options.format))
             nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
         n.parentNode.removeChild(n);
     });
-   
+
     new_sequence.each(function(ident) {
       var n = nodeMap[ident];
       if (n) {
@@ -924,16 +924,16 @@ var Sortable = {
       }
     });
   },
-  
+
   serialize: function(element) {
     element = $(element);
     var options = Object.extend(Sortable.options(element), arguments[1] || { });
     var name = encodeURIComponent(
       (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-    
+
     if (options.tree) {
       return Sortable.tree(element, arguments[1]).children.map( function (item) {
-        return [name + Sortable._constructIndex(item) + "[id]=" + 
+        return [name + Sortable._constructIndex(item) + "[id]=" +
                 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
       }).flatten().join('&');
     } else {
@@ -942,16 +942,16 @@ var Sortable = {
       }).join('&');
     }
   }
-}
+};
 
 // Returns true if child is contained within element
 Element.isParent = function(child, element) {
   if (!child.parentNode || child == element) return false;
   if (child.parentNode == element) return true;
   return Element.isParent(child.parentNode, element);
-}
+};
 
-Element.findChildren = function(element, only, recursive, tagName) {   
+Element.findChildren = function(element, only, recursive, tagName) {
   if(!element.hasChildNodes()) return null;
   tagName = tagName.toUpperCase();
   if(only) only = [only].flatten();
@@ -967,8 +967,8 @@ Element.findChildren = function(element, only, recursive, tagName) {
   });
 
   return (elements.length>0 ? elements.flatten() : []);
-}
+};
 
 Element.offsetSize = function (element, type) {
   return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}
+};
\ No newline at end of file
index 27c29016aa7db9cc8076669dad598f8fc805b3bb..066ee5909ce7faa69d47221f9cda27de05502e3e 100644 (file)
@@ -1,50 +1,50 @@
-// script.aculo.us effects.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
 // Contributors:
 //  Justin Palmer (http://encytemedia.com/)
 //  Mark Pilgrim (http://diveintomark.org/)
 //  Martin Bialasinki
-// 
+//
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/ 
+// For details, see the script.aculo.us web site: http://script.aculo.us/
 
-// converts rgb() and #xxx to #xxxxxx format,  
-// returns self (or first argument) if not convertable  
-String.prototype.parseColor = function() {  
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
   var color = '#';
-  if (this.slice(0,4) == 'rgb(') {  
-    var cols = this.slice(4,this.length-1).split(',');  
-    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
-  } else {  
-    if (this.slice(0,1) == '#') {  
-      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
-      if (this.length==7) color = this.toLowerCase();  
-    }  
-  }  
-  return (color.length==7 ? color : (arguments[0] || this));  
+  if (this.slice(0,4) == 'rgb(') {
+    var cols = this.slice(4,this.length-1).split(',');
+    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
+  } else {
+    if (this.slice(0,1) == '#') {
+      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+      if (this.length==7) color = this.toLowerCase();
+    }
+  }
+  return (color.length==7 ? color : (arguments[0] || this));
 };
 
 /*--------------------------------------------------------------------------*/
 
-Element.collectTextNodes = function(element) {  
+Element.collectTextNodes = function(element) {
   return $A($(element).childNodes).collect( function(node) {
-    return (node.nodeType==3 ? node.nodeValue : 
+    return (node.nodeType==3 ? node.nodeValue :
       (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
   }).flatten().join('');
 };
 
-Element.collectTextNodesIgnoreClass = function(element, className) {  
+Element.collectTextNodesIgnoreClass = function(element, className) {
   return $A($(element).childNodes).collect( function(node) {
-    return (node.nodeType==3 ? node.nodeValue : 
-      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
+    return (node.nodeType==3 ? node.nodeValue :
+      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
         Element.collectTextNodesIgnoreClass(node, className) : ''));
   }).flatten().join('');
 };
 
 Element.setContentZoom = function(element, percent) {
-  element = $(element);  
-  element.setStyle({fontSize: (percent/100) + 'em'});   
+  element = $(element);
+  element.setStyle({fontSize: (percent/100) + 'em'});
   if (Prototype.Browser.WebKit) window.scrollBy(0,0);
   return element;
 };
@@ -72,28 +72,23 @@ var Effect = {
   Transitions: {
     linear: Prototype.K,
     sinoidal: function(pos) {
-      return (-Math.cos(pos*Math.PI)/2) + 0.5;
+      return (-Math.cos(pos*Math.PI)/2) + .5;
     },
     reverse: function(pos) {
       return 1-pos;
     },
     flicker: function(pos) {
-      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+      var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
       return pos > 1 ? 1 : pos;
     },
     wobble: function(pos) {
-      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+      return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
     },
-    pulse: function(pos, pulses) { 
-      pulses = pulses || 5; 
-      return (
-        ((pos % (1/pulses)) * pulses).round() == 0 ? 
-              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
-          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
-        );
+    pulse: function(pos, pulses) {
+      return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
     },
-    spring: function(pos) { 
-      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
+    spring: function(pos) {
+      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
     },
     none: function(pos) {
       return 0;
@@ -114,14 +109,14 @@ var Effect = {
   tagifyText: function(element) {
     var tagifyStyle = 'position:relative';
     if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
-    
+
     element = $(element);
     $A(element.childNodes).each( function(child) {
       if (child.nodeType==3) {
         child.nodeValue.toArray().each( function(character) {
           element.insertBefore(
             new Element('span', {style: tagifyStyle}).update(
-              character == ' ' ? String.fromCharCode(160) : character), 
+              character == ' ' ? String.fromCharCode(160) : character),
               child);
         });
         Element.remove(child);
@@ -130,13 +125,13 @@ var Effect = {
   },
   multiple: function(element, effect) {
     var elements;
-    if (((typeof element == 'object') || 
-        Object.isFunction(element)) && 
+    if (((typeof element == 'object') ||
+        Object.isFunction(element)) &&
        (element.length))
       elements = element;
     else
       elements = $(element).childNodes;
-      
+
     var options = Object.extend({
       speed: 0.1,
       delay: 0.0
@@ -152,14 +147,13 @@ var Effect = {
     'blind':  ['BlindDown','BlindUp'],
     'appear': ['Appear','Fade']
   },
-  toggle: function(element, effect) {
+  toggle: function(element, effect, options) {
     element = $(element);
-    effect = (effect || 'appear').toLowerCase();
-    var options = Object.extend({
+    effect  = (effect || 'appear').toLowerCase();
+    
+    return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
       queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
-    }, arguments[2] || { });
-    Effect[element.visible() ? 
-      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+    }, options || {}));
   }
 };
 
@@ -170,20 +164,20 @@ Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
 Effect.ScopedQueue = Class.create(Enumerable, {
   initialize: function() {
     this.effects  = [];
-    this.interval = null;    
+    this.interval = null;
   },
   _each: function(iterator) {
     this.effects._each(iterator);
   },
   add: function(effect) {
     var timestamp = new Date().getTime();
-    
-    var position = Object.isString(effect.options.queue) ? 
+
+    var position = Object.isString(effect.options.queue) ?
       effect.options.queue : effect.options.queue.position;
-    
+
     switch(position) {
       case 'front':
-        // move unstarted effects after this effect  
+        // move unstarted effects after this effect
         this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
             e.startOn  += effect.finishOn;
             e.finishOn += effect.finishOn;
@@ -197,13 +191,13 @@ Effect.ScopedQueue = Class.create(Enumerable, {
         timestamp = this.effects.pluck('finishOn').max() || timestamp;
         break;
     }
-    
+
     effect.startOn  += timestamp;
     effect.finishOn += timestamp;
 
     if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
       this.effects.push(effect);
-    
+
     if (!this.interval)
       this.interval = setInterval(this.loop.bind(this), 15);
   },
@@ -216,7 +210,7 @@ Effect.ScopedQueue = Class.create(Enumerable, {
   },
   loop: function() {
     var timePos = new Date().getTime();
-    for(var i=0, len=this.effects.length;i<len;i++) 
+    for(var i=0, len=this.effects.length;i<len;i++)
       this.effects[i] && this.effects[i].loop(timePos);
   }
 });
@@ -225,7 +219,7 @@ Effect.Queues = {
   instances: $H(),
   get: function(queueName) {
     if (!Object.isString(queueName)) return queueName;
-    
+
     return this.instances.get(queueName) ||
       this.instances.set(queueName, new Effect.ScopedQueue());
   }
@@ -235,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
 Effect.Base = Class.create({
   position: null,
   start: function(options) {
-    function codeForEvent(options,eventName){
-      return (
-        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
-        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
-      );
-    }
     if (options && options.transition === false) options.transition = Effect.Transitions.linear;
     this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
     this.currentFrame = 0;
@@ -250,23 +238,35 @@ Effect.Base = Class.create({
     this.fromToDelta  = this.options.to-this.options.from;
     this.totalTime    = this.finishOn-this.startOn;
     this.totalFrames  = this.options.fps*this.options.duration;
-    
-    eval('this.render = function(pos){ '+
-      'if (this.state=="idle"){this.state="running";'+
-      codeForEvent(this.options,'beforeSetup')+
-      (this.setup ? 'this.setup();':'')+ 
-      codeForEvent(this.options,'afterSetup')+
-      '};if (this.state=="running"){'+
-      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
-      'this.position=pos;'+
-      codeForEvent(this.options,'beforeUpdate')+
-      (this.update ? 'this.update(pos);':'')+
-      codeForEvent(this.options,'afterUpdate')+
-      '}}');
-    
+
+    this.render = (function() {
+      function dispatch(effect, eventName) {
+        if (effect.options[eventName + 'Internal'])
+          effect.options[eventName + 'Internal'](effect);
+        if (effect.options[eventName])
+          effect.options[eventName](effect);
+      }
+
+      return function(pos) {
+        if (this.state === "idle") {
+          this.state = "running";
+          dispatch(this, 'beforeSetup');
+          if (this.setup) this.setup();
+          dispatch(this, 'afterSetup');
+        }
+        if (this.state === "running") {
+          pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
+          this.position = pos;
+          dispatch(this, 'beforeUpdate');
+          if (this.update) this.update(pos);
+          dispatch(this, 'afterUpdate');
+        }
+      };
+    })();
+
     this.event('beforeStart');
     if (!this.options.sync)
-      Effect.Queues.get(Object.isString(this.options.queue) ? 
+      Effect.Queues.get(Object.isString(this.options.queue) ?
         'global' : this.options.queue.scope).add(this);
   },
   loop: function(timePos) {
@@ -275,9 +275,9 @@ Effect.Base = Class.create({
         this.render(1.0);
         this.cancel();
         this.event('beforeFinish');
-        if (this.finish) this.finish(); 
+        if (this.finish) this.finish();
         this.event('afterFinish');
-        return;  
+        return;
       }
       var pos   = (timePos - this.startOn) / this.totalTime,
           frame = (pos * this.totalFrames).round();
@@ -289,7 +289,7 @@ Effect.Base = Class.create({
   },
   cancel: function() {
     if (!this.options.sync)
-      Effect.Queues.get(Object.isString(this.options.queue) ? 
+      Effect.Queues.get(Object.isString(this.options.queue) ?
         'global' : this.options.queue.scope).remove(this);
     this.state = 'finished';
   },
@@ -327,10 +327,10 @@ Effect.Parallel = Class.create(Effect.Base, {
 Effect.Tween = Class.create(Effect.Base, {
   initialize: function(object, from, to) {
     object = Object.isString(object) ? $(object) : object;
-    var args = $A(arguments), method = args.last(), 
+    var args = $A(arguments), method = args.last(),
       options = args.length == 5 ? args[3] : null;
     this.method = Object.isFunction(method) ? method.bind(object) :
-      Object.isFunction(object[method]) ? object[method].bind(object) : 
+      Object.isFunction(object[method]) ? object[method].bind(object) :
       function(value) { object[method] = value };
     this.start(Object.extend({ from: from, to: to }, options || { }));
   },
@@ -394,7 +394,7 @@ Effect.Move = Class.create(Effect.Base, {
 
 // for backwards compatibility
 Effect.MoveBy = function(element, toTop, toLeft) {
-  return new Effect.Move(element, 
+  return new Effect.Move(element,
     Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
 };
 
@@ -416,15 +416,15 @@ Effect.Scale = Class.create(Effect.Base, {
   setup: function() {
     this.restoreAfterFinish = this.options.restoreAfterFinish || false;
     this.elementPositioning = this.element.getStyle('position');
-    
+
     this.originalStyle = { };
     ['top','left','width','height','fontSize'].each( function(k) {
       this.originalStyle[k] = this.element.style[k];
     }.bind(this));
-      
+
     this.originalTop  = this.element.offsetTop;
     this.originalLeft = this.element.offsetLeft;
-    
+
     var fontSize = this.element.getStyle('font-size') || '100%';
     ['em','px','%','pt'].each( function(fontSizeType) {
       if (fontSize.indexOf(fontSizeType)>0) {
@@ -432,9 +432,9 @@ Effect.Scale = Class.create(Effect.Base, {
         this.fontSizeType = fontSizeType;
       }
     }.bind(this));
-    
+
     this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-    
+
     this.dims = null;
     if (this.options.scaleMode=='box')
       this.dims = [this.element.offsetHeight, this.element.offsetWidth];
@@ -509,17 +509,16 @@ Effect.Highlight = Class.create(Effect.Base, {
 
 Effect.ScrollTo = function(element) {
   var options = arguments[1] || { },
-    scrollOffsets = document.viewport.getScrollOffsets(),
-    elementOffsets = $(element).cumulativeOffset(),
-    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  
+  scrollOffsets = document.viewport.getScrollOffsets(),
+  elementOffsets = $(element).cumulativeOffset();
 
   if (options.offset) elementOffsets[1] += options.offset;
 
   return new Effect.Tween(null,
     scrollOffsets.top,
-    elementOffsets[1] > max ? max : elementOffsets[1],
+    elementOffsets[1],
     options,
-    function(p){ scrollTo(scrollOffsets.left, p.round()) }
+    function(p){ scrollTo(scrollOffsets.left, p.round()); }
   );
 };
 
@@ -531,9 +530,9 @@ Effect.Fade = function(element) {
   var options = Object.extend({
     from: element.getOpacity() || 1.0,
     to:   0.0,
-    afterFinishInternal: function(effect) { 
+    afterFinishInternal: function(effect) {
       if (effect.options.to!=0) return;
-      effect.element.hide().setStyle({opacity: oldOpacity}); 
+      effect.element.hide().setStyle({opacity: oldOpacity});
     }
   }, arguments[1] || { });
   return new Effect.Opacity(element,options);
@@ -549,15 +548,15 @@ Effect.Appear = function(element) {
     effect.element.forceRerendering();
   },
   beforeSetup: function(effect) {
-    effect.element.setOpacity(effect.options.from).show(); 
+    effect.element.setOpacity(effect.options.from).show();
   }}, arguments[1] || { });
   return new Effect.Opacity(element,options);
 };
 
 Effect.Puff = function(element) {
   element = $(element);
-  var oldStyle = { 
-    opacity: element.getInlineOpacity(), 
+  var oldStyle = {
+    opacity: element.getInlineOpacity(),
     position: element.getStyle('position'),
     top:  element.style.top,
     left: element.style.left,
@@ -565,12 +564,12 @@ Effect.Puff = function(element) {
     height: element.style.height
   };
   return new Effect.Parallel(
-   [ new Effect.Scale(element, 200, 
-      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
-     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
-     Object.extend({ duration: 1.0, 
+   [ new Effect.Scale(element, 200,
+      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+     Object.extend({ duration: 1.0,
       beforeSetupInternal: function(effect) {
-        Position.absolutize(effect.effects[0].element)
+        Position.absolutize(effect.effects[0].element);
       },
       afterFinishInternal: function(effect) {
          effect.effects[0].element.hide().setStyle(oldStyle); }
@@ -582,12 +581,12 @@ Effect.BlindUp = function(element) {
   element = $(element);
   element.makeClipping();
   return new Effect.Scale(element, 0,
-    Object.extend({ scaleContent: false, 
-      scaleX: false, 
+    Object.extend({ scaleContent: false,
+      scaleX: false,
       restoreAfterFinish: true,
       afterFinishInternal: function(effect) {
         effect.element.hide().undoClipping();
-      } 
+      }
     }, arguments[1] || { })
   );
 };
@@ -595,15 +594,15 @@ Effect.BlindUp = function(element) {
 Effect.BlindDown = function(element) {
   element = $(element);
   var elementDimensions = element.getDimensions();
-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
+  return new Effect.Scale(element, 100, Object.extend({
+    scaleContent: false,
     scaleX: false,
     scaleFrom: 0,
     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
     restoreAfterFinish: true,
     afterSetup: function(effect) {
-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
-    },  
+      effect.element.makeClipping().setStyle({height: '0px'}).show();
+    },
     afterFinishInternal: function(effect) {
       effect.element.undoClipping();
     }
@@ -618,16 +617,16 @@ Effect.SwitchOff = function(element) {
     from: 0,
     transition: Effect.Transitions.flicker,
     afterFinishInternal: function(effect) {
-      new Effect.Scale(effect.element, 1, { 
+      new Effect.Scale(effect.element, 1, {
         duration: 0.3, scaleFromCenter: true,
         scaleX: false, scaleContent: false, restoreAfterFinish: true,
-        beforeSetup: function(effect) { 
+        beforeSetup: function(effect) {
           effect.element.makePositioned().makeClipping();
         },
         afterFinishInternal: function(effect) {
           effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
         }
-      })
+      });
     }
   }, arguments[1] || { }));
 };
@@ -639,16 +638,16 @@ Effect.DropOut = function(element) {
     left: element.getStyle('left'),
     opacity: element.getInlineOpacity() };
   return new Effect.Parallel(
-    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
+    [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
       new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
     Object.extend(
       { duration: 0.5,
         beforeSetup: function(effect) {
-          effect.effects[0].element.makePositioned(); 
+          effect.effects[0].element.makePositioned();
         },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
-        } 
+        }
       }, arguments[1] || { }));
 };
 
@@ -676,7 +675,7 @@ Effect.Shake = function(element) {
     new Effect.Move(effect.element,
       { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
         effect.element.undoPositioned().setStyle(oldStyle);
-  }}) }}) }}) }}) }}) }});
+  }}); }}); }}); }}); }}); }});
 };
 
 Effect.SlideDown = function(element) {
@@ -684,9 +683,9 @@ Effect.SlideDown = function(element) {
   // SlideDown need to have the content of the element wrapped in a container element with fixed height!
   var oldInnerBottom = element.down().getStyle('bottom');
   var elementDimensions = element.getDimensions();
-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
-    scaleX: false, 
+  return new Effect.Scale(element, 100, Object.extend({
+    scaleContent: false,
+    scaleX: false,
     scaleFrom: window.opera ? 0 : 1,
     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
     restoreAfterFinish: true,
@@ -694,11 +693,11 @@ Effect.SlideDown = function(element) {
       effect.element.makePositioned();
       effect.element.down().makePositioned();
       if (window.opera) effect.element.setStyle({top: ''});
-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
+      effect.element.makeClipping().setStyle({height: '0px'}).show();
     },
     afterUpdateInternal: function(effect) {
       effect.element.down().setStyle({bottom:
-        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
+        (effect.dims[0] - effect.element.clientHeight) + 'px' });
     },
     afterFinishInternal: function(effect) {
       effect.element.undoClipping().undoPositioned();
@@ -712,8 +711,8 @@ Effect.SlideUp = function(element) {
   var oldInnerBottom = element.down().getStyle('bottom');
   var elementDimensions = element.getDimensions();
   return new Effect.Scale(element, window.opera ? 0 : 1,
-   Object.extend({ scaleContent: false, 
-    scaleX: false, 
+   Object.extend({ scaleContent: false,
+    scaleX: false,
     scaleMode: 'box',
     scaleFrom: 100,
     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
@@ -723,7 +722,7 @@ Effect.SlideUp = function(element) {
       effect.element.down().makePositioned();
       if (window.opera) effect.element.setStyle({top: ''});
       effect.element.makeClipping().show();
-    },  
+    },
     afterUpdateInternal: function(effect) {
       effect.element.down().setStyle({bottom:
         (effect.dims[0] - effect.element.clientHeight) + 'px' });
@@ -736,15 +735,15 @@ Effect.SlideUp = function(element) {
   );
 };
 
-// Bug in opera makes the TD containing this element expand for a instance after finish 
+// Bug in opera makes the TD containing this element expand for a instance after finish
 Effect.Squish = function(element) {
-  return new Effect.Scale(element, window.opera ? 1 : 0, { 
+  return new Effect.Scale(element, window.opera ? 1 : 0, {
     restoreAfterFinish: true,
     beforeSetup: function(effect) {
-      effect.element.makeClipping(); 
-    },  
+      effect.element.makeClipping();
+    },
     afterFinishInternal: function(effect) {
-      effect.element.hide().undoClipping(); 
+      effect.element.hide().undoClipping();
     }
   });
 };
@@ -764,13 +763,13 @@ Effect.Grow = function(element) {
     width: element.style.width,
     opacity: element.getInlineOpacity() };
 
-  var dims = element.getDimensions();    
+  var dims = element.getDimensions();
   var initialMoveX, initialMoveY;
   var moveX, moveY;
-  
+
   switch (options.direction) {
     case 'top-left':
-      initialMoveX = initialMoveY = moveX = moveY = 0; 
+      initialMoveX = initialMoveY = moveX = moveY = 0;
       break;
     case 'top-right':
       initialMoveX = dims.width;
@@ -795,11 +794,11 @@ Effect.Grow = function(element) {
       moveY = -dims.height / 2;
       break;
   }
-  
+
   return new Effect.Move(element, {
     x: initialMoveX,
     y: initialMoveY,
-    duration: 0.01, 
+    duration: 0.01,
     beforeSetup: function(effect) {
       effect.element.hide().makeClipping().makePositioned();
     },
@@ -808,17 +807,17 @@ Effect.Grow = function(element) {
         [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
           new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
           new Effect.Scale(effect.element, 100, {
-            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
+            scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
             sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
         ], Object.extend({
              beforeSetup: function(effect) {
-               effect.effects[0].element.setStyle({height: '0px'}).show(); 
+               effect.effects[0].element.setStyle({height: '0px'}).show();
              },
              afterFinishInternal: function(effect) {
-               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
+               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
              }
            }, options)
-      )
+      );
     }
   });
 };
@@ -840,7 +839,7 @@ Effect.Shrink = function(element) {
 
   var dims = element.getDimensions();
   var moveX, moveY;
-  
+
   switch (options.direction) {
     case 'top-left':
       moveX = moveY = 0;
@@ -857,19 +856,19 @@ Effect.Shrink = function(element) {
       moveX = dims.width;
       moveY = dims.height;
       break;
-    case 'center':  
+    case 'center':
       moveX = dims.width / 2;
       moveY = dims.height / 2;
       break;
   }
-  
+
   return new Effect.Parallel(
     [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
       new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
       new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
-    ], Object.extend({            
+    ], Object.extend({
          beforeStartInternal: function(effect) {
-           effect.effects[0].element.makePositioned().makeClipping(); 
+           effect.effects[0].element.makePositioned().makeClipping();
          },
          afterFinishInternal: function(effect) {
            effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
@@ -879,12 +878,14 @@ Effect.Shrink = function(element) {
 
 Effect.Pulsate = function(element) {
   element = $(element);
-  var options    = arguments[1] || { };
-  var oldOpacity = element.getInlineOpacity();
-  var transition = options.transition || Effect.Transitions.sinoidal;
-  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
-  reverser.bind(transition);
-  return new Effect.Opacity(element, 
+  var options    = arguments[1] || { },
+    oldOpacity = element.getInlineOpacity(),
+    transition = options.transition || Effect.Transitions.linear,
+    reverser   = function(pos){
+      return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
+    };
+
+  return new Effect.Opacity(element,
     Object.extend(Object.extend({  duration: 2.0, from: 0,
       afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
     }, options), {transition: reverser}));
@@ -898,12 +899,12 @@ Effect.Fold = function(element) {
     width: element.style.width,
     height: element.style.height };
   element.makeClipping();
-  return new Effect.Scale(element, 5, Object.extend({   
+  return new Effect.Scale(element, 5, Object.extend({
     scaleContent: false,
     scaleX: false,
     afterFinishInternal: function(effect) {
-    new Effect.Scale(element, 1, { 
-      scaleContent: false, 
+    new Effect.Scale(element, 1, {
+      scaleContent: false,
       scaleY: false,
       afterFinishInternal: function(effect) {
         effect.element.hide().undoClipping().setStyle(oldStyle);
@@ -918,7 +919,7 @@ Effect.Morph = Class.create(Effect.Base, {
     var options = Object.extend({
       style: { }
     }, arguments[1] || { });
-    
+
     if (!Object.isString(options.style)) this.style = $H(options.style);
     else {
       if (options.style.include(':'))
@@ -936,18 +937,18 @@ Effect.Morph = Class.create(Effect.Base, {
           effect.transforms.each(function(transform) {
             effect.element.style[transform.style] = '';
           });
-        }
+        };
       }
     }
     this.start(options);
   },
-  
+
   setup: function(){
     function parseColor(color){
       if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
       color = color.parseColor();
       return $R(0,2).map(function(i){
-        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
+        return parseInt( color.slice(i*2+1,i*2+3), 16 );
       });
     }
     this.transforms = this.style.map(function(pair){
@@ -967,9 +968,9 @@ Effect.Morph = Class.create(Effect.Base, {
       }
 
       var originalValue = this.element.getStyle(property);
-      return { 
-        style: property.camelize(), 
-        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
+      return {
+        style: property.camelize(),
+        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
         targetValue: unit=='color' ? parseColor(value) : value,
         unit: unit
       };
@@ -980,13 +981,13 @@ Effect.Morph = Class.create(Effect.Base, {
           transform.unit != 'color' &&
           (isNaN(transform.originalValue) || isNaN(transform.targetValue))
         )
-      )
+      );
     });
   },
   update: function(position) {
     var style = { }, transform, i = this.transforms.length;
     while(i--)
-      style[(transform = this.transforms[i]).style] = 
+      style[(transform = this.transforms[i]).style] =
         transform.unit=='color' ? '#'+
           (Math.round(transform.originalValue[0]+
             (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
@@ -995,7 +996,7 @@ Effect.Morph = Class.create(Effect.Base, {
           (Math.round(transform.originalValue[2]+
             (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
         (transform.originalValue +
-          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
+          (transform.targetValue - transform.originalValue) * position).toFixed(3) +
             (transform.unit === null ? '' : transform.unit);
     this.element.setStyle(style, true);
   }
@@ -1032,7 +1033,7 @@ Effect.Transform = Class.create({
 });
 
 Element.CSS_PROPERTIES = $w(
-  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
+  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
   'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
   'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
   'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
@@ -1041,7 +1042,7 @@ Element.CSS_PROPERTIES = $w(
   'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
   'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
   'right textIndent top width wordSpacing zIndex');
-  
+
 Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
 
 String.__parseStyleElement = document.createElement('div');
@@ -1053,11 +1054,11 @@ String.prototype.parseStyle = function(){
     String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
     style = String.__parseStyleElement.childNodes[0].style;
   }
-  
+
   Element.CSS_PROPERTIES.each(function(property){
-    if (style[property]) styleRules.set(property, style[property]); 
+    if (style[property]) styleRules.set(property, style[property]);
   });
-  
+
   if (Prototype.Browser.IE && this.include('opacity'))
     styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
 
@@ -1076,14 +1077,14 @@ if (document.defaultView && document.defaultView.getComputedStyle) {
   Element.getStyles = function(element) {
     element = $(element);
     var css = element.currentStyle, styles;
-    styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
-      hash.set(property, css[property]);
-      return hash;
+    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
+      results[property] = css[property];
+      return results;
     });
-    if (!styles.opacity) styles.set('opacity', element.getOpacity());
+    if (!styles.opacity) styles.opacity = element.getOpacity();
     return styles;
   };
-};
+}
 
 Effect.Methods = {
   morph: function(element, style) {
@@ -1092,7 +1093,7 @@ Effect.Methods = {
     return element;
   },
   visualEffect: function(element, effect, options) {
-    element = $(element)
+    element = $(element);
     var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
     new Effect[klass](element, options);
     return element;
@@ -1106,17 +1107,17 @@ Effect.Methods = {
 
 $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
   'pulsate shake puff squish switchOff dropOut').each(
-  function(effect) { 
+  function(effect) {
     Effect.Methods[effect] = function(element, options){
       element = $(element);
       Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
       return element;
-    }
+    };
   }
 );
 
-$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
   function(f) { Effect.Methods[f] = Element[f]; }
 );
 
-Element.addMethods(Effect.Methods);
+Element.addMethods(Effect.Methods);
\ No newline at end of file
diff --git a/wp-includes/js/scriptaculous/prototype.js b/wp-includes/js/scriptaculous/prototype.js
deleted file mode 100644 (file)
index 5c73462..0000000
+++ /dev/null
@@ -1,4184 +0,0 @@
-/*  Prototype JavaScript framework, version 1.6.0
- *  (c) 2005-2007 Sam Stephenson
- *
- *  Prototype is freely distributable under the terms of an MIT-style license.
- *  For details, see the Prototype web site: http://www.prototypejs.org/
- *
- *--------------------------------------------------------------------------*/
-
-var Prototype = {
-  Version: '1.6.0',
-
-  Browser: {
-    IE:     !!(window.attachEvent && !window.opera),
-    Opera:  !!window.opera,
-    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
-    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
-    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
-  },
-
-  BrowserFeatures: {
-    XPath: !!document.evaluate,
-    ElementExtensions: !!window.HTMLElement,
-    SpecificElementExtensions:
-      document.createElement('div').__proto__ &&
-      document.createElement('div').__proto__ !==
-        document.createElement('form').__proto__
-  },
-
-  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
-  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
-
-  emptyFunction: function() { },
-  K: function(x) { return x }
-};
-
-if (Prototype.Browser.MobileSafari)
-  Prototype.BrowserFeatures.SpecificElementExtensions = false;
-
-if (Prototype.Browser.WebKit)
-  Prototype.BrowserFeatures.XPath = false;
-
-/* Based on Alex Arnell's inheritance implementation. */
-var Class = {
-  create: function() {
-    var parent = null, properties = $A(arguments);
-    if (Object.isFunction(properties[0]))
-      parent = properties.shift();
-
-    function klass() {
-      this.initialize.apply(this, arguments);
-    }
-
-    Object.extend(klass, Class.Methods);
-    klass.superclass = parent;
-    klass.subclasses = [];
-
-    if (parent) {
-      var subclass = function() { };
-      subclass.prototype = parent.prototype;
-      klass.prototype = new subclass;
-      parent.subclasses.push(klass);
-    }
-
-    for (var i = 0; i < properties.length; i++)
-      klass.addMethods(properties[i]);
-
-    if (!klass.prototype.initialize)
-      klass.prototype.initialize = Prototype.emptyFunction;
-
-    klass.prototype.constructor = klass;
-
-    return klass;
-  }
-};
-
-Class.Methods = {
-  addMethods: function(source) {
-    var ancestor   = this.superclass && this.superclass.prototype;
-    var properties = Object.keys(source);
-
-    if (!Object.keys({ toString: true }).length)
-      properties.push("toString", "valueOf");
-
-    for (var i = 0, length = properties.length; i < length; i++) {
-      var property = properties[i], value = source[property];
-      if (ancestor && Object.isFunction(value) &&
-          value.argumentNames().first() == "$super") {
-        var method = value, value = Object.extend((function(m) {
-          return function() { return ancestor[m].apply(this, arguments) };
-        })(property).wrap(method), {
-          valueOf:  function() { return method },
-          toString: function() { return method.toString() }
-        });
-      }
-      this.prototype[property] = value;
-    }
-
-    return this;
-  }
-};
-
-var Abstract = { };
-
-Object.extend = function(destination, source) {
-  for (var property in source)
-    destination[property] = source[property];
-  return destination;
-};
-
-Object.extend(Object, {
-  inspect: function(object) {
-    try {
-      if (object === undefined) return 'undefined';
-      if (object === null) return 'null';
-      return object.inspect ? object.inspect() : object.toString();
-    } catch (e) {
-      if (e instanceof RangeError) return '...';
-      throw e;
-    }
-  },
-
-  toJSON: function(object) {
-    var type = typeof object;
-    switch (type) {
-      case 'undefined':
-      case 'function':
-      case 'unknown': return;
-      case 'boolean': return object.toString();
-    }
-
-    if (object === null) return 'null';
-    if (object.toJSON) return object.toJSON();
-    if (Object.isElement(object)) return;
-
-    var results = [];
-    for (var property in object) {
-      var value = Object.toJSON(object[property]);
-      if (value !== undefined)
-        results.push(property.toJSON() + ': ' + value);
-    }
-
-    return '{' + results.join(', ') + '}';
-  },
-
-  toQueryString: function(object) {
-    return $H(object).toQueryString();
-  },
-
-  toHTML: function(object) {
-    return object && object.toHTML ? object.toHTML() : String.interpret(object);
-  },
-
-  keys: function(object) {
-    var keys = [];
-    for (var property in object)
-      keys.push(property);
-    return keys;
-  },
-
-  values: function(object) {
-    var values = [];
-    for (var property in object)
-      values.push(object[property]);
-    return values;
-  },
-
-  clone: function(object) {
-    return Object.extend({ }, object);
-  },
-
-  isElement: function(object) {
-    return object && object.nodeType == 1;
-  },
-
-  isArray: function(object) {
-    return object && object.constructor === Array;
-  },
-
-  isHash: function(object) {
-    return object instanceof Hash;
-  },
-
-  isFunction: function(object) {
-    return typeof object == "function";
-  },
-
-  isString: function(object) {
-    return typeof object == "string";
-  },
-
-  isNumber: function(object) {
-    return typeof object == "number";
-  },
-
-  isUndefined: function(object) {
-    return typeof object == "undefined";
-  }
-});
-
-Object.extend(Function.prototype, {
-  argumentNames: function() {
-    var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
-    return names.length == 1 && !names[0] ? [] : names;
-  },
-
-  bind: function() {
-    if (arguments.length < 2 && arguments[0] === undefined) return this;
-    var __method = this, args = $A(arguments), object = args.shift();
-    return function() {
-      return __method.apply(object, args.concat($A(arguments)));
-    }
-  },
-
-  bindAsEventListener: function() {
-    var __method = this, args = $A(arguments), object = args.shift();
-    return function(event) {
-      return __method.apply(object, [event || window.event].concat(args));
-    }
-  },
-
-  curry: function() {
-    if (!arguments.length) return this;
-    var __method = this, args = $A(arguments);
-    return function() {
-      return __method.apply(this, args.concat($A(arguments)));
-    }
-  },
-
-  delay: function() {
-    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
-    return window.setTimeout(function() {
-      return __method.apply(__method, args);
-    }, timeout);
-  },
-
-  wrap: function(wrapper) {
-    var __method = this;
-    return function() {
-      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
-    }
-  },
-
-  methodize: function() {
-    if (this._methodized) return this._methodized;
-    var __method = this;
-    return this._methodized = function() {
-      return __method.apply(null, [this].concat($A(arguments)));
-    };
-  }
-});
-
-Function.prototype.defer = Function.prototype.delay.curry(0.01);
-
-Date.prototype.toJSON = function() {
-  return '"' + this.getUTCFullYear() + '-' +
-    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
-    this.getUTCDate().toPaddedString(2) + 'T' +
-    this.getUTCHours().toPaddedString(2) + ':' +
-    this.getUTCMinutes().toPaddedString(2) + ':' +
-    this.getUTCSeconds().toPaddedString(2) + 'Z"';
-};
-
-var Try = {
-  these: function() {
-    var returnValue;
-
-    for (var i = 0, length = arguments.length; i < length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) { }
-    }
-
-    return returnValue;
-  }
-};
-
-RegExp.prototype.match = RegExp.prototype.test;
-
-RegExp.escape = function(str) {
-  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
-};
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create({
-  initialize: function(callback, frequency) {
-    this.callback = callback;
-    this.frequency = frequency;
-    this.currentlyExecuting = false;
-
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  execute: function() {
-    this.callback(this);
-  },
-
-  stop: function() {
-    if (!this.timer) return;
-    clearInterval(this.timer);
-    this.timer = null;
-  },
-
-  onTimerEvent: function() {
-    if (!this.currentlyExecuting) {
-      try {
-        this.currentlyExecuting = true;
-        this.execute();
-      } finally {
-        this.currentlyExecuting = false;
-      }
-    }
-  }
-});
-Object.extend(String, {
-  interpret: function(value) {
-    return value == null ? '' : String(value);
-  },
-  specialChar: {
-    '\b': '\\b',
-    '\t': '\\t',
-    '\n': '\\n',
-    '\f': '\\f',
-    '\r': '\\r',
-    '\\': '\\\\'
-  }
-});
-
-Object.extend(String.prototype, {
-  gsub: function(pattern, replacement) {
-    var result = '', source = this, match;
-    replacement = arguments.callee.prepareReplacement(replacement);
-
-    while (source.length > 0) {
-      if (match = source.match(pattern)) {
-        result += source.slice(0, match.index);
-        result += String.interpret(replacement(match));
-        source  = source.slice(match.index + match[0].length);
-      } else {
-        result += source, source = '';
-      }
-    }
-    return result;
-  },
-
-  sub: function(pattern, replacement, count) {
-    replacement = this.gsub.prepareReplacement(replacement);
-    count = count === undefined ? 1 : count;
-
-    return this.gsub(pattern, function(match) {
-      if (--count < 0) return match[0];
-      return replacement(match);
-    });
-  },
-
-  scan: function(pattern, iterator) {
-    this.gsub(pattern, iterator);
-    return String(this);
-  },
-
-  truncate: function(length, truncation) {
-    length = length || 30;
-    truncation = truncation === undefined ? '...' : truncation;
-    return this.length > length ?
-      this.slice(0, length - truncation.length) + truncation : String(this);
-  },
-
-  strip: function() {
-    return this.replace(/^\s+/, '').replace(/\s+$/, '');
-  },
-
-  stripTags: function() {
-    return this.replace(/<\/?[^>]+>/gi, '');
-  },
-
-  stripScripts: function() {
-    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
-  },
-
-  extractScripts: function() {
-    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
-    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
-    return (this.match(matchAll) || []).map(function(scriptTag) {
-      return (scriptTag.match(matchOne) || ['', ''])[1];
-    });
-  },
-
-  evalScripts: function() {
-    return this.extractScripts().map(function(script) { return eval(script) });
-  },
-
-  escapeHTML: function() {
-    var self = arguments.callee;
-    self.text.data = this;
-    return self.div.innerHTML;
-  },
-
-  unescapeHTML: function() {
-    var div = new Element('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? (div.childNodes.length > 1 ?
-      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
-      div.childNodes[0].nodeValue) : '';
-  },
-
-  toQueryParams: function(separator) {
-    var match = this.strip().match(/([^?#]*)(#.*)?$/);
-    if (!match) return { };
-
-    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
-      if ((pair = pair.split('='))[0]) {
-        var key = decodeURIComponent(pair.shift());
-        var value = pair.length > 1 ? pair.join('=') : pair[0];
-        if (value != undefined) value = decodeURIComponent(value);
-
-        if (key in hash) {
-          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
-          hash[key].push(value);
-        }
-        else hash[key] = value;
-      }
-      return hash;
-    });
-  },
-
-  toArray: function() {
-    return this.split('');
-  },
-
-  succ: function() {
-    return this.slice(0, this.length - 1) +
-      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
-  },
-
-  times: function(count) {
-    return count < 1 ? '' : new Array(count + 1).join(this);
-  },
-
-  camelize: function() {
-    var parts = this.split('-'), len = parts.length;
-    if (len == 1) return parts[0];
-
-    var camelized = this.charAt(0) == '-'
-      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
-      : parts[0];
-
-    for (var i = 1; i < len; i++)
-      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
-    return camelized;
-  },
-
-  capitalize: function() {
-    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
-  },
-
-  underscore: function() {
-    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
-  },
-
-  dasherize: function() {
-    return this.gsub(/_/,'-');
-  },
-
-  inspect: function(useDoubleQuotes) {
-    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
-      var character = String.specialChar[match[0]];
-      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
-    });
-    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
-    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
-  },
-
-  toJSON: function() {
-    return this.inspect(true);
-  },
-
-  unfilterJSON: function(filter) {
-    return this.sub(filter || Prototype.JSONFilter, '#{1}');
-  },
-
-  isJSON: function() {
-    var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
-    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
-  },
-
-  evalJSON: function(sanitize) {
-    var json = this.unfilterJSON();
-    try {
-      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
-    } catch (e) { }
-    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
-  },
-
-  include: function(pattern) {
-    return this.indexOf(pattern) > -1;
-  },
-
-  startsWith: function(pattern) {
-    return this.indexOf(pattern) === 0;
-  },
-
-  endsWith: function(pattern) {
-    var d = this.length - pattern.length;
-    return d >= 0 && this.lastIndexOf(pattern) === d;
-  },
-
-  empty: function() {
-    return this == '';
-  },
-
-  blank: function() {
-    return /^\s*$/.test(this);
-  },
-
-  interpolate: function(object, pattern) {
-    return new Template(this, pattern).evaluate(object);
-  }
-});
-
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
-  escapeHTML: function() {
-    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
-  },
-  unescapeHTML: function() {
-    return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
-  }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
-  if (Object.isFunction(replacement)) return replacement;
-  var template = new Template(replacement);
-  return function(match) { return template.evaluate(match) };
-};
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
-  div:  document.createElement('div'),
-  text: document.createTextNode('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(text);
-
-var Template = Class.create({
-  initialize: function(template, pattern) {
-    this.template = template.toString();
-    this.pattern = pattern || Template.Pattern;
-  },
-
-  evaluate: function(object) {
-    if (Object.isFunction(object.toTemplateReplacements))
-      object = object.toTemplateReplacements();
-
-    return this.template.gsub(this.pattern, function(match) {
-      if (object == null) return '';
-
-      var before = match[1] || '';
-      if (before == '\\') return match[2];
-
-      var ctx = object, expr = match[3];
-      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
-      if (match == null) return before;
-
-      while (match != null) {
-        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
-        ctx = ctx[comp];
-        if (null == ctx || '' == match[3]) break;
-        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
-        match = pattern.exec(expr);
-      }
-
-      return before + String.interpret(ctx);
-    }.bind(this));
-  }
-});
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-
-var $break = { };
-
-var Enumerable = {
-  each: function(iterator, context) {
-    var index = 0;
-    iterator = iterator.bind(context);
-    try {
-      this._each(function(value) {
-        iterator(value, index++);
-      });
-    } catch (e) {
-      if (e != $break) throw e;
-    }
-    return this;
-  },
-
-  eachSlice: function(number, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var index = -number, slices = [], array = this.toArray();
-    while ((index += number) < array.length)
-      slices.push(array.slice(index, index+number));
-    return slices.collect(iterator, context);
-  },
-
-  all: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = true;
-    this.each(function(value, index) {
-      result = result && !!iterator(value, index);
-      if (!result) throw $break;
-    });
-    return result;
-  },
-
-  any: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = false;
-    this.each(function(value, index) {
-      if (result = !!iterator(value, index))
-        throw $break;
-    });
-    return result;
-  },
-
-  collect: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-    this.each(function(value, index) {
-      results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  detect: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var result;
-    this.each(function(value, index) {
-      if (iterator(value, index)) {
-        result = value;
-        throw $break;
-      }
-    });
-    return result;
-  },
-
-  findAll: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  grep: function(filter, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-
-    if (Object.isString(filter))
-      filter = new RegExp(filter);
-
-    this.each(function(value, index) {
-      if (filter.match(value))
-        results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  include: function(object) {
-    if (Object.isFunction(this.indexOf))
-      if (this.indexOf(object) != -1) return true;
-
-    var found = false;
-    this.each(function(value) {
-      if (value == object) {
-        found = true;
-        throw $break;
-      }
-    });
-    return found;
-  },
-
-  inGroupsOf: function(number, fillWith) {
-    fillWith = fillWith === undefined ? null : fillWith;
-    return this.eachSlice(number, function(slice) {
-      while(slice.length < number) slice.push(fillWith);
-      return slice;
-    });
-  },
-
-  inject: function(memo, iterator, context) {
-    iterator = iterator.bind(context);
-    this.each(function(value, index) {
-      memo = iterator(memo, value, index);
-    });
-    return memo;
-  },
-
-  invoke: function(method) {
-    var args = $A(arguments).slice(1);
-    return this.map(function(value) {
-      return value[method].apply(value, args);
-    });
-  },
-
-  max: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value >= result)
-        result = value;
-    });
-    return result;
-  },
-
-  min: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value < result)
-        result = value;
-    });
-    return result;
-  },
-
-  partition: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var trues = [], falses = [];
-    this.each(function(value, index) {
-      (iterator(value, index) ?
-        trues : falses).push(value);
-    });
-    return [trues, falses];
-  },
-
-  pluck: function(property) {
-    var results = [];
-    this.each(function(value) {
-      results.push(value[property]);
-    });
-    return results;
-  },
-
-  reject: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (!iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  sortBy: function(iterator, context) {
-    iterator = iterator.bind(context);
-    return this.map(function(value, index) {
-      return {value: value, criteria: iterator(value, index)};
-    }).sort(function(left, right) {
-      var a = left.criteria, b = right.criteria;
-      return a < b ? -1 : a > b ? 1 : 0;
-    }).pluck('value');
-  },
-
-  toArray: function() {
-    return this.map();
-  },
-
-  zip: function() {
-    var iterator = Prototype.K, args = $A(arguments);
-    if (Object.isFunction(args.last()))
-      iterator = args.pop();
-
-    var collections = [this].concat(args).map($A);
-    return this.map(function(value, index) {
-      return iterator(collections.pluck(index));
-    });
-  },
-
-  size: function() {
-    return this.toArray().length;
-  },
-
-  inspect: function() {
-    return '#<Enumerable:' + this.toArray().inspect() + '>';
-  }
-};
-
-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  filter:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray,
-  every:   Enumerable.all,
-  some:    Enumerable.any
-});
-function $A(iterable) {
-  if (!iterable) return [];
-  if (iterable.toArray) return iterable.toArray();
-  var length = iterable.length, results = new Array(length);
-  while (length--) results[length] = iterable[length];
-  return results;
-}
-
-if (Prototype.Browser.WebKit) {
-  function $A(iterable) {
-    if (!iterable) return [];
-    if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
-        iterable.toArray) return iterable.toArray();
-    var length = iterable.length, results = new Array(length);
-    while (length--) results[length] = iterable[length];
-    return results;
-  }
-}
-
-Array.from = $A;
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
-  _each: function(iterator) {
-    for (var i = 0, length = this.length; i < length; i++)
-      iterator(this[i]);
-  },
-
-  clear: function() {
-    this.length = 0;
-    return this;
-  },
-
-  first: function() {
-    return this[0];
-  },
-
-  last: function() {
-    return this[this.length - 1];
-  },
-
-  compact: function() {
-    return this.select(function(value) {
-      return value != null;
-    });
-  },
-
-  flatten: function() {
-    return this.inject([], function(array, value) {
-      return array.concat(Object.isArray(value) ?
-        value.flatten() : [value]);
-    });
-  },
-
-  without: function() {
-    var values = $A(arguments);
-    return this.select(function(value) {
-      return !values.include(value);
-    });
-  },
-
-  reverse: function(inline) {
-    return (inline !== false ? this : this.toArray())._reverse();
-  },
-
-  reduce: function() {
-    return this.length > 1 ? this : this[0];
-  },
-
-  uniq: function(sorted) {
-    return this.inject([], function(array, value, index) {
-      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
-        array.push(value);
-      return array;
-    });
-  },
-
-  intersect: function(array) {
-    return this.uniq().findAll(function(item) {
-      return array.detect(function(value) { return item === value });
-    });
-  },
-
-  clone: function() {
-    return [].concat(this);
-  },
-
-  size: function() {
-    return this.length;
-  },
-
-  inspect: function() {
-    return '[' + this.map(Object.inspect).join(', ') + ']';
-  },
-
-  toJSON: function() {
-    var results = [];
-    this.each(function(object) {
-      var value = Object.toJSON(object);
-      if (value !== undefined) results.push(value);
-    });
-    return '[' + results.join(', ') + ']';
-  }
-});
-
-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
-  Array.prototype._each = Array.prototype.forEach;
-
-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
-  i || (i = 0);
-  var length = this.length;
-  if (i < 0) i = length + i;
-  for (; i < length; i++)
-    if (this[i] === item) return i;
-  return -1;
-};
-
-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
-  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
-  var n = this.slice(0, i).reverse().indexOf(item);
-  return (n < 0) ? n : i - n - 1;
-};
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
-  if (!Object.isString(string)) return [];
-  string = string.strip();
-  return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
-  Array.prototype.concat = function() {
-    var array = [];
-    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
-    for (var i = 0, length = arguments.length; i < length; i++) {
-      if (Object.isArray(arguments[i])) {
-        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
-          array.push(arguments[i][j]);
-      } else {
-        array.push(arguments[i]);
-      }
-    }
-    return array;
-  };
-}
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    return this.toPaddedString(2, 16);
-  },
-
-  succ: function() {
-    return this + 1;
-  },
-
-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  },
-
-  toPaddedString: function(length, radix) {
-    var string = this.toString(radix || 10);
-    return '0'.times(length - string.length) + string;
-  },
-
-  toJSON: function() {
-    return isFinite(this) ? this.toString() : 'null';
-  }
-});
-
-$w('abs round ceil floor').each(function(method){
-  Number.prototype[method] = Math[method].methodize();
-});
-function $H(object) {
-  return new Hash(object);
-};
-
-var Hash = Class.create(Enumerable, (function() {
-  if (function() {
-    var i = 0, Test = function(value) { this.key = value };
-    Test.prototype.key = 'foo';
-    for (var property in new Test('bar')) i++;
-    return i > 1;
-  }()) {
-    function each(iterator) {
-      var cache = [];
-      for (var key in this._object) {
-        var value = this._object[key];
-        if (cache.include(key)) continue;
-        cache.push(key);
-        var pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
-  } else {
-    function each(iterator) {
-      for (var key in this._object) {
-        var value = this._object[key], pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
-  }
-
-  function toQueryPair(key, value) {
-    if (Object.isUndefined(value)) return key;
-    return key + '=' + encodeURIComponent(String.interpret(value));
-  }
-
-  return {
-    initialize: function(object) {
-      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
-    },
-
-    _each: each,
-
-    set: function(key, value) {
-      return this._object[key] = value;
-    },
-
-    get: function(key) {
-      return this._object[key];
-    },
-
-    unset: function(key) {
-      var value = this._object[key];
-      delete this._object[key];
-      return value;
-    },
-
-    toObject: function() {
-      return Object.clone(this._object);
-    },
-
-    keys: function() {
-      return this.pluck('key');
-    },
-
-    values: function() {
-      return this.pluck('value');
-    },
-
-    index: function(value) {
-      var match = this.detect(function(pair) {
-        return pair.value === value;
-      });
-      return match && match.key;
-    },
-
-    merge: function(object) {
-      return this.clone().update(object);
-    },
-
-    update: function(object) {
-      return new Hash(object).inject(this, function(result, pair) {
-        result.set(pair.key, pair.value);
-        return result;
-      });
-    },
-
-    toQueryString: function() {
-      return this.map(function(pair) {
-        var key = encodeURIComponent(pair.key), values = pair.value;
-
-        if (values && typeof values == 'object') {
-          if (Object.isArray(values))
-            return values.map(toQueryPair.curry(key)).join('&');
-        }
-        return toQueryPair(key, values);
-      }).join('&');
-    },
-
-    inspect: function() {
-      return '#<Hash:{' + this.map(function(pair) {
-        return pair.map(Object.inspect).join(': ');
-      }).join(', ') + '}>';
-    },
-
-    toJSON: function() {
-      return Object.toJSON(this.toObject());
-    },
-
-    clone: function() {
-      return new Hash(this);
-    }
-  }
-})());
-
-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
-  initialize: function(start, end, exclusive) {
-    this.start = start;
-    this.end = end;
-    this.exclusive = exclusive;
-  },
-
-  _each: function(iterator) {
-    var value = this.start;
-    while (this.include(value)) {
-      iterator(value);
-      value = value.succ();
-    }
-  },
-
-  include: function(value) {
-    if (value < this.start)
-      return false;
-    if (this.exclusive)
-      return value < this.end;
-    return value <= this.end;
-  }
-});
-
-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-};
-
-var Ajax = {
-  getTransport: function() {
-    return Try.these(
-      function() {return new XMLHttpRequest()},
-      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
-      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
-    ) || false;
-  },
-
-  activeRequestCount: 0
-};
-
-Ajax.Responders = {
-  responders: [],
-
-  _each: function(iterator) {
-    this.responders._each(iterator);
-  },
-
-  register: function(responder) {
-    if (!this.include(responder))
-      this.responders.push(responder);
-  },
-
-  unregister: function(responder) {
-    this.responders = this.responders.without(responder);
-  },
-
-  dispatch: function(callback, request, transport, json) {
-    this.each(function(responder) {
-      if (Object.isFunction(responder[callback])) {
-        try {
-          responder[callback].apply(responder, [request, transport, json]);
-        } catch (e) { }
-      }
-    });
-  }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
-  onCreate:   function() { Ajax.activeRequestCount++ },
-  onComplete: function() { Ajax.activeRequestCount-- }
-});
-
-Ajax.Base = Class.create({
-  initialize: function(options) {
-    this.options = {
-      method:       'post',
-      asynchronous: true,
-      contentType:  'application/x-www-form-urlencoded',
-      encoding:     'UTF-8',
-      parameters:   '',
-      evalJSON:     true,
-      evalJS:       true
-    };
-    Object.extend(this.options, options || { });
-
-    this.options.method = this.options.method.toLowerCase();
-    if (Object.isString(this.options.parameters))
-      this.options.parameters = this.options.parameters.toQueryParams();
-  }
-});
-
-Ajax.Request = Class.create(Ajax.Base, {
-  _complete: false,
-
-  initialize: function($super, url, options) {
-    $super(options);
-    this.transport = Ajax.getTransport();
-    this.request(url);
-  },
-
-  request: function(url) {
-    this.url = url;
-    this.method = this.options.method;
-    var params = Object.clone(this.options.parameters);
-
-    if (!['get', 'post'].include(this.method)) {
-      // simulate other verbs over post
-      params['_method'] = this.method;
-      this.method = 'post';
-    }
-
-    this.parameters = params;
-
-    if (params = Object.toQueryString(params)) {
-      // when GET, append parameters to URL
-      if (this.method == 'get')
-        this.url += (this.url.include('?') ? '&' : '?') + params;
-      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
-        params += '&_=';
-    }
-
-    try {
-      var response = new Ajax.Response(this);
-      if (this.options.onCreate) this.options.onCreate(response);
-      Ajax.Responders.dispatch('onCreate', this, response);
-
-      this.transport.open(this.method.toUpperCase(), this.url,
-        this.options.asynchronous);
-
-      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
-
-      this.transport.onreadystatechange = this.onStateChange.bind(this);
-      this.setRequestHeaders();
-
-      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
-      this.transport.send(this.body);
-
-      /* Force Firefox to handle ready state 4 for synchronous requests */
-      if (!this.options.asynchronous && this.transport.overrideMimeType)
-        this.onStateChange();
-
-    }
-    catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  onStateChange: function() {
-    var readyState = this.transport.readyState;
-    if (readyState > 1 && !((readyState == 4) && this._complete))
-      this.respondToReadyState(this.transport.readyState);
-  },
-
-  setRequestHeaders: function() {
-    var headers = {
-      'X-Requested-With': 'XMLHttpRequest',
-      'X-Prototype-Version': Prototype.Version,
-      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
-    };
-
-    if (this.method == 'post') {
-      headers['Content-type'] = this.options.contentType +
-        (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
-      /* Force "Connection: close" for older Mozilla browsers to work
-       * around a bug where XMLHttpRequest sends an incorrect
-       * Content-length header. See Mozilla Bugzilla #246651.
-       */
-      if (this.transport.overrideMimeType &&
-          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
-            headers['Connection'] = 'close';
-    }
-
-    // user-defined headers
-    if (typeof this.options.requestHeaders == 'object') {
-      var extras = this.options.requestHeaders;
-
-      if (Object.isFunction(extras.push))
-        for (var i = 0, length = extras.length; i < length; i += 2)
-          headers[extras[i]] = extras[i+1];
-      else
-        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
-    }
-
-    for (var name in headers)
-      this.transport.setRequestHeader(name, headers[name]);
-  },
-
-  success: function() {
-    var status = this.getStatus();
-    return !status || (status >= 200 && status < 300);
-  },
-
-  getStatus: function() {
-    try {
-      return this.transport.status || 0;
-    } catch (e) { return 0 }
-  },
-
-  respondToReadyState: function(readyState) {
-    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
-
-    if (state == 'Complete') {
-      try {
-        this._complete = true;
-        (this.options['on' + response.status]
-         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
-         || Prototype.emptyFunction)(response, response.headerJSON);
-      } catch (e) {
-        this.dispatchException(e);
-      }
-
-      var contentType = response.getHeader('Content-type');
-      if (this.options.evalJS == 'force'
-          || (this.options.evalJS && contentType
-          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
-        this.evalResponse();
-    }
-
-    try {
-      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
-      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
-    } catch (e) {
-      this.dispatchException(e);
-    }
-
-    if (state == 'Complete') {
-      // avoid memory leak in MSIE: clean up
-      this.transport.onreadystatechange = Prototype.emptyFunction;
-    }
-  },
-
-  getHeader: function(name) {
-    try {
-      return this.transport.getResponseHeader(name);
-    } catch (e) { return null }
-  },
-
-  evalResponse: function() {
-    try {
-      return eval((this.transport.responseText || '').unfilterJSON());
-    } catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  dispatchException: function(exception) {
-    (this.options.onException || Prototype.emptyFunction)(this, exception);
-    Ajax.Responders.dispatch('onException', this, exception);
-  }
-});
-
-Ajax.Request.Events =
-  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Response = Class.create({
-  initialize: function(request){
-    this.request = request;
-    var transport  = this.transport  = request.transport,
-        readyState = this.readyState = transport.readyState;
-
-    if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
-      this.status       = this.getStatus();
-      this.statusText   = this.getStatusText();
-      this.responseText = String.interpret(transport.responseText);
-      this.headerJSON   = this._getHeaderJSON();
-    }
-
-    if(readyState == 4) {
-      var xml = transport.responseXML;
-      this.responseXML  = xml === undefined ? null : xml;
-      this.responseJSON = this._getResponseJSON();
-    }
-  },
-
-  status:      0,
-  statusText: '',
-
-  getStatus: Ajax.Request.prototype.getStatus,
-
-  getStatusText: function() {
-    try {
-      return this.transport.statusText || '';
-    } catch (e) { return '' }
-  },
-
-  getHeader: Ajax.Request.prototype.getHeader,
-
-  getAllHeaders: function() {
-    try {
-      return this.getAllResponseHeaders();
-    } catch (e) { return null }
-  },
-
-  getResponseHeader: function(name) {
-    return this.transport.getResponseHeader(name);
-  },
-
-  getAllResponseHeaders: function() {
-    return this.transport.getAllResponseHeaders();
-  },
-
-  _getHeaderJSON: function() {
-    var json = this.getHeader('X-JSON');
-    if (!json) return null;
-    json = decodeURIComponent(escape(json));
-    try {
-      return json.evalJSON(this.request.options.sanitizeJSON);
-    } catch (e) {
-      this.request.dispatchException(e);
-    }
-  },
-
-  _getResponseJSON: function() {
-    var options = this.request.options;
-    if (!options.evalJSON || (options.evalJSON != 'force' &&
-      !(this.getHeader('Content-type') || '').include('application/json')))
-        return null;
-    try {
-      return this.transport.responseText.evalJSON(options.sanitizeJSON);
-    } catch (e) {
-      this.request.dispatchException(e);
-    }
-  }
-});
-
-Ajax.Updater = Class.create(Ajax.Request, {
-  initialize: function($super, container, url, options) {
-    this.container = {
-      success: (container.success || container),
-      failure: (container.failure || (container.success ? null : container))
-    };
-
-    options = options || { };
-    var onComplete = options.onComplete;
-    options.onComplete = (function(response, param) {
-      this.updateContent(response.responseText);
-      if (Object.isFunction(onComplete)) onComplete(response, param);
-    }).bind(this);
-
-    $super(url, options);
-  },
-
-  updateContent: function(responseText) {
-    var receiver = this.container[this.success() ? 'success' : 'failure'],
-        options = this.options;
-
-    if (!options.evalScripts) responseText = responseText.stripScripts();
-
-    if (receiver = $(receiver)) {
-      if (options.insertion) {
-        if (Object.isString(options.insertion)) {
-          var insertion = { }; insertion[options.insertion] = responseText;
-          receiver.insert(insertion);
-        }
-        else options.insertion(receiver, responseText);
-      }
-      else receiver.update(responseText);
-    }
-
-    if (this.success()) {
-      if (this.onComplete) this.onComplete.bind(this).defer();
-    }
-  }
-});
-
-Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
-  initialize: function($super, container, url, options) {
-    $super(options);
-    this.onComplete = this.options.onComplete;
-
-    this.frequency = (this.options.frequency || 2);
-    this.decay = (this.options.decay || 1);
-
-    this.updater = { };
-    this.container = container;
-    this.url = url;
-
-    this.start();
-  },
-
-  start: function() {
-    this.options.onComplete = this.updateComplete.bind(this);
-    this.onTimerEvent();
-  },
-
-  stop: function() {
-    this.updater.options.onComplete = undefined;
-    clearTimeout(this.timer);
-    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
-  },
-
-  updateComplete: function(response) {
-    if (this.options.decay) {
-      this.decay = (response.responseText == this.lastText ?
-        this.decay * this.options.decay : 1);
-
-      this.lastText = response.responseText;
-    }
-    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
-  },
-
-  onTimerEvent: function() {
-    this.updater = new Ajax.Updater(this.container, this.url, this.options);
-  }
-});
-function $(element) {
-  if (arguments.length > 1) {
-    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
-      elements.push($(arguments[i]));
-    return elements;
-  }
-  if (Object.isString(element))
-    element = document.getElementById(element);
-  return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
-  document._getElementsByXPath = function(expression, parentElement) {
-    var results = [];
-    var query = document.evaluate(expression, $(parentElement) || document,
-      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
-    for (var i = 0, length = query.snapshotLength; i < length; i++)
-      results.push(Element.extend(query.snapshotItem(i)));
-    return results;
-  };
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Node) var Node = { };
-
-if (!Node.ELEMENT_NODE) {
-  // DOM level 2 ECMAScript Language Binding
-  Object.extend(Node, {
-    ELEMENT_NODE: 1,
-    ATTRIBUTE_NODE: 2,
-    TEXT_NODE: 3,
-    CDATA_SECTION_NODE: 4,
-    ENTITY_REFERENCE_NODE: 5,
-    ENTITY_NODE: 6,
-    PROCESSING_INSTRUCTION_NODE: 7,
-    COMMENT_NODE: 8,
-    DOCUMENT_NODE: 9,
-    DOCUMENT_TYPE_NODE: 10,
-    DOCUMENT_FRAGMENT_NODE: 11,
-    NOTATION_NODE: 12
-  });
-}
-
-(function() {
-  var element = this.Element;
-  this.Element = function(tagName, attributes) {
-    attributes = attributes || { };
-    tagName = tagName.toLowerCase();
-    var cache = Element.cache;
-    if (Prototype.Browser.IE && attributes.name) {
-      tagName = '<' + tagName + ' name="' + attributes.name + '">';
-      delete attributes.name;
-      return Element.writeAttribute(document.createElement(tagName), attributes);
-    }
-    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
-    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
-  };
-  Object.extend(this.Element, element || { });
-}).call(window);
-
-Element.cache = { };
-
-Element.Methods = {
-  visible: function(element) {
-    return $(element).style.display != 'none';
-  },
-
-  toggle: function(element) {
-    element = $(element);
-    Element[Element.visible(element) ? 'hide' : 'show'](element);
-    return element;
-  },
-
-  hide: function(element) {
-    $(element).style.display = 'none';
-    return element;
-  },
-
-  show: function(element) {
-    $(element).style.display = '';
-    return element;
-  },
-
-  remove: function(element) {
-    element = $(element);
-    element.parentNode.removeChild(element);
-    return element;
-  },
-
-  update: function(element, content) {
-    element = $(element);
-    if (content && content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-    content = Object.toHTML(content);
-    element.innerHTML = content.stripScripts();
-    content.evalScripts.bind(content).defer();
-    return element;
-  },
-
-  replace: function(element, content) {
-    element = $(element);
-    if (content && content.toElement) content = content.toElement();
-    else if (!Object.isElement(content)) {
-      content = Object.toHTML(content);
-      var range = element.ownerDocument.createRange();
-      range.selectNode(element);
-      content.evalScripts.bind(content).defer();
-      content = range.createContextualFragment(content.stripScripts());
-    }
-    element.parentNode.replaceChild(content, element);
-    return element;
-  },
-
-  insert: function(element, insertions) {
-    element = $(element);
-
-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
-          insertions = {bottom:insertions};
-
-    var content, t, range;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      t = Element._insertionTranslations[position];
-
-      if (content && content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        t.insert(element, content);
-        continue;
-      }
-
-      content = Object.toHTML(content);
-
-      range = element.ownerDocument.createRange();
-      t.initializeRange(element, range);
-      t.insert(element, range.createContextualFragment(content.stripScripts()));
-
-      content.evalScripts.bind(content).defer();
-    }
-
-    return element;
-  },
-
-  wrap: function(element, wrapper, attributes) {
-    element = $(element);
-    if (Object.isElement(wrapper))
-      $(wrapper).writeAttribute(attributes || { });
-    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
-    else wrapper = new Element('div', wrapper);
-    if (element.parentNode)
-      element.parentNode.replaceChild(wrapper, element);
-    wrapper.appendChild(element);
-    return wrapper;
-  },
-
-  inspect: function(element) {
-    element = $(element);
-    var result = '<' + element.tagName.toLowerCase();
-    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
-      var property = pair.first(), attribute = pair.last();
-      var value = (element[property] || '').toString();
-      if (value) result += ' ' + attribute + '=' + value.inspect(true);
-    });
-    return result + '>';
-  },
-
-  recursivelyCollect: function(element, property) {
-    element = $(element);
-    var elements = [];
-    while (element = element[property])
-      if (element.nodeType == 1)
-        elements.push(Element.extend(element));
-    return elements;
-  },
-
-  ancestors: function(element) {
-    return $(element).recursivelyCollect('parentNode');
-  },
-
-  descendants: function(element) {
-    return $A($(element).getElementsByTagName('*')).each(Element.extend);
-  },
-
-  firstDescendant: function(element) {
-    element = $(element).firstChild;
-    while (element && element.nodeType != 1) element = element.nextSibling;
-    return $(element);
-  },
-
-  immediateDescendants: function(element) {
-    if (!(element = $(element).firstChild)) return [];
-    while (element && element.nodeType != 1) element = element.nextSibling;
-    if (element) return [element].concat($(element).nextSiblings());
-    return [];
-  },
-
-  previousSiblings: function(element) {
-    return $(element).recursivelyCollect('previousSibling');
-  },
-
-  nextSiblings: function(element) {
-    return $(element).recursivelyCollect('nextSibling');
-  },
-
-  siblings: function(element) {
-    element = $(element);
-    return element.previousSiblings().reverse().concat(element.nextSiblings());
-  },
-
-  match: function(element, selector) {
-    if (Object.isString(selector))
-      selector = new Selector(selector);
-    return selector.match($(element));
-  },
-
-  up: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(element.parentNode);
-    var ancestors = element.ancestors();
-    return expression ? Selector.findElement(ancestors, expression, index) :
-      ancestors[index || 0];
-  },
-
-  down: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return element.firstDescendant();
-    var descendants = element.descendants();
-    return expression ? Selector.findElement(descendants, expression, index) :
-      descendants[index || 0];
-  },
-
-  previous: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
-    var previousSiblings = element.previousSiblings();
-    return expression ? Selector.findElement(previousSiblings, expression, index) :
-      previousSiblings[index || 0];
-  },
-
-  next: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
-    var nextSiblings = element.nextSiblings();
-    return expression ? Selector.findElement(nextSiblings, expression, index) :
-      nextSiblings[index || 0];
-  },
-
-  select: function() {
-    var args = $A(arguments), element = $(args.shift());
-    return Selector.findChildElements(element, args);
-  },
-
-  adjacent: function() {
-    var args = $A(arguments), element = $(args.shift());
-    return Selector.findChildElements(element.parentNode, args).without(element);
-  },
-
-  identify: function(element) {
-    element = $(element);
-    var id = element.readAttribute('id'), self = arguments.callee;
-    if (id) return id;
-    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
-    element.writeAttribute('id', id);
-    return id;
-  },
-
-  readAttribute: function(element, name) {
-    element = $(element);
-    if (Prototype.Browser.IE) {
-      var t = Element._attributeTranslations.read;
-      if (t.values[name]) return t.values[name](element, name);
-      if (t.names[name]) name = t.names[name];
-      if (name.include(':')) {
-        return (!element.attributes || !element.attributes[name]) ? null :
-         element.attributes[name].value;
-      }
-    }
-    return element.getAttribute(name);
-  },
-
-  writeAttribute: function(element, name, value) {
-    element = $(element);
-    var attributes = { }, t = Element._attributeTranslations.write;
-
-    if (typeof name == 'object') attributes = name;
-    else attributes[name] = value === undefined ? true : value;
-
-    for (var attr in attributes) {
-      var name = t.names[attr] || attr, value = attributes[attr];
-      if (t.values[attr]) name = t.values[attr](element, value);
-      if (value === false || value === null)
-        element.removeAttribute(name);
-      else if (value === true)
-        element.setAttribute(name, name);
-      else element.setAttribute(name, value);
-    }
-    return element;
-  },
-
-  getHeight: function(element) {
-    return $(element).getDimensions().height;
-  },
-
-  getWidth: function(element) {
-    return $(element).getDimensions().width;
-  },
-
-  classNames: function(element) {
-    return new Element.ClassNames(element);
-  },
-
-  hasClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    var elementClassName = element.className;
-    return (elementClassName.length > 0 && (elementClassName == className ||
-      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
-  },
-
-  addClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    if (!element.hasClassName(className))
-      element.className += (element.className ? ' ' : '') + className;
-    return element;
-  },
-
-  removeClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    element.className = element.className.replace(
-      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
-    return element;
-  },
-
-  toggleClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    return element[element.hasClassName(className) ?
-      'removeClassName' : 'addClassName'](className);
-  },
-
-  // removes whitespace-only text node children
-  cleanWhitespace: function(element) {
-    element = $(element);
-    var node = element.firstChild;
-    while (node) {
-      var nextNode = node.nextSibling;
-      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
-        element.removeChild(node);
-      node = nextNode;
-    }
-    return element;
-  },
-
-  empty: function(element) {
-    return $(element).innerHTML.blank();
-  },
-
-  descendantOf: function(element, ancestor) {
-    element = $(element), ancestor = $(ancestor);
-
-    if (element.compareDocumentPosition)
-      return (element.compareDocumentPosition(ancestor) & 8) === 8;
-
-    if (element.sourceIndex && !Prototype.Browser.Opera) {
-      var e = element.sourceIndex, a = ancestor.sourceIndex,
-       nextAncestor = ancestor.nextSibling;
-      if (!nextAncestor) {
-        do { ancestor = ancestor.parentNode; }
-        while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
-      }
-      if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);
-    }
-
-    while (element = element.parentNode)
-      if (element == ancestor) return true;
-    return false;
-  },
-
-  scrollTo: function(element) {
-    element = $(element);
-    var pos = element.cumulativeOffset();
-    window.scrollTo(pos[0], pos[1]);
-    return element;
-  },
-
-  getStyle: function(element, style) {
-    element = $(element);
-    style = style == 'float' ? 'cssFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value) {
-      var css = document.defaultView.getComputedStyle(element, null);
-      value = css ? css[style] : null;
-    }
-    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
-    return value == 'auto' ? null : value;
-  },
-
-  getOpacity: function(element) {
-    return $(element).getStyle('opacity');
-  },
-
-  setStyle: function(element, styles) {
-    element = $(element);
-    var elementStyle = element.style, match;
-    if (Object.isString(styles)) {
-      element.style.cssText += ';' + styles;
-      return styles.include('opacity') ?
-        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
-    }
-    for (var property in styles)
-      if (property == 'opacity') element.setOpacity(styles[property]);
-      else
-        elementStyle[(property == 'float' || property == 'cssFloat') ?
-          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
-            property] = styles[property];
-
-    return element;
-  },
-
-  setOpacity: function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1 || value === '') ? '' :
-      (value < 0.00001) ? 0 : value;
-    return element;
-  },
-
-  getDimensions: function(element) {
-    element = $(element);
-    var display = $(element).getStyle('display');
-    if (display != 'none' && display != null) // Safari bug
-      return {width: element.offsetWidth, height: element.offsetHeight};
-
-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
-    var els = element.style;
-    var originalVisibility = els.visibility;
-    var originalPosition = els.position;
-    var originalDisplay = els.display;
-    els.visibility = 'hidden';
-    els.position = 'absolute';
-    els.display = 'block';
-    var originalWidth = element.clientWidth;
-    var originalHeight = element.clientHeight;
-    els.display = originalDisplay;
-    els.position = originalPosition;
-    els.visibility = originalVisibility;
-    return {width: originalWidth, height: originalHeight};
-  },
-
-  makePositioned: function(element) {
-    element = $(element);
-    var pos = Element.getStyle(element, 'position');
-    if (pos == 'static' || !pos) {
-      element._madePositioned = true;
-      element.style.position = 'relative';
-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
-        element.style.top = 0;
-        element.style.left = 0;
-      }
-    }
-    return element;
-  },
-
-  undoPositioned: function(element) {
-    element = $(element);
-    if (element._madePositioned) {
-      element._madePositioned = undefined;
-      element.style.position =
-        element.style.top =
-        element.style.left =
-        element.style.bottom =
-        element.style.right = '';
-    }
-    return element;
-  },
-
-  makeClipping: function(element) {
-    element = $(element);
-    if (element._overflow) return element;
-    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
-    if (element._overflow !== 'hidden')
-      element.style.overflow = 'hidden';
-    return element;
-  },
-
-  undoClipping: function(element) {
-    element = $(element);
-    if (!element._overflow) return element;
-    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
-    element._overflow = null;
-    return element;
-  },
-
-  cumulativeOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  positionedOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-      if (element) {
-        if (element.tagName == 'BODY') break;
-        var p = Element.getStyle(element, 'position');
-        if (p == 'relative' || p == 'absolute') break;
-      }
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  absolutize: function(element) {
-    element = $(element);
-    if (element.getStyle('position') == 'absolute') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
-
-    var offsets = element.positionedOffset();
-    var top     = offsets[1];
-    var left    = offsets[0];
-    var width   = element.clientWidth;
-    var height  = element.clientHeight;
-
-    element._originalLeft   = left - parseFloat(element.style.left  || 0);
-    element._originalTop    = top  - parseFloat(element.style.top || 0);
-    element._originalWidth  = element.style.width;
-    element._originalHeight = element.style.height;
-
-    element.style.position = 'absolute';
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.width  = width + 'px';
-    element.style.height = height + 'px';
-    return element;
-  },
-
-  relativize: function(element) {
-    element = $(element);
-    if (element.getStyle('position') == 'relative') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
-
-    element.style.position = 'relative';
-    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
-    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.height = element._originalHeight;
-    element.style.width  = element._originalWidth;
-    return element;
-  },
-
-  cumulativeScrollOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.scrollTop  || 0;
-      valueL += element.scrollLeft || 0;
-      element = element.parentNode;
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  getOffsetParent: function(element) {
-    if (element.offsetParent) return $(element.offsetParent);
-    if (element == document.body) return $(element);
-
-    while ((element = element.parentNode) && element != document.body)
-      if (Element.getStyle(element, 'position') != 'static')
-        return $(element);
-
-    return $(document.body);
-  },
-
-  viewportOffset: function(forElement) {
-    var valueT = 0, valueL = 0;
-
-    var element = forElement;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-
-      // Safari fix
-      if (element.offsetParent == document.body &&
-        Element.getStyle(element, 'position') == 'absolute') break;
-
-    } while (element = element.offsetParent);
-
-    element = forElement;
-    do {
-      if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
-        valueT -= element.scrollTop  || 0;
-        valueL -= element.scrollLeft || 0;
-      }
-    } while (element = element.parentNode);
-
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  clonePosition: function(element, source) {
-    var options = Object.extend({
-      setLeft:    true,
-      setTop:     true,
-      setWidth:   true,
-      setHeight:  true,
-      offsetTop:  0,
-      offsetLeft: 0
-    }, arguments[2] || { });
-
-    // find page position of source
-    source = $(source);
-    var p = source.viewportOffset();
-
-    // find coordinate system to use
-    element = $(element);
-    var delta = [0, 0];
-    var parent = null;
-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
-    if (Element.getStyle(element, 'position') == 'absolute') {
-      parent = element.getOffsetParent();
-      delta = parent.viewportOffset();
-    }
-
-    // correct by body offsets (fixes Safari)
-    if (parent == document.body) {
-      delta[0] -= document.body.offsetLeft;
-      delta[1] -= document.body.offsetTop;
-    }
-
-    // set position
-    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
-    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
-    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
-    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
-    return element;
-  }
-};
-
-Element.Methods.identify.counter = 1;
-
-Object.extend(Element.Methods, {
-  getElementsBySelector: Element.Methods.select,
-  childElements: Element.Methods.immediateDescendants
-});
-
-Element._attributeTranslations = {
-  write: {
-    names: {
-      className: 'class',
-      htmlFor:   'for'
-    },
-    values: { }
-  }
-};
-
-
-if (!document.createRange || Prototype.Browser.Opera) {
-  Element.Methods.insert = function(element, insertions) {
-    element = $(element);
-
-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
-          insertions = { bottom: insertions };
-
-    var t = Element._insertionTranslations, content, position, pos, tagName;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      pos      = t[position];
-
-      if (content && content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        pos.insert(element, content);
-        continue;
-      }
-
-      content = Object.toHTML(content);
-      tagName = ((position == 'before' || position == 'after')
-        ? element.parentNode : element).tagName.toUpperCase();
-
-      if (t.tags[tagName]) {
-        var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-        if (position == 'top' || position == 'after') fragments.reverse();
-        fragments.each(pos.insert.curry(element));
-      }
-      else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
-
-      content.evalScripts.bind(content).defer();
-    }
-
-    return element;
-  };
-}
-
-if (Prototype.Browser.Opera) {
-  Element.Methods._getStyle = Element.Methods.getStyle;
-  Element.Methods.getStyle = function(element, style) {
-    switch(style) {
-      case 'left':
-      case 'top':
-      case 'right':
-      case 'bottom':
-        if (Element._getStyle(element, 'position') == 'static') return null;
-      default: return Element._getStyle(element, style);
-    }
-  };
-  Element.Methods._readAttribute = Element.Methods.readAttribute;
-  Element.Methods.readAttribute = function(element, attribute) {
-    if (attribute == 'title') return element.title;
-    return Element._readAttribute(element, attribute);
-  };
-}
-
-else if (Prototype.Browser.IE) {
-  $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
-    Element.Methods[method] = Element.Methods[method].wrap(
-      function(proceed, element) {
-        element = $(element);
-        var position = element.getStyle('position');
-        if (position != 'static') return proceed(element);
-        element.setStyle({ position: 'relative' });
-        var value = proceed(element);
-        element.setStyle({ position: position });
-        return value;
-      }
-    );
-  });
-
-  Element.Methods.getStyle = function(element, style) {
-    element = $(element);
-    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value && element.currentStyle) value = element.currentStyle[style];
-
-    if (style == 'opacity') {
-      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
-        if (value[1]) return parseFloat(value[1]) / 100;
-      return 1.0;
-    }
-
-    if (value == 'auto') {
-      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
-        return element['offset' + style.capitalize()] + 'px';
-      return null;
-    }
-    return value;
-  };
-
-  Element.Methods.setOpacity = function(element, value) {
-    function stripAlpha(filter){
-      return filter.replace(/alpha\([^\)]*\)/gi,'');
-    }
-    element = $(element);
-    var currentStyle = element.currentStyle;
-    if ((currentStyle && !currentStyle.hasLayout) ||
-      (!currentStyle && element.style.zoom == 'normal'))
-        element.style.zoom = 1;
-
-    var filter = element.getStyle('filter'), style = element.style;
-    if (value == 1 || value === '') {
-      (filter = stripAlpha(filter)) ?
-        style.filter = filter : style.removeAttribute('filter');
-      return element;
-    } else if (value < 0.00001) value = 0;
-    style.filter = stripAlpha(filter) +
-      'alpha(opacity=' + (value * 100) + ')';
-    return element;
-  };
-
-  Element._attributeTranslations = {
-    read: {
-      names: {
-        'class': 'className',
-        'for':   'htmlFor'
-      },
-      values: {
-        _getAttr: function(element, attribute) {
-          return element.getAttribute(attribute, 2);
-        },
-        _getAttrNode: function(element, attribute) {
-          var node = element.getAttributeNode(attribute);
-          return node ? node.value : "";
-        },
-        _getEv: function(element, attribute) {
-          var attribute = element.getAttribute(attribute);
-          return attribute ? attribute.toString().slice(23, -2) : null;
-        },
-        _flag: function(element, attribute) {
-          return $(element).hasAttribute(attribute) ? attribute : null;
-        },
-        style: function(element) {
-          return element.style.cssText.toLowerCase();
-        },
-        title: function(element) {
-          return element.title;
-        }
-      }
-    }
-  };
-
-  Element._attributeTranslations.write = {
-    names: Object.clone(Element._attributeTranslations.read.names),
-    values: {
-      checked: function(element, value) {
-        element.checked = !!value;
-      },
-
-      style: function(element, value) {
-        element.style.cssText = value ? value : '';
-      }
-    }
-  };
-
-  Element._attributeTranslations.has = {};
-
-  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
-      'encType maxLength readOnly longDesc').each(function(attr) {
-    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
-    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
-  });
-
-  (function(v) {
-    Object.extend(v, {
-      href:        v._getAttr,
-      src:         v._getAttr,
-      type:        v._getAttr,
-      action:      v._getAttrNode,
-      disabled:    v._flag,
-      checked:     v._flag,
-      readonly:    v._flag,
-      multiple:    v._flag,
-      onload:      v._getEv,
-      onunload:    v._getEv,
-      onclick:     v._getEv,
-      ondblclick:  v._getEv,
-      onmousedown: v._getEv,
-      onmouseup:   v._getEv,
-      onmouseover: v._getEv,
-      onmousemove: v._getEv,
-      onmouseout:  v._getEv,
-      onfocus:     v._getEv,
-      onblur:      v._getEv,
-      onkeypress:  v._getEv,
-      onkeydown:   v._getEv,
-      onkeyup:     v._getEv,
-      onsubmit:    v._getEv,
-      onreset:     v._getEv,
-      onselect:    v._getEv,
-      onchange:    v._getEv
-    });
-  })(Element._attributeTranslations.read.values);
-}
-
-else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1) ? 0.999999 :
-      (value === '') ? '' : (value < 0.00001) ? 0 : value;
-    return element;
-  };
-}
-
-else if (Prototype.Browser.WebKit) {
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1 || value === '') ? '' :
-      (value < 0.00001) ? 0 : value;
-
-    if (value == 1)
-      if(element.tagName == 'IMG' && element.width) {
-        element.width++; element.width--;
-      } else try {
-        var n = document.createTextNode(' ');
-        element.appendChild(n);
-        element.removeChild(n);
-      } catch (e) { }
-
-    return element;
-  };
-
-  // Safari returns margins on body which is incorrect if the child is absolutely
-  // positioned.  For performance reasons, redefine Position.cumulativeOffset for
-  // KHTML/WebKit only.
-  Element.Methods.cumulativeOffset = function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      if (element.offsetParent == document.body)
-        if (Element.getStyle(element, 'position') == 'absolute') break;
-
-      element = element.offsetParent;
-    } while (element);
-
-    return Element._returnOffset(valueL, valueT);
-  };
-}
-
-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
-  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
-  Element.Methods.update = function(element, content) {
-    element = $(element);
-
-    if (content && content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-
-    content = Object.toHTML(content);
-    var tagName = element.tagName.toUpperCase();
-
-    if (tagName in Element._insertionTranslations.tags) {
-      $A(element.childNodes).each(function(node) { element.removeChild(node) });
-      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
-        .each(function(node) { element.appendChild(node) });
-    }
-    else element.innerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-if (document.createElement('div').outerHTML) {
-  Element.Methods.replace = function(element, content) {
-    element = $(element);
-
-    if (content && content.toElement) content = content.toElement();
-    if (Object.isElement(content)) {
-      element.parentNode.replaceChild(content, element);
-      return element;
-    }
-
-    content = Object.toHTML(content);
-    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
-
-    if (Element._insertionTranslations.tags[tagName]) {
-      var nextSibling = element.next();
-      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-      parent.removeChild(element);
-      if (nextSibling)
-        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
-      else
-        fragments.each(function(node) { parent.appendChild(node) });
-    }
-    else element.outerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-Element._returnOffset = function(l, t) {
-  var result = [l, t];
-  result.left = l;
-  result.top = t;
-  return result;
-};
-
-Element._getContentFromAnonymousElement = function(tagName, html) {
-  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
-  div.innerHTML = t[0] + html + t[1];
-  t[2].times(function() { div = div.firstChild });
-  return $A(div.childNodes);
-};
-
-Element._insertionTranslations = {
-  before: {
-    adjacency: 'beforeBegin',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element);
-    },
-    initializeRange: function(element, range) {
-      range.setStartBefore(element);
-    }
-  },
-  top: {
-    adjacency: 'afterBegin',
-    insert: function(element, node) {
-      element.insertBefore(node, element.firstChild);
-    },
-    initializeRange: function(element, range) {
-      range.selectNodeContents(element);
-      range.collapse(true);
-    }
-  },
-  bottom: {
-    adjacency: 'beforeEnd',
-    insert: function(element, node) {
-      element.appendChild(node);
-    }
-  },
-  after: {
-    adjacency: 'afterEnd',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element.nextSibling);
-    },
-    initializeRange: function(element, range) {
-      range.setStartAfter(element);
-    }
-  },
-  tags: {
-    TABLE:  ['<table>',                '</table>',                   1],
-    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
-    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
-    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
-    SELECT: ['<select>',               '</select>',                  1]
-  }
-};
-
-(function() {
-  this.bottom.initializeRange = this.top.initializeRange;
-  Object.extend(this.tags, {
-    THEAD: this.tags.TBODY,
-    TFOOT: this.tags.TBODY,
-    TH:    this.tags.TD
-  });
-}).call(Element._insertionTranslations);
-
-Element.Methods.Simulated = {
-  hasAttribute: function(element, attribute) {
-    attribute = Element._attributeTranslations.has[attribute] || attribute;
-    var node = $(element).getAttributeNode(attribute);
-    return node && node.specified;
-  }
-};
-
-Element.Methods.ByTag = { };
-
-Object.extend(Element, Element.Methods);
-
-if (!Prototype.BrowserFeatures.ElementExtensions &&
-    document.createElement('div').__proto__) {
-  window.HTMLElement = { };
-  window.HTMLElement.prototype = document.createElement('div').__proto__;
-  Prototype.BrowserFeatures.ElementExtensions = true;
-}
-
-Element.extend = (function() {
-  if (Prototype.BrowserFeatures.SpecificElementExtensions)
-    return Prototype.K;
-
-  var Methods = { }, ByTag = Element.Methods.ByTag;
-
-  var extend = Object.extend(function(element) {
-    if (!element || element._extendedByPrototype ||
-        element.nodeType != 1 || element == window) return element;
-
-    var methods = Object.clone(Methods),
-      tagName = element.tagName, property, value;
-
-    // extend methods for specific tags
-    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
-
-    for (property in methods) {
-      value = methods[property];
-      if (Object.isFunction(value) && !(property in element))
-        element[property] = value.methodize();
-    }
-
-    element._extendedByPrototype = Prototype.emptyFunction;
-    return element;
-
-  }, {
-    refresh: function() {
-      // extend methods for all tags (Safari doesn't need this)
-      if (!Prototype.BrowserFeatures.ElementExtensions) {
-        Object.extend(Methods, Element.Methods);
-        Object.extend(Methods, Element.Methods.Simulated);
-      }
-    }
-  });
-
-  extend.refresh();
-  return extend;
-})();
-
-Element.hasAttribute = function(element, attribute) {
-  if (element.hasAttribute) return element.hasAttribute(attribute);
-  return Element.Methods.Simulated.hasAttribute(element, attribute);
-};
-
-Element.addMethods = function(methods) {
-  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
-
-  if (!methods) {
-    Object.extend(Form, Form.Methods);
-    Object.extend(Form.Element, Form.Element.Methods);
-    Object.extend(Element.Methods.ByTag, {
-      "FORM":     Object.clone(Form.Methods),
-      "INPUT":    Object.clone(Form.Element.Methods),
-      "SELECT":   Object.clone(Form.Element.Methods),
-      "TEXTAREA": Object.clone(Form.Element.Methods)
-    });
-  }
-
-  if (arguments.length == 2) {
-    var tagName = methods;
-    methods = arguments[1];
-  }
-
-  if (!tagName) Object.extend(Element.Methods, methods || { });
-  else {
-    if (Object.isArray(tagName)) tagName.each(extend);
-    else extend(tagName);
-  }
-
-  function extend(tagName) {
-    tagName = tagName.toUpperCase();
-    if (!Element.Methods.ByTag[tagName])
-      Element.Methods.ByTag[tagName] = { };
-    Object.extend(Element.Methods.ByTag[tagName], methods);
-  }
-
-  function copy(methods, destination, onlyIfAbsent) {
-    onlyIfAbsent = onlyIfAbsent || false;
-    for (var property in methods) {
-      var value = methods[property];
-      if (!Object.isFunction(value)) continue;
-      if (!onlyIfAbsent || !(property in destination))
-        destination[property] = value.methodize();
-    }
-  }
-
-  function findDOMClass(tagName) {
-    var klass;
-    var trans = {
-      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
-      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
-      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
-      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
-      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
-      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
-      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
-      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
-      "FrameSet", "IFRAME": "IFrame"
-    };
-    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName.capitalize() + 'Element';
-    if (window[klass]) return window[klass];
-
-    window[klass] = { };
-    window[klass].prototype = document.createElement(tagName).__proto__;
-    return window[klass];
-  }
-
-  if (F.ElementExtensions) {
-    copy(Element.Methods, HTMLElement.prototype);
-    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
-  }
-
-  if (F.SpecificElementExtensions) {
-    for (var tag in Element.Methods.ByTag) {
-      var klass = findDOMClass(tag);
-      if (Object.isUndefined(klass)) continue;
-      copy(T[tag], klass.prototype);
-    }
-  }
-
-  Object.extend(Element, Element.Methods);
-  delete Element.ByTag;
-
-  if (Element.extend.refresh) Element.extend.refresh();
-  Element.cache = { };
-};
-
-document.viewport = {
-  getDimensions: function() {
-    var dimensions = { };
-    $w('width height').each(function(d) {
-      var D = d.capitalize();
-      dimensions[d] = self['inner' + D] ||
-       (document.documentElement['client' + D] || document.body['client' + D]);
-    });
-    return dimensions;
-  },
-
-  getWidth: function() {
-    return this.getDimensions().width;
-  },
-
-  getHeight: function() {
-    return this.getDimensions().height;
-  },
-
-  getScrollOffsets: function() {
-    return Element._returnOffset(
-      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
-      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
-  }
-};
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
- * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
- * license.  Please see http://www.yui-ext.com/ for more information. */
-
-var Selector = Class.create({
-  initialize: function(expression) {
-    this.expression = expression.strip();
-    this.compileMatcher();
-  },
-
-  compileMatcher: function() {
-    // Selectors with namespaced attributes can't use the XPath version
-    if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression))
-      return this.compileXPathMatcher();
-
-    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
-        c = Selector.criteria, le, p, m;
-
-    if (Selector._cache[e]) {
-      this.matcher = Selector._cache[e];
-      return;
-    }
-
-    this.matcher = ["this.matcher = function(root) {",
-                    "var r = root, h = Selector.handlers, c = false, n;"];
-
-    while (e && le != e && (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        p = ps[i];
-        if (m = e.match(p)) {
-          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
-             new Template(c[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.matcher.push("return h.unique(n);\n}");
-    eval(this.matcher.join('\n'));
-    Selector._cache[this.expression] = this.matcher;
-  },
-
-  compileXPathMatcher: function() {
-    var e = this.expression, ps = Selector.patterns,
-        x = Selector.xpath, le, m;
-
-    if (Selector._cache[e]) {
-      this.xpath = Selector._cache[e]; return;
-    }
-
-    this.matcher = ['.//*'];
-    while (e && le != e && (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        if (m = e.match(ps[i])) {
-          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
-            new Template(x[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.xpath = this.matcher.join('');
-    Selector._cache[this.expression] = this.xpath;
-  },
-
-  findElements: function(root) {
-    root = root || document;
-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    return this.matcher(root);
-  },
-
-  match: function(element) {
-    this.tokens = [];
-
-    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
-    var le, p, m;
-
-    while (e && le !== e && (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        p = ps[i];
-        if (m = e.match(p)) {
-          // use the Selector.assertions methods unless the selector
-          // is too complex.
-          if (as[i]) {
-            this.tokens.push([i, Object.clone(m)]);
-            e = e.replace(m[0], '');
-          } else {
-            // reluctantly do a document-wide search
-            // and look for a match in the array
-            return this.findElements(document).include(element);
-          }
-        }
-      }
-    }
-
-    var match = true, name, matches;
-    for (var i = 0, token; token = this.tokens[i]; i++) {
-      name = token[0], matches = token[1];
-      if (!Selector.assertions[name](element, matches)) {
-        match = false; break;
-      }
-    }
-
-    return match;
-  },
-
-  toString: function() {
-    return this.expression;
-  },
-
-  inspect: function() {
-    return "#<Selector:" + this.expression.inspect() + ">";
-  }
-});
-
-Object.extend(Selector, {
-  _cache: { },
-
-  xpath: {
-    descendant:   "//*",
-    child:        "/*",
-    adjacent:     "/following-sibling::*[1]",
-    laterSibling: '/following-sibling::*',
-    tagName:      function(m) {
-      if (m[1] == '*') return '';
-      return "[local-name()='" + m[1].toLowerCase() +
-             "' or local-name()='" + m[1].toUpperCase() + "']";
-    },
-    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
-    id:           "[@id='#{1}']",
-    attrPresence: "[@#{1}]",
-    attr: function(m) {
-      m[3] = m[5] || m[6];
-      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
-    },
-    pseudo: function(m) {
-      var h = Selector.xpath.pseudos[m[1]];
-      if (!h) return '';
-      if (Object.isFunction(h)) return h(m);
-      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
-    },
-    operators: {
-      '=':  "[@#{1}='#{3}']",
-      '!=': "[@#{1}!='#{3}']",
-      '^=': "[starts-with(@#{1}, '#{3}')]",
-      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
-      '*=': "[contains(@#{1}, '#{3}')]",
-      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
-      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
-    },
-    pseudos: {
-      'first-child': '[not(preceding-sibling::*)]',
-      'last-child':  '[not(following-sibling::*)]',
-      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
-      'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
-      'checked':     "[@checked]",
-      'disabled':    "[@disabled]",
-      'enabled':     "[not(@disabled)]",
-      'not': function(m) {
-        var e = m[6], p = Selector.patterns,
-            x = Selector.xpath, le, m, v;
-
-        var exclusion = [];
-        while (e && le != e && (/\S/).test(e)) {
-          le = e;
-          for (var i in p) {
-            if (m = e.match(p[i])) {
-              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
-              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
-              e = e.replace(m[0], '');
-              break;
-            }
-          }
-        }
-        return "[not(" + exclusion.join(" and ") + ")]";
-      },
-      'nth-child':      function(m) {
-        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
-      },
-      'nth-last-child': function(m) {
-        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
-      },
-      'nth-of-type':    function(m) {
-        return Selector.xpath.pseudos.nth("position() ", m);
-      },
-      'nth-last-of-type': function(m) {
-        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
-      },
-      'first-of-type':  function(m) {
-        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
-      },
-      'last-of-type':   function(m) {
-        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
-      },
-      'only-of-type':   function(m) {
-        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
-      },
-      nth: function(fragment, m) {
-        var mm, formula = m[6], predicate;
-        if (formula == 'even') formula = '2n+0';
-        if (formula == 'odd')  formula = '2n+1';
-        if (mm = formula.match(/^(\d+)$/)) // digit only
-          return '[' + fragment + "= " + mm[1] + ']';
-        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-          if (mm[1] == "-") mm[1] = -1;
-          var a = mm[1] ? Number(mm[1]) : 1;
-          var b = mm[2] ? Number(mm[2]) : 0;
-          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
-          "((#{fragment} - #{b}) div #{a} >= 0)]";
-          return new Template(predicate).evaluate({
-            fragment: fragment, a: a, b: b });
-        }
-      }
-    }
-  },
-
-  criteria: {
-    tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;',
-    className:    'n = h.className(n, r, "#{1}", c); c = false;',
-    id:           'n = h.id(n, r, "#{1}", c);        c = false;',
-    attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
-    attr: function(m) {
-      m[3] = (m[5] || m[6]);
-      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
-    },
-    pseudo: function(m) {
-      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
-      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
-    },
-    descendant:   'c = "descendant";',
-    child:        'c = "child";',
-    adjacent:     'c = "adjacent";',
-    laterSibling: 'c = "laterSibling";'
-  },
-
-  patterns: {
-    // combinators must be listed first
-    // (and descendant needs to be last combinator)
-    laterSibling: /^\s*~\s*/,
-    child:        /^\s*>\s*/,
-    adjacent:     /^\s*\+\s*/,
-    descendant:   /^\s/,
-
-    // selectors follow
-    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
-    id:           /^#([\w\-\*]+)(\b|$)/,
-    className:    /^\.([\w\-\*]+)(\b|$)/,
-    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
-    attrPresence: /^\[([\w]+)\]/,
-    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
-  },
-
-  // for Selector.match and Element#match
-  assertions: {
-    tagName: function(element, matches) {
-      return matches[1].toUpperCase() == element.tagName.toUpperCase();
-    },
-
-    className: function(element, matches) {
-      return Element.hasClassName(element, matches[1]);
-    },
-
-    id: function(element, matches) {
-      return element.id === matches[1];
-    },
-
-    attrPresence: function(element, matches) {
-      return Element.hasAttribute(element, matches[1]);
-    },
-
-    attr: function(element, matches) {
-      var nodeValue = Element.readAttribute(element, matches[1]);
-      return Selector.operators[matches[2]](nodeValue, matches[3]);
-    }
-  },
-
-  handlers: {
-    // UTILITY FUNCTIONS
-    // joins two collections
-    concat: function(a, b) {
-      for (var i = 0, node; node = b[i]; i++)
-        a.push(node);
-      return a;
-    },
-
-    // marks an array of nodes for counting
-    mark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = true;
-      return nodes;
-    },
-
-    unmark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = undefined;
-      return nodes;
-    },
-
-    // mark each child node with its position (for nth calls)
-    // "ofType" flag indicates whether we're indexing for nth-of-type
-    // rather than nth-child
-    index: function(parentNode, reverse, ofType) {
-      parentNode._counted = true;
-      if (reverse) {
-        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
-          var node = nodes[i];
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
-        }
-      } else {
-        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
-      }
-    },
-
-    // filters out duplicates and extends all nodes
-    unique: function(nodes) {
-      if (nodes.length == 0) return nodes;
-      var results = [], n;
-      for (var i = 0, l = nodes.length; i < l; i++)
-        if (!(n = nodes[i])._counted) {
-          n._counted = true;
-          results.push(Element.extend(n));
-        }
-      return Selector.handlers.unmark(results);
-    },
-
-    // COMBINATOR FUNCTIONS
-    descendant: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, node.getElementsByTagName('*'));
-      return results;
-    },
-
-    child: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
-          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
-      }
-      return results;
-    },
-
-    adjacent: function(nodes) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        var next = this.nextElementSibling(node);
-        if (next) results.push(next);
-      }
-      return results;
-    },
-
-    laterSibling: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, Element.nextSiblings(node));
-      return results;
-    },
-
-    nextElementSibling: function(node) {
-      while (node = node.nextSibling)
-             if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    previousElementSibling: function(node) {
-      while (node = node.previousSibling)
-        if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    // TOKEN FUNCTIONS
-    tagName: function(nodes, root, tagName, combinator) {
-      tagName = tagName.toUpperCase();
-      var results = [], h = Selector.handlers;
-      if (nodes) {
-        if (combinator) {
-          // fastlane for ordinary descendant combinators
-          if (combinator == "descendant") {
-            for (var i = 0, node; node = nodes[i]; i++)
-              h.concat(results, node.getElementsByTagName(tagName));
-            return results;
-          } else nodes = this[combinator](nodes);
-          if (tagName == "*") return nodes;
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.tagName.toUpperCase() == tagName) results.push(node);
-        return results;
-      } else return root.getElementsByTagName(tagName);
-    },
-
-    id: function(nodes, root, id, combinator) {
-      var targetNode = $(id), h = Selector.handlers;
-      if (!targetNode) return [];
-      if (!nodes && root == document) return [targetNode];
-      if (nodes) {
-        if (combinator) {
-          if (combinator == 'child') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (targetNode.parentNode == node) return [targetNode];
-          } else if (combinator == 'descendant') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Element.descendantOf(targetNode, node)) return [targetNode];
-          } else if (combinator == 'adjacent') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Selector.handlers.previousElementSibling(targetNode) == node)
-                return [targetNode];
-          } else nodes = h[combinator](nodes);
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node == targetNode) return [targetNode];
-        return [];
-      }
-      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
-    },
-
-    className: function(nodes, root, className, combinator) {
-      if (nodes && combinator) nodes = this[combinator](nodes);
-      return Selector.handlers.byClassName(nodes, root, className);
-    },
-
-    byClassName: function(nodes, root, className) {
-      if (!nodes) nodes = Selector.handlers.descendant([root]);
-      var needle = ' ' + className + ' ';
-      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
-        nodeClassName = node.className;
-        if (nodeClassName.length == 0) continue;
-        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
-          results.push(node);
-      }
-      return results;
-    },
-
-    attrPresence: function(nodes, root, attr) {
-      if (!nodes) nodes = root.getElementsByTagName("*");
-      var results = [];
-      for (var i = 0, node; node = nodes[i]; i++)
-        if (Element.hasAttribute(node, attr)) results.push(node);
-      return results;
-    },
-
-    attr: function(nodes, root, attr, value, operator) {
-      if (!nodes) nodes = root.getElementsByTagName("*");
-      var handler = Selector.operators[operator], results = [];
-      for (var i = 0, node; node = nodes[i]; i++) {
-        var nodeValue = Element.readAttribute(node, attr);
-        if (nodeValue === null) continue;
-        if (handler(nodeValue, value)) results.push(node);
-      }
-      return results;
-    },
-
-    pseudo: function(nodes, name, value, root, combinator) {
-      if (nodes && combinator) nodes = this[combinator](nodes);
-      if (!nodes) nodes = root.getElementsByTagName("*");
-      return Selector.pseudos[name](nodes, value, root);
-    }
-  },
-
-  pseudos: {
-    'first-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.previousElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'last-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.nextElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'only-child': function(nodes, value, root) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
-          results.push(node);
-      return results;
-    },
-    'nth-child':        function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root);
-    },
-    'nth-last-child':   function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true);
-    },
-    'nth-of-type':      function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, false, true);
-    },
-    'nth-last-of-type': function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true, true);
-    },
-    'first-of-type':    function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, "1", root, false, true);
-    },
-    'last-of-type':     function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, "1", root, true, true);
-    },
-    'only-of-type':     function(nodes, formula, root) {
-      var p = Selector.pseudos;
-      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
-    },
-
-    // handles the an+b logic
-    getIndices: function(a, b, total) {
-      if (a == 0) return b > 0 ? [b] : [];
-      return $R(1, total).inject([], function(memo, i) {
-        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
-        return memo;
-      });
-    },
-
-    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
-    nth: function(nodes, formula, root, reverse, ofType) {
-      if (nodes.length == 0) return [];
-      if (formula == 'even') formula = '2n+0';
-      if (formula == 'odd')  formula = '2n+1';
-      var h = Selector.handlers, results = [], indexed = [], m;
-      h.mark(nodes);
-      for (var i = 0, node; node = nodes[i]; i++) {
-        if (!node.parentNode._counted) {
-          h.index(node.parentNode, reverse, ofType);
-          indexed.push(node.parentNode);
-        }
-      }
-      if (formula.match(/^\d+$/)) { // just a number
-        formula = Number(formula);
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.nodeIndex == formula) results.push(node);
-      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-        if (m[1] == "-") m[1] = -1;
-        var a = m[1] ? Number(m[1]) : 1;
-        var b = m[2] ? Number(m[2]) : 0;
-        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
-        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
-          for (var j = 0; j < l; j++)
-            if (node.nodeIndex == indices[j]) results.push(node);
-        }
-      }
-      h.unmark(nodes);
-      h.unmark(indexed);
-      return results;
-    },
-
-    'empty': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        // IE treats comments as element nodes
-        if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
-        results.push(node);
-      }
-      return results;
-    },
-
-    'not': function(nodes, selector, root) {
-      var h = Selector.handlers, selectorType, m;
-      var exclusions = new Selector(selector).findElements(root);
-      h.mark(exclusions);
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node._counted) results.push(node);
-      h.unmark(exclusions);
-      return results;
-    },
-
-    'enabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node.disabled) results.push(node);
-      return results;
-    },
-
-    'disabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.disabled) results.push(node);
-      return results;
-    },
-
-    'checked': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.checked) results.push(node);
-      return results;
-    }
-  },
-
-  operators: {
-    '=':  function(nv, v) { return nv == v; },
-    '!=': function(nv, v) { return nv != v; },
-    '^=': function(nv, v) { return nv.startsWith(v); },
-    '$=': function(nv, v) { return nv.endsWith(v); },
-    '*=': function(nv, v) { return nv.include(v); },
-    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
-    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
-  },
-
-  matchElements: function(elements, expression) {
-    var matches = new Selector(expression).findElements(), h = Selector.handlers;
-    h.mark(matches);
-    for (var i = 0, results = [], element; element = elements[i]; i++)
-      if (element._counted) results.push(element);
-    h.unmark(matches);
-    return results;
-  },
-
-  findElement: function(elements, expression, index) {
-    if (Object.isNumber(expression)) {
-      index = expression; expression = false;
-    }
-    return Selector.matchElements(elements, expression || '*')[index || 0];
-  },
-
-  findChildElements: function(element, expressions) {
-    var exprs = expressions.join(','), expressions = [];
-    exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
-      expressions.push(m[1].strip());
-    });
-    var results = [], h = Selector.handlers;
-    for (var i = 0, l = expressions.length, selector; i < l; i++) {
-      selector = new Selector(expressions[i].strip());
-      h.concat(results, selector.findElements(element));
-    }
-    return (l > 1) ? h.unique(results) : results;
-  }
-});
-
-function $$() {
-  return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
-  reset: function(form) {
-    $(form).reset();
-    return form;
-  },
-
-  serializeElements: function(elements, options) {
-    if (typeof options != 'object') options = { hash: !!options };
-    else if (options.hash === undefined) options.hash = true;
-    var key, value, submitted = false, submit = options.submit;
-
-    var data = elements.inject({ }, function(result, element) {
-      if (!element.disabled && element.name) {
-        key = element.name; value = $(element).getValue();
-        if (value != null && (element.type != 'submit' || (!submitted &&
-            submit !== false && (!submit || key == submit) && (submitted = true)))) {
-          if (key in result) {
-            // a key is already present; construct an array of values
-            if (!Object.isArray(result[key])) result[key] = [result[key]];
-            result[key].push(value);
-          }
-          else result[key] = value;
-        }
-      }
-      return result;
-    });
-
-    return options.hash ? data : Object.toQueryString(data);
-  }
-};
-
-Form.Methods = {
-  serialize: function(form, options) {
-    return Form.serializeElements(Form.getElements(form), options);
-  },
-
-  getElements: function(form) {
-    return $A($(form).getElementsByTagName('*')).inject([],
-      function(elements, child) {
-        if (Form.Element.Serializers[child.tagName.toLowerCase()])
-          elements.push(Element.extend(child));
-        return elements;
-      }
-    );
-  },
-
-  getInputs: function(form, typeName, name) {
-    form = $(form);
-    var inputs = form.getElementsByTagName('input');
-
-    if (!typeName && !name) return $A(inputs).map(Element.extend);
-
-    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
-      var input = inputs[i];
-      if ((typeName && input.type != typeName) || (name && input.name != name))
-        continue;
-      matchingInputs.push(Element.extend(input));
-    }
-
-    return matchingInputs;
-  },
-
-  disable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('disable');
-    return form;
-  },
-
-  enable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('enable');
-    return form;
-  },
-
-  findFirstElement: function(form) {
-    var elements = $(form).getElements().findAll(function(element) {
-      return 'hidden' != element.type && !element.disabled;
-    });
-    var firstByIndex = elements.findAll(function(element) {
-      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
-    }).sortBy(function(element) { return element.tabIndex }).first();
-
-    return firstByIndex ? firstByIndex : elements.find(function(element) {
-      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
-    });
-  },
-
-  focusFirstElement: function(form) {
-    form = $(form);
-    form.findFirstElement().activate();
-    return form;
-  },
-
-  request: function(form, options) {
-    form = $(form), options = Object.clone(options || { });
-
-    var params = options.parameters, action = form.readAttribute('action') || '';
-    if (action.blank()) action = window.location.href;
-    options.parameters = form.serialize(true);
-
-    if (params) {
-      if (Object.isString(params)) params = params.toQueryParams();
-      Object.extend(options.parameters, params);
-    }
-
-    if (form.hasAttribute('method') && !options.method)
-      options.method = form.method;
-
-    return new Ajax.Request(action, options);
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
-  focus: function(element) {
-    $(element).focus();
-    return element;
-  },
-
-  select: function(element) {
-    $(element).select();
-    return element;
-  }
-};
-
-Form.Element.Methods = {
-  serialize: function(element) {
-    element = $(element);
-    if (!element.disabled && element.name) {
-      var value = element.getValue();
-      if (value != undefined) {
-        var pair = { };
-        pair[element.name] = value;
-        return Object.toQueryString(pair);
-      }
-    }
-    return '';
-  },
-
-  getValue: function(element) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    return Form.Element.Serializers[method](element);
-  },
-
-  setValue: function(element, value) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    Form.Element.Serializers[method](element, value);
-    return element;
-  },
-
-  clear: function(element) {
-    $(element).value = '';
-    return element;
-  },
-
-  present: function(element) {
-    return $(element).value != '';
-  },
-
-  activate: function(element) {
-    element = $(element);
-    try {
-      element.focus();
-      if (element.select && (element.tagName.toLowerCase() != 'input' ||
-          !['button', 'reset', 'submit'].include(element.type)))
-        element.select();
-    } catch (e) { }
-    return element;
-  },
-
-  disable: function(element) {
-    element = $(element);
-    element.blur();
-    element.disabled = true;
-    return element;
-  },
-
-  enable: function(element) {
-    element = $(element);
-    element.disabled = false;
-    return element;
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Field = Form.Element;
-var $F = Form.Element.Methods.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
-  input: function(element, value) {
-    switch (element.type.toLowerCase()) {
-      case 'checkbox':
-      case 'radio':
-        return Form.Element.Serializers.inputSelector(element, value);
-      default:
-        return Form.Element.Serializers.textarea(element, value);
-    }
-  },
-
-  inputSelector: function(element, value) {
-    if (value === undefined) return element.checked ? element.value : null;
-    else element.checked = !!value;
-  },
-
-  textarea: function(element, value) {
-    if (value === undefined) return element.value;
-    else element.value = value;
-  },
-
-  select: function(element, index) {
-    if (index === undefined)
-      return this[element.type == 'select-one' ?
-        'selectOne' : 'selectMany'](element);
-    else {
-      var opt, value, single = !Object.isArray(index);
-      for (var i = 0, length = element.length; i < length; i++) {
-        opt = element.options[i];
-        value = this.optionValue(opt);
-        if (single) {
-          if (value == index) {
-            opt.selected = true;
-            return;
-          }
-        }
-        else opt.selected = index.include(value);
-      }
-    }
-  },
-
-  selectOne: function(element) {
-    var index = element.selectedIndex;
-    return index >= 0 ? this.optionValue(element.options[index]) : null;
-  },
-
-  selectMany: function(element) {
-    var values, length = element.length;
-    if (!length) return null;
-
-    for (var i = 0, values = []; i < length; i++) {
-      var opt = element.options[i];
-      if (opt.selected) values.push(this.optionValue(opt));
-    }
-    return values;
-  },
-
-  optionValue: function(opt) {
-    // extend element because hasAttribute may not be native
-    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
-  initialize: function($super, element, frequency, callback) {
-    $super(callback, frequency);
-    this.element   = $(element);
-    this.lastValue = this.getValue();
-  },
-
-  execute: function() {
-    var value = this.getValue();
-    if (Object.isString(this.lastValue) && Object.isString(value) ?
-        this.lastValue != value : String(this.lastValue) != String(value)) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  }
-});
-
-Form.Element.Observer = Class.create(Abstract.TimedObserver, {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.Observer = Class.create(Abstract.TimedObserver, {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = Class.create({
-  initialize: function(element, callback) {
-    this.element  = $(element);
-    this.callback = callback;
-
-    this.lastValue = this.getValue();
-    if (this.element.tagName.toLowerCase() == 'form')
-      this.registerFormCallbacks();
-    else
-      this.registerCallback(this.element);
-  },
-
-  onElementEvent: function() {
-    var value = this.getValue();
-    if (this.lastValue != value) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  },
-
-  registerFormCallbacks: function() {
-    Form.getElements(this.element).each(this.registerCallback, this);
-  },
-
-  registerCallback: function(element) {
-    if (element.type) {
-      switch (element.type.toLowerCase()) {
-        case 'checkbox':
-        case 'radio':
-          Event.observe(element, 'click', this.onElementEvent.bind(this));
-          break;
-        default:
-          Event.observe(element, 'change', this.onElementEvent.bind(this));
-          break;
-      }
-    }
-  }
-});
-
-Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.EventObserver = Class.create(Abstract.EventObserver, {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-if (!window.Event) var Event = { };
-
-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-  KEY_HOME:     36,
-  KEY_END:      35,
-  KEY_PAGEUP:   33,
-  KEY_PAGEDOWN: 34,
-  KEY_INSERT:   45,
-
-  cache: { },
-
-  relatedTarget: function(event) {
-    var element;
-    switch(event.type) {
-      case 'mouseover': element = event.fromElement; break;
-      case 'mouseout':  element = event.toElement;   break;
-      default: return null;
-    }
-    return Element.extend(element);
-  }
-});
-
-Event.Methods = (function() {
-  var isButton;
-
-  if (Prototype.Browser.IE) {
-    var buttonMap = { 0: 1, 1: 4, 2: 2 };
-    isButton = function(event, code) {
-      return event.button == buttonMap[code];
-    };
-
-  } else if (Prototype.Browser.WebKit) {
-    isButton = function(event, code) {
-      switch (code) {
-        case 0: return event.which == 1 && !event.metaKey;
-        case 1: return event.which == 1 && event.metaKey;
-        default: return false;
-      }
-    };
-
-  } else {
-    isButton = function(event, code) {
-      return event.which ? (event.which === code + 1) : (event.button === code);
-    };
-  }
-
-  return {
-    isLeftClick:   function(event) { return isButton(event, 0) },
-    isMiddleClick: function(event) { return isButton(event, 1) },
-    isRightClick:  function(event) { return isButton(event, 2) },
-
-    element: function(event) {
-      var node = Event.extend(event).target;
-      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
-    },
-
-    findElement: function(event, expression) {
-      var element = Event.element(event);
-      return element.match(expression) ? element : element.up(expression);
-    },
-
-    pointer: function(event) {
-      return {
-        x: event.pageX || (event.clientX +
-          (document.documentElement.scrollLeft || document.body.scrollLeft)),
-        y: event.pageY || (event.clientY +
-          (document.documentElement.scrollTop || document.body.scrollTop))
-      };
-    },
-
-    pointerX: function(event) { return Event.pointer(event).x },
-    pointerY: function(event) { return Event.pointer(event).y },
-
-    stop: function(event) {
-      Event.extend(event);
-      event.preventDefault();
-      event.stopPropagation();
-      event.stopped = true;
-    }
-  };
-})();
-
-Event.extend = (function() {
-  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
-    m[name] = Event.Methods[name].methodize();
-    return m;
-  });
-
-  if (Prototype.Browser.IE) {
-    Object.extend(methods, {
-      stopPropagation: function() { this.cancelBubble = true },
-      preventDefault:  function() { this.returnValue = false },
-      inspect: function() { return "[object Event]" }
-    });
-
-    return function(event) {
-      if (!event) return false;
-      if (event._extendedByPrototype) return event;
-
-      event._extendedByPrototype = Prototype.emptyFunction;
-      var pointer = Event.pointer(event);
-      Object.extend(event, {
-        target: event.srcElement,
-        relatedTarget: Event.relatedTarget(event),
-        pageX:  pointer.x,
-        pageY:  pointer.y
-      });
-      return Object.extend(event, methods);
-    };
-
-  } else {
-    Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
-    Object.extend(Event.prototype, methods);
-    return Prototype.K;
-  }
-})();
-
-Object.extend(Event, (function() {
-  var cache = Event.cache;
-
-  function getEventID(element) {
-    if (element._eventID) return element._eventID;
-    arguments.callee.id = arguments.callee.id || 1;
-    return element._eventID = ++arguments.callee.id;
-  }
-
-  function getDOMEventName(eventName) {
-    if (eventName && eventName.include(':')) return "dataavailable";
-    return eventName;
-  }
-
-  function getCacheForID(id) {
-    return cache[id] = cache[id] || { };
-  }
-
-  function getWrappersForEventName(id, eventName) {
-    var c = getCacheForID(id);
-    return c[eventName] = c[eventName] || [];
-  }
-
-  function createWrapper(element, eventName, handler) {
-    var id = getEventID(element);
-    var c = getWrappersForEventName(id, eventName);
-    if (c.pluck("handler").include(handler)) return false;
-
-    var wrapper = function(event) {
-      if (!Event || !Event.extend ||
-        (event.eventName && event.eventName != eventName))
-          return false;
-
-      Event.extend(event);
-      handler.call(element, event)
-    };
-
-    wrapper.handler = handler;
-    c.push(wrapper);
-    return wrapper;
-  }
-
-  function findWrapper(id, eventName, handler) {
-    var c = getWrappersForEventName(id, eventName);
-    return c.find(function(wrapper) { return wrapper.handler == handler });
-  }
-
-  function destroyWrapper(id, eventName, handler) {
-    var c = getCacheForID(id);
-    if (!c[eventName]) return false;
-    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
-  }
-
-  function destroyCache() {
-    for (var id in cache)
-      for (var eventName in cache[id])
-        cache[id][eventName] = null;
-  }
-
-  if (window.attachEvent) {
-    window.attachEvent("onunload", destroyCache);
-  }
-
-  return {
-    observe: function(element, eventName, handler) {
-      element = $(element);
-      var name = getDOMEventName(eventName);
-
-      var wrapper = createWrapper(element, eventName, handler);
-      if (!wrapper) return element;
-
-      if (element.addEventListener) {
-        element.addEventListener(name, wrapper, false);
-      } else {
-        element.attachEvent("on" + name, wrapper);
-      }
-
-      return element;
-    },
-
-    stopObserving: function(element, eventName, handler) {
-      element = $(element);
-      var id = getEventID(element), name = getDOMEventName(eventName);
-
-      if (!handler && eventName) {
-        getWrappersForEventName(id, eventName).each(function(wrapper) {
-          element.stopObserving(eventName, wrapper.handler);
-        });
-        return element;
-
-      } else if (!eventName) {
-        Object.keys(getCacheForID(id)).each(function(eventName) {
-          element.stopObserving(eventName);
-        });
-        return element;
-      }
-
-      var wrapper = findWrapper(id, eventName, handler);
-      if (!wrapper) return element;
-
-      if (element.removeEventListener) {
-        element.removeEventListener(name, wrapper, false);
-      } else {
-        element.detachEvent("on" + name, wrapper);
-      }
-
-      destroyWrapper(id, eventName, handler);
-
-      return element;
-    },
-
-    fire: function(element, eventName, memo) {
-      element = $(element);
-      if (element == document && document.createEvent && !element.dispatchEvent)
-        element = document.documentElement;
-
-      if (document.createEvent) {
-        var event = document.createEvent("HTMLEvents");
-        event.initEvent("dataavailable", true, true);
-      } else {
-        var event = document.createEventObject();
-        event.eventType = "ondataavailable";
-      }
-
-      event.eventName = eventName;
-      event.memo = memo || { };
-
-      if (document.createEvent) {
-        element.dispatchEvent(event);
-      } else {
-        element.fireEvent(event.eventType, event);
-      }
-
-      return event;
-    }
-  };
-})());
-
-Object.extend(Event, Event.Methods);
-
-Element.addMethods({
-  fire:          Event.fire,
-  observe:       Event.observe,
-  stopObserving: Event.stopObserving
-});
-
-Object.extend(document, {
-  fire:          Element.Methods.fire.methodize(),
-  observe:       Element.Methods.observe.methodize(),
-  stopObserving: Element.Methods.stopObserving.methodize()
-});
-
-(function() {
-  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
-     Matthias Miller, Dean Edwards and John Resig. */
-
-  var timer, fired = false;
-
-  function fireContentLoadedEvent() {
-    if (fired) return;
-    if (timer) window.clearInterval(timer);
-    document.fire("dom:loaded");
-    fired = true;
-  }
-
-  if (document.addEventListener) {
-    if (Prototype.Browser.WebKit) {
-      timer = window.setInterval(function() {
-        if (/loaded|complete/.test(document.readyState))
-          fireContentLoadedEvent();
-      }, 0);
-
-      Event.observe(window, "load", fireContentLoadedEvent);
-
-    } else {
-      document.addEventListener("DOMContentLoaded",
-        fireContentLoadedEvent, false);
-    }
-
-  } else {
-    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
-    $("__onDOMContentLoaded").onreadystatechange = function() {
-      if (this.readyState == "complete") {
-        this.onreadystatechange = null;
-        fireContentLoadedEvent();
-      }
-    };
-  }
-})();
-/*------------------------------- DEPRECATED -------------------------------*/
-
-Hash.toQueryString = Object.toQueryString;
-
-var Toggle = { display: Element.toggle };
-
-Element.Methods.childOf = Element.Methods.descendantOf;
-
-var Insertion = {
-  Before: function(element, content) {
-    return Element.insert(element, {before:content});
-  },
-
-  Top: function(element, content) {
-    return Element.insert(element, {top:content});
-  },
-
-  Bottom: function(element, content) {
-    return Element.insert(element, {bottom:content});
-  },
-
-  After: function(element, content) {
-    return Element.insert(element, {after:content});
-  }
-};
-
-var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
-
-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
-var Position = {
-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
-  includeScrollOffsets: false,
-
-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
-  prepare: function() {
-    this.deltaX =  window.pageXOffset
-                || document.documentElement.scrollLeft
-                || document.body.scrollLeft
-                || 0;
-    this.deltaY =  window.pageYOffset
-                || document.documentElement.scrollTop
-                || document.body.scrollTop
-                || 0;
-  },
-
-  // caches x/y coordinate pair to use with overlap
-  within: function(element, x, y) {
-    if (this.includeScrollOffsets)
-      return this.withinIncludingScrolloffsets(element, x, y);
-    this.xcomp = x;
-    this.ycomp = y;
-    this.offset = Element.cumulativeOffset(element);
-
-    return (y >= this.offset[1] &&
-            y <  this.offset[1] + element.offsetHeight &&
-            x >= this.offset[0] &&
-            x <  this.offset[0] + element.offsetWidth);
-  },
-
-  withinIncludingScrolloffsets: function(element, x, y) {
-    var offsetcache = Element.cumulativeScrollOffset(element);
-
-    this.xcomp = x + offsetcache[0] - this.deltaX;
-    this.ycomp = y + offsetcache[1] - this.deltaY;
-    this.offset = Element.cumulativeOffset(element);
-
-    return (this.ycomp >= this.offset[1] &&
-            this.ycomp <  this.offset[1] + element.offsetHeight &&
-            this.xcomp >= this.offset[0] &&
-            this.xcomp <  this.offset[0] + element.offsetWidth);
-  },
-
-  // within must be called directly before
-  overlap: function(mode, element) {
-    if (!mode) return 0;
-    if (mode == 'vertical')
-      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
-        element.offsetHeight;
-    if (mode == 'horizontal')
-      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
-        element.offsetWidth;
-  },
-
-  // Deprecation layer -- use newer Element methods now (1.5.2).
-
-  cumulativeOffset: Element.Methods.cumulativeOffset,
-
-  positionedOffset: Element.Methods.positionedOffset,
-
-  absolutize: function(element) {
-    Position.prepare();
-    return Element.absolutize(element);
-  },
-
-  relativize: function(element) {
-    Position.prepare();
-    return Element.relativize(element);
-  },
-
-  realOffset: Element.Methods.cumulativeScrollOffset,
-
-  offsetParent: Element.Methods.getOffsetParent,
-
-  page: Element.Methods.viewportOffset,
-
-  clone: function(source, target, options) {
-    options = options || { };
-    return Element.clonePosition(target, source, options);
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
-  function iter(name) {
-    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
-  }
-
-  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
-  function(element, className) {
-    className = className.toString().strip();
-    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
-    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
-  } : function(element, className) {
-    className = className.toString().strip();
-    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
-    if (!classNames && !className) return elements;
-
-    var nodes = $(element).getElementsByTagName('*');
-    className = ' ' + className + ' ';
-
-    for (var i = 0, child, cn; child = nodes[i]; i++) {
-      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
-          (classNames && classNames.all(function(name) {
-            return !name.toString().blank() && cn.include(' ' + name + ' ');
-          }))))
-        elements.push(Element.extend(child));
-    }
-    return elements;
-  };
-
-  return function(className, parentElement) {
-    return $(parentElement || document.body).getElementsByClassName(className);
-  };
-}(Element.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
-  initialize: function(element) {
-    this.element = $(element);
-  },
-
-  _each: function(iterator) {
-    this.element.className.split(/\s+/).select(function(name) {
-      return name.length > 0;
-    })._each(iterator);
-  },
-
-  set: function(className) {
-    this.element.className = className;
-  },
-
-  add: function(classNameToAdd) {
-    if (this.include(classNameToAdd)) return;
-    this.set($A(this).concat(classNameToAdd).join(' '));
-  },
-
-  remove: function(classNameToRemove) {
-    if (!this.include(classNameToRemove)) return;
-    this.set($A(this).without(classNameToRemove).join(' '));
-  },
-
-  toString: function() {
-    return $A(this).join(' ');
-  }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-
-/*--------------------------------------------------------------------------*/
-
-Element.addMethods();
\ No newline at end of file
index c976e6bff737e7565544cab0d5221aea9554fe9a..6bf437acc4b26a9071ba329c6ecb4e3b79c2c857 100644 (file)
@@ -1,7 +1,7 @@
-// script.aculo.us scriptaculous.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// 
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
@@ -9,7 +9,7 @@
 // distribute, sublicense, and/or sell copies of the Software, and to
 // permit persons to whom the Software is furnished to do so, subject to
 // the following conditions:
-// 
+//
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
 //
 // For details, see the script.aculo.us web site: http://script.aculo.us/
 
 var Scriptaculous = {
-  Version: '1.8.0',
+  Version: '1.8.3',
   require: function(libraryName) {
-    // inserting via DOM fails in Safari 2.0, so brute force approach
-    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
+    try{
+      // inserting via DOM fails in Safari 2.0, so brute force approach
+      document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
+    } catch(e) {
+      // for xhtml+xml served content, fall back to DOM methods
+      var script = document.createElement('script');
+      script.type = 'text/javascript';
+      script.src = libraryName;
+      document.getElementsByTagName('head')[0].appendChild(script);
+    }
   },
-  REQUIRED_PROTOTYPE: '1.6.0',
+  REQUIRED_PROTOTYPE: '1.6.0.3',
   load: function() {
-    function convertVersionString(versionString){
-      var r = versionString.split('.');
-      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
+    function convertVersionString(versionString) {
+      var v = versionString.replace(/_.*|\./g, '');
+      v = parseInt(v + '0'.times(4-v.length));
+      return versionString.indexOf('_') > -1 ? v-1 : v;
     }
-    if((typeof Prototype=='undefined') || 
-       (typeof Element == 'undefined') || 
+
+    if((typeof Prototype=='undefined') ||
+       (typeof Element == 'undefined') ||
        (typeof Element.Methods=='undefined') ||
-       (convertVersionString(Prototype.Version) < 
+       (convertVersionString(Prototype.Version) <
         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
        throw("script.aculo.us requires the Prototype JavaScript framework >= " +
         Scriptaculous.REQUIRED_PROTOTYPE);
-    
-    $A(document.getElementsByTagName("script")).findAll( function(s) {
-      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
-    }).each( function(s) {
-      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
-      var includes = s.src.match(/\?.*load=([a-z,]*)/);
+
+    var js = /scriptaculous\.js(\?.*)?$/;
+    $$('head script[src]').findAll(function(s) {
+      return s.src.match(js);
+    }).each(function(s) {
+      var path = s.src.replace(js, ''),
+      includes = s.src.match(/\?.*load=([a-z,]*)/);
       (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
        function(include) { Scriptaculous.require(path+include+'.js') });
     });
   }
-}
+};
 
 Scriptaculous.load();
\ No newline at end of file
index 53f319ecce3096ae48a66227e21b97f796e2644d..eb83055824345e1becaec7c6346c6cd0d16db996 100644 (file)
@@ -1,6 +1,6 @@
-// script.aculo.us slider.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us slider.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs 
+// Copyright (c) 2005-2009 Marty Haught, Thomas Fuchs
 //
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
 // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -16,13 +16,13 @@ if (!Control) var Control = { };
 Control.Slider = Class.create({
   initialize: function(handle, track, options) {
     var slider = this;
-    
+
     if (Object.isArray(handle)) {
       this.handles = handle.collect( function(e) { return $(e) });
     } else {
       this.handles = [$(handle)];
     }
-    
+
     this.track   = $(track);
     this.options = options || { };
 
@@ -30,7 +30,7 @@ Control.Slider = Class.create({
     this.increment = this.options.increment || 1;
     this.step      = parseInt(this.options.step || '1');
     this.range     = this.options.range || $R(0,1);
-    
+
     this.value     = 0; // assure backwards compat
     this.values    = this.handles.map( function() { return 0 });
     this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
@@ -45,13 +45,13 @@ Control.Slider = Class.create({
     // Will be used to align the handle onto the track, if necessary
     this.alignX = parseInt(this.options.alignX || '0');
     this.alignY = parseInt(this.options.alignY || '0');
-    
+
     this.trackLength = this.maximumOffset() - this.minimumOffset();
 
-    this.handleLength = this.isVertical() ? 
-      (this.handles[0].offsetHeight != 0 ? 
-        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 
-      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 
+    this.handleLength = this.isVertical() ?
+      (this.handles[0].offsetHeight != 0 ?
+        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
+      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
         this.handles[0].style.width.replace(/px$/,""));
 
     this.active   = false;
@@ -75,20 +75,20 @@ Control.Slider = Class.create({
     this.handles.each( function(h,i) {
       i = slider.handles.length-1-i;
       slider.setValue(parseFloat(
-        (Object.isArray(slider.options.sliderValue) ? 
-          slider.options.sliderValue[i] : slider.options.sliderValue) || 
+        (Object.isArray(slider.options.sliderValue) ?
+          slider.options.sliderValue[i] : slider.options.sliderValue) ||
          slider.range.start), i);
       h.makePositioned().observe("mousedown", slider.eventMouseDown);
     });
-    
+
     this.track.observe("mousedown", this.eventMouseDown);
     document.observe("mouseup", this.eventMouseUp);
     document.observe("mousemove", this.eventMouseMove);
-    
+
     this.initialized = true;
   },
   dispose: function() {
-    var slider = this;    
+    var slider = this;
     Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
     Event.stopObserving(document, "mouseup", this.eventMouseUp);
     Event.stopObserving(document, "mousemove", this.eventMouseMove);
@@ -101,12 +101,12 @@ Control.Slider = Class.create({
   },
   setEnabled: function(){
     this.disabled = false;
-  },  
+  },
   getNearestValue: function(value){
     if (this.allowedValues){
       if (value >= this.allowedValues.max()) return(this.allowedValues.max());
       if (value <= this.allowedValues.min()) return(this.allowedValues.min());
-      
+
       var offset = Math.abs(this.allowedValues[0] - value);
       var newValue = this.allowedValues[0];
       this.allowedValues.each( function(v) {
@@ -114,7 +114,7 @@ Control.Slider = Class.create({
         if (currentOffset <= offset){
           newValue = v;
           offset = currentOffset;
-        } 
+        }
       });
       return newValue;
     }
@@ -138,28 +138,28 @@ Control.Slider = Class.create({
     sliderValue = this.getNearestValue(sliderValue);
     this.values[handleIdx] = sliderValue;
     this.value = this.values[0]; // assure backwards compat
-    
-    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
+
+    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
       this.translateToPx(sliderValue);
-    
+
     this.drawSpans();
     if (!this.dragging || !this.event) this.updateFinished();
   },
   setValueBy: function(delta, handleIdx) {
-    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 
+    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
       handleIdx || this.activeHandleIdx || 0);
   },
   translateToPx: function(value) {
     return Math.round(
-      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 
+      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
       (value - this.range.start)) + "px";
   },
   translateToValue: function(offset) {
-    return ((offset/(this.trackLength-this.handleLength) * 
+    return ((offset/(this.trackLength-this.handleLength) *
       (this.range.end-this.range.start)) + this.range.start);
   },
   getRange: function(range) {
-    var v = this.values.sortBy(Prototype.K); 
+    var v = this.values.sortBy(Prototype.K);
     range = range || 0;
     return $R(v[range],v[range+1]);
   },
@@ -167,12 +167,12 @@ Control.Slider = Class.create({
     return(this.isVertical() ? this.alignY : this.alignX);
   },
   maximumOffset: function(){
-    return(this.isVertical() ? 
+    return(this.isVertical() ?
       (this.track.offsetHeight != 0 ? this.track.offsetHeight :
-        this.track.style.height.replace(/px$/,"")) - this.alignY : 
-      (this.track.offsetWidth != 0 ? this.track.offsetWidth : 
+        this.track.style.height.replace(/px$/,"")) - this.alignY :
+      (this.track.offsetWidth != 0 ? this.track.offsetWidth :
         this.track.style.width.replace(/px$/,"")) - this.alignX);
-  },  
+  },
   isVertical:  function(){
     return (this.axis == 'vertical');
   },
@@ -184,7 +184,7 @@ Control.Slider = Class.create({
       this.setSpan(this.options.startSpan,
         $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
     if (this.options.endSpan)
-      this.setSpan(this.options.endSpan, 
+      this.setSpan(this.options.endSpan,
         $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
   },
   setSpan: function(span, range) {
@@ -204,30 +204,30 @@ Control.Slider = Class.create({
     if (Event.isLeftClick(event)) {
       if (!this.disabled){
         this.active = true;
-        
+
         var handle = Event.element(event);
         var pointer  = [Event.pointerX(event), Event.pointerY(event)];
         var track = handle;
         if (track==this.track) {
-          var offsets  = Position.cumulativeOffset(this.track); 
+          var offsets  = this.track.cumulativeOffset();
           this.event = event;
-          this.setValue(this.translateToValue( 
+          this.setValue(this.translateToValue(
            (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
           ));
-          var offsets  = Position.cumulativeOffset(this.activeHandle);
+          var offsets  = this.activeHandle.cumulativeOffset();
           this.offsetX = (pointer[0] - offsets[0]);
           this.offsetY = (pointer[1] - offsets[1]);
         } else {
           // find the handle (prevents issues with Safari)
-          while((this.handles.indexOf(handle) == -1) && handle.parentNode) 
+          while((this.handles.indexOf(handle) == -1) && handle.parentNode)
             handle = handle.parentNode;
-            
+
           if (this.handles.indexOf(handle)!=-1) {
             this.activeHandle    = handle;
             this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
             this.updateStyles();
-            
-            var offsets  = Position.cumulativeOffset(this.activeHandle);
+
+            var offsets  = this.activeHandle.cumulativeOffset();
             this.offsetX = (pointer[0] - offsets[0]);
             this.offsetY = (pointer[1] - offsets[1]);
           }
@@ -246,7 +246,7 @@ Control.Slider = Class.create({
   },
   draw: function(event) {
     var pointer = [Event.pointerX(event), Event.pointerY(event)];
-    var offsets = Position.cumulativeOffset(this.track);
+    var offsets = this.track.cumulativeOffset();
     pointer[0] -= this.offsetX + offsets[0];
     pointer[1] -= this.offsetY + offsets[1];
     this.event = event;
@@ -261,15 +261,15 @@ Control.Slider = Class.create({
     }
     this.active = false;
     this.dragging = false;
-  },  
+  },
   finishDrag: function(event, success) {
     this.active = false;
     this.dragging = false;
     this.updateFinished();
   },
   updateFinished: function() {
-    if (this.initialized && this.options.onChange) 
+    if (this.initialized && this.options.onChange)
       this.options.onChange(this.values.length>1 ? this.values : this.value, this);
     this.event = null;
   }
-});
+});
\ No newline at end of file
index 9dd6e9f0162b7c53f4c43cf0e0ef1abeba493844..a286eb98e662282c1b16d78b587dca1db2b75fc1 100644 (file)
@@ -1,6 +1,6 @@
-// script.aculo.us sound.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us sound.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
 //
 // Based on code created by Jules Gravinese (http://www.webveteran.com/)
 //
@@ -23,23 +23,23 @@ Sound = {
     var options = Object.extend({
       track: 'global', url: url, replace: false
     }, arguments[1] || {});
-    
+
     if(options.replace && this.tracks[options.track]) {
       $R(0, this.tracks[options.track].id).each(function(id){
         var sound = $('sound_'+options.track+'_'+id);
         sound.Stop && sound.Stop();
         sound.remove();
-      })
+      });
       this.tracks[options.track] = null;
     }
-      
+
     if(!this.tracks[options.track])
-      this.tracks[options.track] = { id: 0 }
+      this.tracks[options.track] = { id: 0 };
     else
       this.tracks[options.track].id++;
-      
+
     options.id = this.tracks[options.track].id;
-    $$('body')[0].insert( 
+    $$('body')[0].insert(
       Prototype.Browser.IE ? new Element('bgsound',{
         id: 'sound_'+options.track+'_'+options.id,
         src: options.url, loop: 1, autostart: true
@@ -49,7 +49,11 @@ Sound = {
 
 if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
   if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
-    Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
+    Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');
+  else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 }))
+    Sound.template = new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>');
+  else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 }))
+    Sound.template = new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');
   else
-    Sound.play = function(){}
-}
+    Sound.play = function(){};
+} 
\ No newline at end of file
index 13473a30f4a21bfac09b1780e5eaf1ce17c63458..33a0c7157f4b6a90522681bb03da6738bef1598c 100644 (file)
@@ -1,8 +1,8 @@
-// script.aculo.us unittest.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
+// script.aculo.us unittest.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
-//           (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
+//           (c) 2005-2009 Michael Schuerig (http://www.schuerig.de/michael/)
 //
 // script.aculo.us is freely distributable under the terms of an MIT-style license.
 // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -32,8 +32,8 @@ Event.simulateMouse = function(element, eventName) {
   this.mark.style.left = options.pointerX + "px";
   this.mark.style.width = "5px";
   this.mark.style.height = "5px;";
-  this.mark.style.borderTop = "1px solid red;"
-  this.mark.style.borderLeft = "1px solid red;"
+  this.mark.style.borderTop = "1px solid red;";
+  this.mark.style.borderLeft = "1px solid red;";
   
   if(this.step)
     alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
@@ -67,7 +67,7 @@ Event.simulateKeys = function(element, command) {
   }
 };
 
-var Test = {}
+var Test = {};
 Test.Unit = {};
 
 // security exception workaround
@@ -117,7 +117,7 @@ Test.Unit.Logger.prototype = {
     '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
     '<tbody id="loglines"></tbody>' +
     '</table>';
-    this.logsummary = $('logsummary')
+    this.logsummary = $('logsummary');
     this.loglines = $('loglines');
   },
   _toHTML: function(txt) {
@@ -125,15 +125,15 @@ Test.Unit.Logger.prototype = {
   },
   addLinksToResults: function(){ 
     $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
-      td.title = "Run only this test"
+      td.title = "Run only this test";
       Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
     });
     $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
-      td.title = "Run all tests"
+      td.title = "Run all tests";
       Event.observe(td, 'click', function(){ window.location.search = "";});
     });
   }
-}
+};
 
 Test.Unit.Runner = Class.create();
 Test.Unit.Runner.prototype = {
@@ -246,7 +246,7 @@ Test.Unit.Runner.prototype = {
       failures   + " failures, " +
       errors     + " errors");
   }
-}
+};
 
 Test.Unit.Assertions = Class.create();
 Test.Unit.Assertions.prototype = {
@@ -331,7 +331,7 @@ Test.Unit.Assertions.prototype = {
     catch(e) { this.error(e); } 
   },
   assertNull: function(obj) {
-    var message = arguments[1] || 'assertNull'
+    var message = arguments[1] || 'assertNull';
     try { (obj==null) ? this.pass() : 
       this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
     catch(e) { this.error(e); }
@@ -461,7 +461,7 @@ Test.Unit.Assertions.prototype = {
        iterations + ' iterations in ' + (timeTaken/1000)+'s' );
     return timeTaken;
   }
-}
+};
 
 Test.Unit.Testcase = Class.create();
 Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
@@ -526,7 +526,7 @@ Test.setupBDDExtensionMethods = function(){
   };
   var makeAssertion = function(assertion, args, object) { 
        this[assertion].apply(this,(args || []).concat([object]));
-  }
+  };
   
   Test.BDDMethods = {};   
   $H(METHODMAP).each(function(pair) { 
@@ -539,7 +539,7 @@ Test.setupBDDExtensionMethods = function(){
   [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
     function(p){ Object.extend(p, Test.BDDMethods) }
   );
-}
+};
 
 Test.context = function(name, spec, log){
   Test.setupBDDExtensionMethods();
index ef5b2f7d9f0d7448524af05afc083bf3e3eebe1f..c8f9dfc776403e2aa539fe8d7d834be9a0edf107 100644 (file)
@@ -1,7 +1,7 @@
-// script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
+// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
 
-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// 
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
@@ -9,7 +9,7 @@
 // distribute, sublicense, and/or sell copies of the Software, and to
 // permit persons to whom the Software is furnished to do so, subject to
 // the following conditions:
-// 
+//
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
 //
 // For details, see the script.aculo.us web site: http://script.aculo.us/
 
 var Scriptaculous = {
-  Version: '1.8.0',
+  Version: '1.8.3',
   require: function(libraryName) {
-    // inserting via DOM fails in Safari 2.0, so brute force approach
-    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
+    try{
+      // inserting via DOM fails in Safari 2.0, so brute force approach
+      document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
+    } catch(e) {
+      // for xhtml+xml served content, fall back to DOM methods
+      var script = document.createElement('script');
+      script.type = 'text/javascript';
+      script.src = libraryName;
+      document.getElementsByTagName('head')[0].appendChild(script);
+    }
   },
-  REQUIRED_PROTOTYPE: '1.6',
+  REQUIRED_PROTOTYPE: '1.6.0.3',
   load: function() {
-    function convertVersionString(versionString){
-      var r = versionString.split('.');
-      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
+    function convertVersionString(versionString) {
+      var v = versionString.replace(/_.*|\./g, '');
+      v = parseInt(v + '0'.times(4-v.length));
+      return versionString.indexOf('_') > -1 ? v-1 : v;
     }
-    if((typeof Prototype=='undefined') || 
-       (typeof Element == 'undefined') || 
+
+    if((typeof Prototype=='undefined') ||
+       (typeof Element == 'undefined') ||
        (typeof Element.Methods=='undefined') ||
-       (convertVersionString(Prototype.Version) < 
+       (convertVersionString(Prototype.Version) <
         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
        throw("script.aculo.us requires the Prototype JavaScript framework >= " +
         Scriptaculous.REQUIRED_PROTOTYPE);
-    
-    $A(document.getElementsByTagName("script")).findAll( function(s) {
-      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
-    }).each( function(s) {
-      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
-      var includes = s.src.match(/\?.*load=([a-z,]*)/);
-      if ( includes )
-       includes[1].split(',').each(
-       function(include) { Scriptaculous.require(path+include+'.js') });
+
+    var js = /scriptaculous\.js(\?.*)?$/;
+    $$('head script[src]').findAll(function(s) {
+      return s.src.match(js);
+    }).each(function(s) {
+               var path = s.src.replace(js, ''),
+               includes = s.src.match(/\?.*load=([a-z,]*)/);
+
+               // Modified for WordPress to work with enqueue_script
+               if ( includes ) {
+                       includes[1].split(',').each( function(include) {
+                               Scriptaculous.require(path+include+'.js')
+                       });
+               }
     });
   }
-}
+};
 
 Scriptaculous.load();
index 08fb27000ea28f383c3a1da47493446062ffe7f9..8eafe9dd83f91b52c2decd532db81527bb98e488 100644 (file)
@@ -1,5 +1,4 @@
-/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
-       Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
-       This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+/*     SWFObject v2.2 <http://code.google.com/p/swfobject/> 
+       is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
 */
-var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
\ No newline at end of file
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
\ No newline at end of file
index fb11c924cc253a2eed368c7740ae39ac5c564ece..5c8c187c515fb622c13bc49274016207048f9be5 100644 (file)
@@ -1,3 +1,4 @@
+var topWin = window.dialogArguments || opener || parent || top;
 
 function fileDialogStart() {
        jQuery("#media-upload-error").empty();
@@ -24,6 +25,11 @@ function fileQueued(fileObj) {
 }
 
 function uploadStart(fileObj) {
+       try {
+               if ( typeof topWin.tb_remove != 'undefined' )
+                       topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove); 
+       } catch(e){}
+
        return true;
 }
 
@@ -43,6 +49,11 @@ function prepareMediaItem(fileObj, serverData) {
        jQuery('.bar', item).remove();
        jQuery('.progress', item).hide();
 
+       try {
+               if ( typeof topWin.tb_remove != 'undefined' )
+                       topWin.jQuery('#TB_overlay').click(topWin.tb_remove);
+       } catch(e){}
+
        // Old style: Append the HTML returned by the server -- thumbnail and form inputs
        if ( isNaN(serverData) || !serverData ) {
                item.append(serverData);
@@ -134,10 +145,15 @@ function prepareMediaItemInit(fileObj) {
 }
 
 function itemAjaxError(id, html) {
-       var error = jQuery('#media-item-error' + id);
-
-       error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
-       jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
+       var item = jQuery('#media-item-' + id);
+       var filename = jQuery('.filename', item).text();
+
+       item.html('<div class="error-div">'
+                               + '<a class="dismiss" href="#">' + swfuploadL10n.dismiss + '</a>'
+                               + '<strong>' + swfuploadL10n.error_uploading.replace('%s', filename) + '</strong><br />'
+                               + html
+                               + '</div>');
+       item.find('a.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
 }
 
 function deleteSuccess(data, textStatus) {
@@ -231,8 +247,15 @@ function wpQueueError(message) {
 
 // file-specific message
 function wpFileError(fileObj, message) {
-       jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
-       jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
+       var item = jQuery('#media-item-' + fileObj.id);
+       var filename = jQuery('.filename', item).text();
+
+       item.html('<div class="error-div">'
+                               + '<a class="dismiss" href="#">' + swfuploadL10n.dismiss + '</a>'
+                               + '<strong>' + swfuploadL10n.error_uploading.replace('%s', filename) + '</strong><br />'
+                               + message
+                               + '</div>');
+       item.find('a.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
 }
 
 function fileQueueError(fileObj, error_code, message)  {
@@ -344,4 +367,4 @@ jQuery(document).ready(function($){
                        $(this).siblings('.urlfield').val( $(this).attr('title') );
                }
        });
-});
+});
\ No newline at end of file
index 89a134db1330fc2ebb34966a3cf8cc1520061f7b..94bc45f9c2c1716e3aea63e666e07194601c85ef 100644 (file)
@@ -1 +1 @@
-function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+a.name+"</div></div>");jQuery(".progress","#media-item-"+a.id).show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(a){return true}function uploadProgress(e,b,d){var a=jQuery("#media-items").width()-2,c=jQuery("#media-item-"+e.id);jQuery(".bar",c).width(a*b/d);jQuery(".percent",c).html(Math.ceil(b/d*100)+"%");if(b==d){jQuery(".bar",c).html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(c,a){var d=(typeof shortform=="undefined")?1:2,b=jQuery("#media-item-"+c.id);jQuery(".bar",b).remove();jQuery(".progress",b).hide();if(isNaN(a)||!a){b.append(a);prepareMediaItemInit(c)}else{b.load("async-upload.php",{attachment_id:a,fetch:d},function(){prepareMediaItemInit(c);updateMediaForm()})}}function prepareMediaItemInit(b){var a=jQuery("#media-item-"+b.id);jQuery(".thumbnail",a).clone().attr("className","pinkynail toggle").prependTo(a);jQuery(".filename.original",a).replaceWith(jQuery(".filename.new",a));jQuery("a.toggle",a).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var d=jQuery(window).height(),e=jQuery(this).offset().top,f=jQuery(this).height(),c;if(d&&e&&f){c=e+f;if(c>d&&(f+48)<d){window.scrollBy(0,c-d+13)}else{if(c>d){window.scrollTo(0,e-36)}}}});jQuery(this).siblings(".toggle").andSelf().toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("a.delete",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("a.undo",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(d,e){var c=jQuery("#media-item-"+b.id);if(type=jQuery("#type-of-"+b.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1)}if(c.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1)}jQuery(".filename .trashnotice",c).remove();jQuery(".filename .title",c).css("font-weight","normal");jQuery("a.undo",c).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",c).show();c.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"},{queue:false,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}});return false});jQuery("#media-item-"+b.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,d){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var c=this.id,a=jQuery("#media-item-"+c);if(type=jQuery("#type-of-"+c).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery(".toggle",a).toggle();jQuery(".slidetoggle",a).slideUp(200).siblings().removeClass("hidden");a.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:false,duration:500}).addClass("undo");jQuery(".filename:empty",a).remove();jQuery(".filename .title",a).css("font-weight","bold");jQuery(".filename",a).append('<span class="trashnotice"> '+swfuploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",a).append(jQuery("a.undo",a).removeClass("hidden"));jQuery(".menu_order_input",a).hide();return}function deleteError(c,b,a){}function updateMediaForm(){var b=jQuery("form.type-form #media-items").children(),a=jQuery("#media-items").children();if(b.length==1){jQuery(".slidetoggle",b).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle()}if(a.not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(a.length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").attr("disabled","disabled");jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function switchUploader(b){var c=document.getElementById(swfu.customSettings.swfupload_element_id),a=document.getElementById(swfu.customSettings.degraded_element_id);if(b){c.style.display="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()}function uploadError(b,c,a){switch(c){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(b,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(b,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery("#media-item-"+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}jQuery(document).ready(function(a){a('input[type="radio"]',"#media-items").live("click",function(){var b=a(this).closest("tr");if(a(b).hasClass("align")){setUserSetting("align",a(this).val())}else{if(a(b).hasClass("image-size")){setUserSetting("imgsize",a(this).val())}}});a("button.button","#media-items").live("click",function(){var b=this.className||"";b=b.match(/url([^ '"]+)/);if(b&&b[1]){setUserSetting("urlbutton",b[1]);a(this).siblings(".urlfield").val(a(this).attr("title"))}})});
\ No newline at end of file
+var topWin=window.dialogArguments||opener||parent||top;function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(fileObj){jQuery(".media-blank").remove();if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+fileObj.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+fileObj.name+"</div></div>");jQuery(".progress","#media-item-"+fileObj.id).show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(fileObj){try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").unbind("click",topWin.tb_remove)}}catch(e){}return true}function uploadProgress(fileObj,bytesDone,bytesTotal){var w=jQuery("#media-items").width()-2,item=jQuery("#media-item-"+fileObj.id);jQuery(".bar",item).width(w*bytesDone/bytesTotal);jQuery(".percent",item).html(Math.ceil(bytesDone/bytesTotal*100)+"%");if(bytesDone==bytesTotal){jQuery(".bar",item).html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(fileObj,serverData){var f=(typeof shortform=="undefined")?1:2,item=jQuery("#media-item-"+fileObj.id);jQuery(".bar",item).remove();jQuery(".progress",item).hide();try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").click(topWin.tb_remove)}}catch(e){}if(isNaN(serverData)||!serverData){item.append(serverData);prepareMediaItemInit(fileObj)}else{item.load("async-upload.php",{attachment_id:serverData,fetch:f},function(){prepareMediaItemInit(fileObj);updateMediaForm()})}}function prepareMediaItemInit(fileObj){var item=jQuery("#media-item-"+fileObj.id);jQuery(".thumbnail",item).clone().attr("className","pinkynail toggle").prependTo(item);jQuery(".filename.original",item).replaceWith(jQuery(".filename.new",item));jQuery("a.toggle",item).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var w=jQuery(window).height(),t=jQuery(this).offset().top,h=jQuery(this).height(),b;if(w&&t&&h){b=t+h;if(b>w&&(h+48)<w){window.scrollBy(0,b-w+13)}else{if(b>w){window.scrollTo(0,t-36)}}}});jQuery(this).siblings(".toggle").andSelf().toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("a.delete",item).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:fileObj.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("a.undo",item).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",id:fileObj.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(data,textStatus){var item=jQuery("#media-item-"+fileObj.id);if(type=jQuery("#type-of-"+fileObj.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1)}if(item.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1)}jQuery(".filename .trashnotice",item).remove();jQuery(".filename .title",item).css("font-weight","normal");jQuery("a.undo",item).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",item).show();item.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"},{queue:false,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}});return false});jQuery("#media-item-"+fileObj.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function itemAjaxError(id,html){var item=jQuery("#media-item-"+id);var filename=jQuery(".filename",item).text();item.html('<div class="error-div"><a class="dismiss" href="#">'+swfuploadL10n.dismiss+"</a><strong>"+swfuploadL10n.error_uploading.replace("%s",filename)+"</strong><br />"+html+"</div>");item.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function deleteSuccess(data,textStatus){if(data=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(data=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var id=this.id,item=jQuery("#media-item-"+id);if(type=jQuery("#type-of-"+id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(item.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery(".toggle",item).toggle();jQuery(".slidetoggle",item).slideUp(200).siblings().removeClass("hidden");item.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:false,duration:500}).addClass("undo");jQuery(".filename:empty",item).remove();jQuery(".filename .title",item).css("font-weight","bold");jQuery(".filename",item).append('<span class="trashnotice"> '+swfuploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",item).append(jQuery("a.undo",item).removeClass("hidden"));jQuery(".menu_order_input",item).hide();return}function deleteError(X,textStatus,errorThrown){}function updateMediaForm(){var one=jQuery("form.type-form #media-items").children(),items=jQuery("#media-items").children();if(one.length==1){jQuery(".slidetoggle",one).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle()}if(items.not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(items.length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(fileObj,serverData){if(serverData.match("media-upload-error")){jQuery("#media-item-"+fileObj.id).html(serverData);return}prepareMediaItem(fileObj,serverData);updateMediaForm();if(jQuery("#media-item-"+fileObj.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(fileObj){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").attr("disabled","disabled");jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(message){jQuery("#media-upload-error").show().text(message)}function wpFileError(fileObj,message){var item=jQuery("#media-item-"+fileObj.id);var filename=jQuery(".filename",item).text();item.html('<div class="error-div"><a class="dismiss" href="#">'+swfuploadL10n.dismiss+"</a><strong>"+swfuploadL10n.error_uploading.replace("%s",filename)+"</strong><br />"+message+"</div>");item.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(fileObj,error_code,message){if(error_code==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(error_code==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(fileObj);wpFileError(fileObj,swfuploadL10n.file_exceeds_size_limit)}else{if(error_code==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(fileObj);wpFileError(fileObj,swfuploadL10n.zero_byte_file)}else{if(error_code==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(fileObj);wpFileError(fileObj,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(num_files_queued){try{if(num_files_queued>0){this.startUpload()}}catch(ex){this.debug(ex)}}function switchUploader(s){var f=document.getElementById(swfu.customSettings.swfupload_element_id),h=document.getElementById(swfu.customSettings.degraded_element_id);if(s){f.style.display="block";h.style.display="none"}else{f.style.display="none";h.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()}function uploadError(fileObj,errorCode,message){switch(errorCode){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(fileObj,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(fileObj,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery("#media-item-"+fileObj.id).remove();break;default:wpFileError(fileObj,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}jQuery(document).ready(function($){$('input[type="radio"]',"#media-items").live("click",function(){var tr=$(this).closest("tr");if($(tr).hasClass("align")){setUserSetting("align",$(this).val())}else{if($(tr).hasClass("image-size")){setUserSetting("imgsize",$(this).val())}}});$("button.button","#media-items").live("click",function(){var c=this.className||"";c=c.match(/url([^ '"]+)/);if(c&&c[1]){setUserSetting("urlbutton",c[1]);$(this).siblings(".urlfield").val($(this).attr("title"))}})});
\ No newline at end of file
index 6a56f23d0e7838a9b65c619968790782e5271c19..b4ff03090d7f57881dfcf8f9cad377981adcec04 100644 (file)
@@ -23,14 +23,16 @@ jQuery(document).ready(function(){
 
 //add thickbox to href & area elements that have a class of .thickbox
 function tb_init(domChunk){
-       jQuery(domChunk).click(function(){
+       jQuery(domChunk).live('click', tb_click);
+}
+
+function tb_click(){
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;
        tb_show(t,a,g);
        this.blur();
        return false;
-       });
 }
 
 function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
@@ -40,7 +42,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
                        jQuery("body","html").css({height: "100%", width: "100%"});
                        jQuery("html").css("overflow","hidden");
                        if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
-                               jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
+                               jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                                jQuery("#TB_overlay").click(tb_remove);
                        }
                }else{//all others
@@ -198,10 +200,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
                                        urlNoQuery = url.split('TB_');
                                        jQuery("#TB_iframeContent").remove();
                                        if(params['modal'] != "true"){//iframe no modal
-                                               jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
+                                               jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' >"+thickboxL10n.noiframes+"</iframe>");
                                        }else{//iframe modal
                                        jQuery("#TB_overlay").unbind();
-                                               jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
+                                               jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'>"+thickboxL10n.noiframes+"</iframe>");
                                        }
                        }else{// not an iframe, ajax
                                        if(jQuery("#TB_window").css("display") != "block"){
@@ -231,7 +233,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
                                        jQuery("#TB_window").css({display:"block"});
                                }else if(url.indexOf('TB_iframe') != -1){
                                        tb_position();
-                                       if($.browser.safari){//safari needs help because it will not fire iframe onload
+                                       if(jQuery.browser.safari){//safari needs help because it will not fire iframe onload
                                                jQuery("#TB_load").remove();
                                                jQuery("#TB_window").css({display:"block"});
                                        }
index 8320f2a5ff28875718f4c3ae9a126a58bdf9fbb5..d1ac555f3f75dee283207b60fec4999be354e1ae 100644 (file)
@@ -39,15 +39,15 @@ invalid_data:"' . mce_escape( __('Error: Invalid values entered, these are marke
 more_colors:"' . mce_escape( __('More colors') ) . '"
 },
 contextmenu:{
-align:"' . mce_escape( __('Alignment') ) . '",
-left:"' . mce_escape( __('Left') ) . '",
-center:"' . mce_escape( __('Center') ) . '",
-right:"' . mce_escape( __('Right') ) . '",
-full:"' . mce_escape( __('Full') ) . '"
+align:"' . mce_escape( /* translators: alignment */ __('Alignment') ) . '",
+left:"' . mce_escape( /* translators: alignment */ __('Left') ) . '",
+center:"' . mce_escape( /* translators: alignment */ __('Center') ) . '",
+right:"' . mce_escape( /* translators: alignment */ __('Right') ) . '",
+full:"' . mce_escape( /* translators: alignment */ __('Full') ) . '"
 },
 insertdatetime:{
-date_fmt:"' . mce_escape( __('%Y-%m-%d') ) . '",
-time_fmt:"' . mce_escape( __('%H:%M:%S') ) . '",
+date_fmt:"' . mce_escape( /* translators: year, month, date */ __('%Y-%m-%d') ) . '",
+time_fmt:"' . mce_escape( /* translators: hours, minutes, seconds */ __('%H:%M:%S') ) . '",
 insertdate_desc:"' . mce_escape( __('Insert date') ) . '",
 inserttime_desc:"' . mce_escape( __('Insert time') ) . '",
 months_long:"' . mce_escape( __('January').','.__('February').','.__('March').','.__('April').','.__('May').','.__('June').','.__('July').','.__('August').','.__('September').','.__('October').','.__('November').','.__('December') ) . '",
@@ -175,7 +175,7 @@ no_sug:"' . mce_escape( __('No suggestions') ) . '",
 no_mpell:"' . mce_escape( __('No misspellings found.') ) . '"
 },
 pagebreak:{
-desc:"' . mce_escape( __('Insert page break.') ) . '"
+desc:"' . mce_escape( __('Insert Page Break') ) . '"
 }}});
 
 tinyMCE.addI18n("' . $language . '.advanced",{
@@ -202,10 +202,10 @@ bold_desc:"' . mce_escape( __('Bold') ) . ' (Ctrl / Alt+Shift + B)",
 italic_desc:"' . mce_escape( __('Italic') ) . ' (Ctrl / Alt+Shift + I)",
 underline_desc:"' . mce_escape( __('Underline') ) . '",
 striketrough_desc:"' . mce_escape( __('Strikethrough') ) . ' (Alt+Shift+D)",
-justifyleft_desc:"' . mce_escape( __('Align left') ) . ' (Alt+Shift+L)",
-justifycenter_desc:"' . mce_escape( __('Align center') ) . ' (Alt+Shift+C)",
-justifyright_desc:"' . mce_escape( __('Align right') ) . ' (Alt+Shift+R)",
-justifyfull_desc:"' . mce_escape( __('Align full') ) . ' (Alt+Shift+J)",
+justifyleft_desc:"' . mce_escape( __('Align Left') ) . ' (Alt+Shift+L)",
+justifycenter_desc:"' . mce_escape( __('Align Center') ) . ' (Alt+Shift+C)",
+justifyright_desc:"' . mce_escape( __('Align Right') ) . ' (Alt+Shift+R)",
+justifyfull_desc:"' . mce_escape( __('Align Full') ) . ' (Alt+Shift+J)",
 bullist_desc:"' . mce_escape( __('Unordered list') ) . ' (Alt+Shift+U)",
 numlist_desc:"' . mce_escape( __('Ordered list') ) . ' (Alt+Shift+O)",
 outdent_desc:"' . mce_escape( __('Outdent') ) . '",
@@ -336,7 +336,7 @@ correction:"' . mce_escape( __('No correction') ) . '",
 enablejavascript:"' . mce_escape( __('Enable JavaScript') ) . '",
 starttime:"' . mce_escape( __('Start time') ) . '",
 endtime:"' . mce_escape( __('End time') ) . '",
-href:"' . mce_escape( __('Href') ) . '",
+href:"' . mce_escape( __('href') ) . '",
 qtsrcchokespeed:"' . mce_escape( __('Choke speed') ) . '",
 target:"' . mce_escape( __('Target') ) . '",
 volume:"' . mce_escape( __('Volume') ) . '",
@@ -404,7 +404,7 @@ flv_jscallback:"' . mce_escape( __('JS Callback') ) . '"
 
 tinyMCE.addI18n("' . $language . '.wordpress",{
 wp_adv_desc:"' . mce_escape( __('Show/Hide Kitchen Sink') )  . ' (Alt+Shift+Z)",
-wp_more_desc:"' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)",
+wp_more_desc:"' . mce_escape( __('Insert More Tag') ) . ' (Alt+Shift+T)",
 wp_page_desc:"' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)",
 wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)",
 wp_more_alt:"' . mce_escape( __('More...') ) . '",
index 26974d3400ad78e721e1061707fae46c0f2c928c..12bb771ae62f6ab2c3444809c81977e010357894 100644 (file)
@@ -40,6 +40,12 @@ select {
        padding: 3px;
 }
 
+p.help {
+       margin: 4px 0;
+       font-size: 12px;
+       font-style: italic;
+}
+
 body, td {
        font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
 }
@@ -52,11 +58,13 @@ abbr.required {
 img.alignright,
 .alignright {
        float: right;
+       margin-left: 5px;
 }
 
 img.alignleft,
 .alignleft {
        float: left;
+       margin-right: 5px;
 }
 
 img.aligncenter {
@@ -149,9 +157,9 @@ th.label {
        -khtml-border-top-right-radius: 4px;
        -webkit-border-top-right-radius: 4px;
        border-top-right-radius: 4px;
-       border-style:solid;
-       border-width:1px;
-       font-weight:normal;
+       border-style: solid;
+       border-width: 1px;
+       font-weight: normal;
 }
 
 #adv_settings .field label {
@@ -279,13 +287,16 @@ form {
 .describe textarea {
        width: 460px;
        border: 1px solid #dfdfdf;
+       -moz-border-radius: 4px;
+       -khtml-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
 }
 
-
 .media-upload-form label,
 .media-upload-form legend {
        font-weight: bold;
-       font-size: 13px;
+       font-size: 12px;
        color: #464646;
 }
 
@@ -341,3 +352,7 @@ div#media-upload-error {
        height: 27px;
        line-height: 26px;
 }
+
+* html input {
+       border: 1px solid #ddd;
+}
index efba4a2042f4b604120cbc478e055d8302d3258f..d7ad22716838e923e8125d69d3280c93ca5776dc 100644 (file)
@@ -4,10 +4,10 @@
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
 
-<script type="text/javascript" src="js/editimage.js?ver=3223"></script>
+<script type="text/javascript" src="js/editimage.js?ver=327"></script>
 <script type="text/javascript" src="../../utils/form_utils.js?ver=3223"></script>
 
-<link rel="stylesheet" href="css/editimage.css?ver=3223" type="text/css" media="all" />
+<link rel="stylesheet" href="css/editimage.css?ver=327" type="text/css" media="all" />
 
 <script type="text/javascript">
 if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
@@ -85,6 +85,17 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
                        </td>
                </tr>
 
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_alt">
+                               <span class="alignleft">{#wpeditimage.alt}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="img_alt" name="img_alt" value="" size="60" />
+                       </td>
+               </tr>
+
                <tr id="cap_field">
                        <th valign="top" scope="row" class="label">
                                <label for="img_cap">
@@ -128,17 +139,6 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
                                <input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
                        </td>
                </tr>
-               
-               <tr>
-                       <th valign="top" scope="row" class="label">
-                               <label for="img_alt">
-                               <span class="alignleft">{#wpeditimage.alt}</span>
-                               </label>
-                       </th>
-                       <td class="field">
-                               <input type="text" id="img_alt" name="img_alt" value="" size="60" />
-                       </td>
-               </tr>
 
                <tr id="img_dim">
                        <th valign="top" scope="row" class="label">
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js
new file mode 100644 (file)
index 0000000..1acf9f0
--- /dev/null
@@ -0,0 +1,613 @@
+
+var tinymce = null, tinyMCEPopup, tinyMCE, wpImage;
+
+tinyMCEPopup = {
+       init: function() {
+               var t = this, w, li, q, i, it;
+
+               li = ('' + document.location.search).replace(/^\?/, '').split('&');
+               q = {};
+               for ( i = 0; i < li.length; i++ ) {
+                       it = li[i].split('=');
+                       q[unescape(it[0])] = unescape(it[1]);
+               }
+
+               if (q.mce_rdomain)
+                       document.domain = q.mce_rdomain;
+
+               // Find window & API
+               w = t.getWin();
+               tinymce = w.tinymce;
+               tinyMCE = w.tinyMCE;
+               t.editor = tinymce.EditorManager.activeEditor;
+               t.params = t.editor.windowManager.params;
+
+               // Setup local DOM
+               t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
+               t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
+       },
+
+       getWin : function() {
+               return window.dialogArguments || opener || parent || top;
+       },
+
+       getParam : function(n, dv) {
+               return this.editor.getParam(n, dv);
+       },
+
+       close : function() {
+               var t = this, win = t.getWin();
+
+               // To avoid domain relaxing issue in Opera
+               function close() {
+                       win.tb_remove();
+                       tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
+               };
+
+               if (tinymce.isOpera)
+                       win.setTimeout(close, 0);
+               else
+                       close();
+       },
+
+       execCommand : function(cmd, ui, val, a) {
+               a = a || {};
+               a.skip_focus = 1;
+
+               this.restoreSelection();
+               return this.editor.execCommand(cmd, ui, val, a);
+       },
+
+       storeSelection : function() {
+               this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
+       },
+
+       restoreSelection : function() {
+               var t = tinyMCEPopup;
+
+               if (tinymce.isIE)
+                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
+       }
+}
+tinyMCEPopup.init();
+
+wpImage = {
+       preInit : function() {
+               // import colors stylesheet from parent
+               var win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
+
+               for ( i = 0; i < styles.length; i++ ) {
+                       url = styles.item(i).href;
+                       if ( url && url.indexOf('colors') != -1 )
+                               document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' );
+               }
+       },
+
+       I : function(e) {
+               return document.getElementById(e);
+       },
+
+       current : '',
+       link : '',
+       link_rel : '',
+       target_value : '',
+       current_size_sel : 's100',
+       width : '',
+       height : '',
+       align : '',
+       img_alt : '',
+
+       setTabs : function(tab) {
+               var t = this;
+
+               if ( 'current' == tab.className ) return false;
+               t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
+               t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
+               t.I('tab_basic').className = t.I('tab_advanced').className = '';
+               tab.className = 'current';
+               return false;
+       },
+
+       img_seturl : function(u) {
+               var t = this, rel = t.I('link_rel').value;
+
+               if ( 'current' == u ) {
+                       t.I('link_href').value = t.current;
+                       t.I('link_rel').value = t.link_rel;
+               } else {
+                       t.I('link_href').value = t.link;
+                       if ( rel ) {
+                               rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
+                               t.I('link_rel').value = tinymce.trim(rel);
+                       }
+               }
+       },
+
+       imgAlignCls : function(v) {
+               var t = this, cls = t.I('img_classes').value;
+
+               t.I('img_demo').className = t.align = v;
+
+               cls = cls.replace( /align[^ "']+/gi, '' );
+               cls += (' ' + v);
+               cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
+
+               if ( 'aligncenter' == v ) {
+                       t.I('hspace').value = '';
+                       t.updateStyle('hspace');
+               }
+
+               t.I('img_classes').value = cls;
+       },
+
+       showSize : function(el) {
+               var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
+
+               size = parseInt(id.substring(1)) / 200;
+               demo.width = Math.round(w * size);
+               demo.height = Math.round(h * size);
+
+               t.showSizeClear();
+               el.style.borderColor = '#A3A3A3';
+               el.style.backgroundColor = '#E5E5E5';
+       },
+
+       showSizeSet : function() {
+               var t = this, s130, s120, s110;
+
+               if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
+                       s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
+
+                       s130.onclick = s120.onclick = s110.onclick = null;
+                       s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
+                       s130.style.color = s120.style.color = s110.style.color = '#aaa';
+               }
+       },
+
+       showSizeRem : function() {
+               var t = this, demo = t.I('img_demo'), f = document.forms[0];
+
+               demo.width = Math.round(f.width.value * 0.5);
+               demo.height = Math.round(f.height.value * 0.5);
+               t.showSizeClear();
+               t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
+               t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
+
+               return false;
+       },
+
+       showSizeClear : function() {
+               var divs = this.I('img_size').getElementsByTagName('div'), i;
+
+               for ( i = 0; i < divs.length; i++ ) {
+                       divs[i].style.borderColor = '#f1f1f1';
+                       divs[i].style.backgroundColor = '#f1f1f1';
+               }
+       },
+
+       imgEditSize : function(el) {
+               var t = this, f = document.forms[0], W, H, w, h, id;
+
+               if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )
+                       return;
+               
+               W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
+
+               size = parseInt(id.substring(1)) / 100;
+
+               w = Math.round(w * size);
+               h = Math.round(h * size);
+
+               f.width.value = Math.min(W, w);
+               f.height.value = Math.min(H, h);
+
+               t.current_size_sel = id;
+               t.demoSetSize();
+       },
+
+       demoSetSize : function(img) {
+               var demo = this.I('img_demo'), f = document.forms[0];
+
+               demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
+               demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
+       },
+
+       demoSetStyle : function() {
+               var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
+
+               if (demo) {
+                       dom.setAttrib(demo, 'style', f.img_style.value);
+                       dom.setStyle(demo, 'width', '');
+                       dom.setStyle(demo, 'height', '');
+               }
+       },
+
+       origSize : function() {
+               var t = this, f = document.forms[0], el = t.I('s100');
+
+               f.width.value = t.width = t.preloadImg.width;
+               f.height.value = t.height = t.preloadImg.height;
+               t.showSizeSet();
+               t.demoSetSize();
+               t.showSize(el);
+       },
+
+       init : function() {
+               var ed = tinyMCEPopup.editor, h;
+
+               h = document.body.innerHTML;
+               document.body.innerHTML = ed.translate(h);
+               window.setTimeout( function(){wpImage.setup();}, 500 );
+       },
+
+       setup : function() {
+               var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
+                       d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '', dlc, pa;
+
+               document.dir = tinyMCEPopup.editor.getParam('directionality','');
+
+               if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
+                       t.I('cap_field').style.display = 'none';
+
+               tinyMCEPopup.restoreSelection();
+               el = ed.selection.getNode();
+               if (el.nodeName != 'IMG')
+                       return;
+
+               f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
+               ed.dom.setStyle(el, 'float', '');
+               t.getImageData();
+               c = ed.dom.getAttrib(el, 'class');
+
+               if ( DL = dom.getParent(el, 'dl') ) {
+                       dlc = ed.dom.getAttrib(DL, 'class');
+                       dlc = dlc.match(/align[^ "']+/i);
+                       if ( dlc && ! dom.hasClass(el, dlc) ) {
+                               c += ' '+dlc;
+                               tinymce.trim(c);
+                       }
+
+                       tinymce.each(DL.childNodes, function(e) {
+                               if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) {
+                                       caption = e.innerHTML;
+                                       return;
+                               }
+                       });
+               }
+
+               f.img_cap.value = caption;
+               f.img_title.value = ed.dom.getAttrib(el, 'title');
+               f.img_alt.value = ed.dom.getAttrib(el, 'alt');
+               f.border.value = ed.dom.getAttrib(el, 'border');
+               f.vspace.value = ed.dom.getAttrib(el, 'vspace');
+               f.hspace.value = ed.dom.getAttrib(el, 'hspace');
+               f.align.value = ed.dom.getAttrib(el, 'align');
+               f.width.value = t.width = ed.dom.getAttrib(el, 'width');
+               f.height.value = t.height = ed.dom.getAttrib(el, 'height');
+               f.img_classes.value = c;
+               f.img_style.value = ed.dom.getAttrib(el, 'style');
+
+               // Move attribs to styles
+               if ( dom.getAttrib(el, 'hspace') )
+                       t.updateStyle('hspace');
+
+               if ( dom.getAttrib(el, 'border') )
+                       t.updateStyle('border');
+
+               if ( dom.getAttrib(el, 'vspace') )
+                       t.updateStyle('vspace');
+
+               if ( pa = ed.dom.getParent(el, 'A') ) {
+                       f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
+                       f.link_title.value = ed.dom.getAttrib(pa, 'title');
+                       f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
+                       f.link_style.value = ed.dom.getAttrib(pa, 'style');
+                       t.target_value = ed.dom.getAttrib(pa, 'target');
+                       f.link_classes.value = ed.dom.getAttrib(pa, 'class');
+               }
+
+               f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
+
+               fname = link.substring( link.lastIndexOf('/') );
+               fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
+               t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
+
+               if ( c.indexOf('alignleft') != -1 ) {
+                       t.I('alignleft').checked = "checked";
+                       d.className = t.align = "alignleft";
+               } else if ( c.indexOf('aligncenter') != -1 ) {
+                       t.I('aligncenter').checked = "checked";
+                       d.className = t.align = "aligncenter";
+               } else if ( c.indexOf('alignright') != -1 ) {
+                       t.I('alignright').checked = "checked";
+                       d.className = t.align = "alignright";
+               } else if ( c.indexOf('alignnone') != -1 ) {
+                       t.I('alignnone').checked = "checked";
+                       d.className = t.align = "alignnone";
+               }
+
+               if ( t.width && t.preloadImg.width ) t.showSizeSet();
+               document.body.style.display = '';
+       },
+
+       remove : function() {
+               var ed = tinyMCEPopup.editor, p, el;
+
+               tinyMCEPopup.restoreSelection();
+               el = ed.selection.getNode();
+               if (el.nodeName != 'IMG') return;
+
+               if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
+                       ed.dom.remove(p);
+               else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
+                       ed.dom.remove(p);
+               else ed.dom.remove(el);
+
+               ed.execCommand('mceRepaint');
+               tinyMCEPopup.close();
+               return;
+       },
+
+       update : function() {
+               var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null,
+                       DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html,
+                       id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa;
+
+               tinyMCEPopup.restoreSelection();
+               el = ed.selection.getNode();
+
+               if (el.nodeName != 'IMG') return;
+               if (f.img_src.value === '') {
+                       t.remove();
+                       return;
+               }
+
+               if ( f.img_cap.value != '' && f.width.value != '' ) {
+                       do_caption = 1;
+                       img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
+               }
+
+               A = ed.dom.getParent(el, 'a');
+               P = ed.dom.getParent(el, 'p');
+               DL = ed.dom.getParent(el, 'dl');
+               DIV = ed.dom.getParent(el, 'div');
+
+               tinyMCEPopup.execCommand("mceBeginUndoLevel");
+
+               ed.dom.setAttribs(el, {
+                       src : f.img_src.value,
+                       title : f.img_title.value,
+                       alt : f.img_alt.value,
+                       width : f.width.value,
+                       height : f.height.value,
+                       style : f.img_style.value,
+                       'class' : img_class
+               });
+
+               if ( f.link_href.value ) {
+                       // Create new anchor elements
+                       if ( A == null ) {
+                               if ( ! f.link_href.value.match(/https?:\/\//i) )
+                                       f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
+
+                               if ( tinymce.isWebKit && ed.dom.hasClass(el, 'aligncenter') ) {
+                                       ed.dom.removeClass(el, 'aligncenter');
+                                       fixSafari = 1;
+                               }
+
+                               tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+                               if ( fixSafari ) ed.dom.addClass(el, 'aligncenter');
+
+                               tinymce.each(ed.dom.select("a"), function(n) {
+                                       if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+
+                                               ed.dom.setAttribs(n, {
+                                                       href : f.link_href.value,
+                                                       title : f.link_title.value,
+                                                       rel : f.link_rel.value,
+                                                       target : (f.link_target.checked == true) ? '_blank' : '',
+                                                       'class' : f.link_classes.value,
+                                                       style : f.link_style.value
+                                               });
+                                       }
+                               });
+                       } else {
+                               ed.dom.setAttribs(A, {
+                                       href : f.link_href.value,
+                                       title : f.link_title.value,
+                                       rel : f.link_rel.value,
+                                       target : (f.link_target.checked == true) ? '_blank' : '',
+                                       'class' : f.link_classes.value,
+                                       style : f.link_style.value
+                               });
+                       }
+               }
+
+               if ( do_caption ) {
+                       cap_width = 10 + parseInt(f.width.value);
+                       div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
+
+                       if ( DL ) {
+                               ed.dom.setAttribs(DL, {
+                                       'class' : 'wp-caption '+t.align,
+                                       style : 'width: '+cap_width+'px;'
+                               });
+
+                               if ( DIV )
+                                       ed.dom.setAttrib(DIV, 'class', div_cls);
+
+                               if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
+                                       ed.dom.setHTML(DD, f.img_cap.value);
+
+                       } else {
+                               if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
+                                       cap_id = 'attachment_'+id[1];
+
+                               if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
+                                       if ( lnk.childNodes.length == 1 )
+                                               html = ed.dom.getOuterHTML(lnk);
+                                       else {
+                                               html = ed.dom.getOuterHTML(lnk);
+                                               html = html.match(/<a[^>]+>/i);
+                                               html = html+ed.dom.getOuterHTML(el)+'</a>';
+                                       }
+                               } else html = ed.dom.getOuterHTML(el);
+
+                               html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
+                               'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>';
+
+                               cap = ed.dom.create('div', {'class': div_cls}, html);
+
+                               if ( P ) {
+                                       P.parentNode.insertBefore(cap, P);
+                                       if ( P.childNodes.length == 1 )
+                                               ed.dom.remove(P);
+                                       else if ( lnk && lnk.childNodes.length == 1 )
+                                               ed.dom.remove(lnk);
+                                       else ed.dom.remove(el);
+                               } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
+                                       pa.appendChild(cap);
+                                       if ( lnk && lnk.childNodes.length == 1 )
+                                               ed.dom.remove(lnk);
+                                       else ed.dom.remove(el);
+                               }
+                       }
+
+               } else {
+                       if ( DL && DIV ) {
+                               if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
+                               else html = ed.dom.getOuterHTML(el);
+
+                               P = ed.dom.create('p', {}, html);
+                               DIV.parentNode.insertBefore(P, DIV);
+                               ed.dom.remove(DIV);
+                       }
+               }
+
+               if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
+                       if ( P && ( ! P.style || P.style.textAlign != 'center' ) )
+                               ed.dom.setStyle(P, 'textAlign', 'center');
+               } else {
+                       if ( P && P.style && P.style.textAlign == 'center' )
+                               ed.dom.setStyle(P, 'textAlign', '');
+               }
+
+               if ( ! f.link_href.value && A ) {
+                       b = ed.selection.getBookmark();
+                       ed.dom.remove(A, 1);
+                       ed.selection.moveToBookmark(b);
+               }
+
+               tinyMCEPopup.execCommand("mceEndUndoLevel");
+               ed.execCommand('mceRepaint');
+               tinyMCEPopup.close();
+       },
+
+       updateStyle : function(ty) {
+               var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
+
+               if (tinyMCEPopup.editor.settings.inline_styles) {
+                       // Handle align
+                       if (ty == 'align') {
+                               dom.setStyle(img, 'float', '');
+                               dom.setStyle(img, 'vertical-align', '');
+
+                               v = f.align.value;
+                               if (v) {
+                                       if (v == 'left' || v == 'right')
+                                               dom.setStyle(img, 'float', v);
+                                       else
+                                               img.style.verticalAlign = v;
+                               }
+                       }
+
+                       // Handle border
+                       if (ty == 'border') {
+                               dom.setStyle(img, 'border', '');
+
+                               v = f.border.value;
+                               if (v || v == '0') {
+                                       if (v == '0')
+                                               img.style.border = '0';
+                                       else
+                                               img.style.border = v + 'px solid black';
+                               }
+                       }
+
+                       // Handle hspace
+                       if (ty == 'hspace') {
+                               dom.setStyle(img, 'marginLeft', '');
+                               dom.setStyle(img, 'marginRight', '');
+
+                               v = f.hspace.value;
+                               if (v) {
+                                       img.style.marginLeft = v + 'px';
+                                       img.style.marginRight = v + 'px';
+                               }
+                       }
+
+                       // Handle vspace
+                       if (ty == 'vspace') {
+                               dom.setStyle(img, 'marginTop', '');
+                               dom.setStyle(img, 'marginBottom', '');
+
+                               v = f.vspace.value;
+                               if (v) {
+                                       img.style.marginTop = v + 'px';
+                                       img.style.marginBottom = v + 'px';
+                               }
+                       }
+
+                       // Merge
+                       f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
+                       this.demoSetStyle();
+               }
+       },
+
+       checkVal : function(f) {
+
+               if ( f.value == '' ) {
+       //              if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
+       //              if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
+                       if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
+               }
+       },
+
+       resetImageData : function() {
+               var f = document.forms[0];
+
+               f.width.value = f.height.value = '';
+       },
+
+       updateImageData : function() {
+               var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value;
+
+               if ( !w && h )
+                       w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) );
+               else if ( w && !h )
+                       h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) );
+
+               if ( !w )
+                       f.width.value = t.width = t.preloadImg.width;
+
+               if ( !h )
+                       f.height.value = t.height = t.preloadImg.height;
+
+               t.showSizeSet();
+               t.demoSetSize();
+               if ( f.img_style.value )
+                       t.demoSetStyle();
+       },
+
+       getImageData : function() {
+               var t = wpImage, f = document.forms[0];
+
+               t.preloadImg = new Image();
+               t.preloadImg.onload = t.updateImageData;
+               t.preloadImg.onerror = t.resetImageData;
+               t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
+       }
+};
+
+window.onload = function(){wpImage.init();}
+wpImage.preInit();
index 9534c643b939ed4cf1f4b27a07b7a4de9fc68b2e..0a801bd550f4ea17c07f93586f70771465326f9c 100644 (file)
@@ -1,607 +1 @@
-
-var tinymce = null, tinyMCEPopup, tinyMCE;
-
-tinyMCEPopup = {
-       init: function() {
-               var t = this, w, ti, li, q, i, it;
-
-               li = ('' + document.location.search).replace(/^\?/, '').split('&');
-               q = {};
-               for (i=0; i<li.length; i++) {
-                       it = li[i].split('=');
-                       q[unescape(it[0])] = unescape(it[1]);
-               }
-
-               if (q.mce_rdomain)
-                       document.domain = q.mce_rdomain;
-
-               // Find window & API
-               w = t.getWin();
-               tinymce = w.tinymce;
-               tinyMCE = w.tinyMCE;
-               t.editor = tinymce.EditorManager.activeEditor;
-               t.params = t.editor.windowManager.params;
-
-               // Setup local DOM
-               t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
-               t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
-       },
-
-       getWin : function() {
-               return window.dialogArguments || opener || parent || top;
-       },
-
-       getParam : function(n, dv) {
-               return this.editor.getParam(n, dv);
-       },
-
-       close : function() {
-               var t = this, win = t.getWin();
-
-               // To avoid domain relaxing issue in Opera
-               function close() {
-                       win.tb_remove();
-                       tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
-               };
-
-               if (tinymce.isOpera)
-                       win.setTimeout(close, 0);
-               else
-                       close();
-       },
-
-       execCommand : function(cmd, ui, val, a) {
-               a = a || {};
-               a.skip_focus = 1;
-
-               this.restoreSelection();
-               return this.editor.execCommand(cmd, ui, val, a);
-       },
-
-       storeSelection : function() {
-               this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
-       },
-
-       restoreSelection : function() {
-               var t = tinyMCEPopup;
-
-               if (tinymce.isIE)
-                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
-       }
-}
-tinyMCEPopup.init();
-
-var wpImage = {
-       preInit : function() {
-               // import colors stylesheet from parent
-               var win = tinyMCEPopup.getWin();
-               var styles = win.document.styleSheets;
-
-               for ( i = 0; i < styles.length; i++ ) {
-                       var url = styles.item(i).href;
-                       if ( url && url.indexOf('colors') != -1 )
-                               document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' );
-               }
-       },
-
-       I : function(e) {
-               return document.getElementById(e);
-       },
-
-       current : '',
-       link : '',
-       link_rel : '',
-       target_value : '',
-       current_size_sel : 's100',
-       width : '',
-       height : '',
-       align : '',
-       img_alt : '',
-
-       setTabs : function(tab) {
-               var t = this;
-
-               if ( 'current' == tab.className ) return false;
-               t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
-               t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
-               t.I('tab_basic').className = t.I('tab_advanced').className = '';
-               tab.className = 'current';
-               return false;
-       },
-
-       img_seturl : function(u) {
-               var t = this, rel = t.I('link_rel').value;
-
-               if ( 'current' == u ) {
-                       t.I('link_href').value = t.current;
-                       t.I('link_rel').value = t.link_rel;
-               } else {
-                       t.I('link_href').value = t.link;
-                       if ( rel ) {
-                               rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
-                               t.I('link_rel').value = tinymce.trim(rel);
-                       }
-               }
-       },
-
-       imgAlignCls : function(v) {
-               var t = this, cls = t.I('img_classes').value;
-
-               t.I('img_demo').className = t.align = v;
-
-               cls = cls.replace( /align[^ "']+/gi, '' );
-               cls += (' ' + v);
-               cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
-
-               if ( 'aligncenter' == v ) {
-                       t.I('hspace').value = '';
-                       t.updateStyle('hspace');
-               }
-
-               t.I('img_classes').value = cls;
-       },
-
-       showSize : function(el) {
-               var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
-
-               size = parseInt(id.substring(1)) / 200;
-               demo.width = Math.round(w * size);
-               demo.height = Math.round(h * size);
-
-               t.showSizeClear();
-               el.style.borderColor = '#A3A3A3';
-               el.style.backgroundColor = '#E5E5E5';
-       },
-
-       showSizeSet : function() {
-               var t = this;
-
-               if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
-                       var s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
-
-                       s130.onclick = s120.onclick = s110.onclick = null;
-                       s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
-                       s130.style.color = s120.style.color = s110.style.color = '#aaa';
-               }
-       },
-
-       showSizeRem : function() {
-               var t = this, demo = t.I('img_demo'), f = document.forms[0];
-
-               demo.width = Math.round(f.width.value * 0.5);
-               demo.height = Math.round(f.height.value * 0.5);
-               t.showSizeClear();
-               t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
-               t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
-
-               return false;
-       },
-
-       showSizeClear : function() {
-               var divs = this.I('img_size').getElementsByTagName('div');
-
-               for ( i = 0; i < divs.length; i++ ) {
-                       divs[i].style.borderColor = '#f1f1f1';
-                       divs[i].style.backgroundColor = '#f1f1f1';
-               }
-       },
-
-       imgEditSize : function(el) {
-               var t = this, f = document.forms[0];
-
-               if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )  return;
-               var W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
-
-               size = parseInt(id.substring(1)) / 100;
-
-               w = Math.round(w * size);
-               h = Math.round(h * size);
-
-               f.width.value = Math.min(W, w);
-               f.height.value = Math.min(H, h);
-
-               t.current_size_sel = id;
-               t.demoSetSize();
-       },
-
-       demoSetSize : function(img) {
-               var demo = this.I('img_demo'), f = document.forms[0];
-
-               demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
-               demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
-       },
-
-       demoSetStyle : function() {
-               var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
-
-               if (demo) {
-                       dom.setAttrib(demo, 'style', f.img_style.value);
-                       dom.setStyle(demo, 'width', '');
-                       dom.setStyle(demo, 'height', '');
-               }
-       },
-
-       origSize : function() {
-               var t = this, f = document.forms[0], el = t.I('s100');
-
-               f.width.value = t.width = t.preloadImg.width;
-               f.height.value = t.height = t.preloadImg.height;
-               t.showSizeSet();
-               t.demoSetSize();
-               t.showSize(el);
-       },
-
-       init : function() {
-               var ed = tinyMCEPopup.editor, h;
-
-               h = document.body.innerHTML;
-
-               // Replace a=x with a="x" in IE
-               if (tinymce.isIE)
-                       h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
-
-               document.body.innerHTML = ed.translate(h);
-               window.setTimeout( function(){wpImage.setup();}, 100 );
-       },
-
-       setup : function() {
-               var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '';
-               document.dir = tinyMCEPopup.editor.getParam('directionality','');
-
-               if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
-                       t.I('cap_field').style.display = 'none';
-
-               tinyMCEPopup.restoreSelection();
-               el = ed.selection.getNode();
-               if (el.nodeName != 'IMG') return;
-
-               f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
-               ed.dom.setStyle(el, 'float', '');
-               t.getImageData();
-               c = ed.dom.getAttrib(el, 'class');
-
-               if ( DL = dom.getParent(el, 'dl') ) {
-                       var dlc = ed.dom.getAttrib(DL, 'class');
-                       dlc = dlc.match(/align[^ "']+/i);
-                       if ( dlc && ! dom.hasClass(el, dlc) ) {
-                               c += ' '+dlc;
-                               tinymce.trim(c);
-                       }
-
-                       tinymce.each(DL.childNodes, function(e) {
-                               if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) {
-                                       caption = e.innerHTML;
-                                       return;
-                               }
-                       });
-               }
-
-               f.img_cap.value = caption;
-               f.img_title.value = ed.dom.getAttrib(el, 'title');
-               f.img_alt.value = ed.dom.getAttrib(el, 'alt');
-               f.border.value = ed.dom.getAttrib(el, 'border');
-               f.vspace.value = ed.dom.getAttrib(el, 'vspace');
-               f.hspace.value = ed.dom.getAttrib(el, 'hspace');
-               f.align.value = ed.dom.getAttrib(el, 'align');
-               f.width.value = t.width = ed.dom.getAttrib(el, 'width');
-               f.height.value = t.height = ed.dom.getAttrib(el, 'height');
-               f.img_classes.value = c;
-               f.img_style.value = ed.dom.getAttrib(el, 'style');
-
-               // Move attribs to styles
-               if (dom.getAttrib(el, 'hspace'))
-                       t.updateStyle('hspace');
-
-               if (dom.getAttrib(el, 'border'))
-                       t.updateStyle('border');
-
-               if (dom.getAttrib(el, 'vspace'))
-                       t.updateStyle('vspace');
-
-               if (pa = ed.dom.getParent(el, 'A')) {
-                       f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
-                       f.link_title.value = ed.dom.getAttrib(pa, 'title');
-                       f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
-                       f.link_style.value = ed.dom.getAttrib(pa, 'style');
-                       t.target_value = ed.dom.getAttrib(pa, 'target');
-                       f.link_classes.value = ed.dom.getAttrib(pa, 'class');
-               }
-
-               f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
-
-               fname = link.substring( link.lastIndexOf('/') );
-               fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
-               t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
-
-               if ( c.indexOf('alignleft') != -1 ) {
-                       t.I('alignleft').checked = "checked";
-                       d.className = t.align = "alignleft";
-               } else if ( c.indexOf('aligncenter') != -1 ) {
-                       t.I('aligncenter').checked = "checked";
-                       d.className = t.align = "aligncenter";
-               } else if ( c.indexOf('alignright') != -1 ) {
-                       t.I('alignright').checked = "checked";
-                       d.className = t.align = "alignright";
-               } else if ( c.indexOf('alignnone') != -1 ) {
-                       t.I('alignnone').checked = "checked";
-                       d.className = t.align = "alignnone";
-               }
-
-               if ( t.width && t.preloadImg.width ) t.showSizeSet();
-               document.body.style.display = '';
-       },
-
-       remove : function() {
-               var ed = tinyMCEPopup.editor, p, el;
-
-               tinyMCEPopup.restoreSelection();
-               el = ed.selection.getNode();
-               if (el.nodeName != 'IMG') return;
-
-               if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
-                       ed.dom.remove(p);
-               else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
-                       ed.dom.remove(p);
-               else ed.dom.remove(el);
-
-               ed.execCommand('mceRepaint');
-               tinyMCEPopup.close();
-               return;
-       },
-
-       update : function() {
-               var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null, DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html;
-
-               tinyMCEPopup.restoreSelection();
-               el = ed.selection.getNode();
-
-               if (el.nodeName != 'IMG') return;
-               if (f.img_src.value === '') {
-                       t.remove();
-                       return;
-               }
-
-               if ( f.img_cap.value != '' && f.width.value != '' ) {
-                       do_caption = 1;
-                       img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
-               }
-
-               A = ed.dom.getParent(el, 'a');
-               P = ed.dom.getParent(el, 'p');
-               DL = ed.dom.getParent(el, 'dl');
-               DIV = ed.dom.getParent(el, 'div');
-
-               tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
-               ed.dom.setAttribs(el, {
-                       src : f.img_src.value,
-                       title : f.img_title.value,
-                       alt : f.img_alt.value,
-                       width : f.width.value,
-                       height : f.height.value,
-                       style : f.img_style.value,
-                       'class' : img_class
-               });
-
-               if ( f.link_href.value ) {
-                       // Create new anchor elements
-                       if ( A == null ) {
-                               if ( ! f.link_href.value.match(/https?:\/\//i) )
-                                       f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
-
-                               if ( tinymce.isWebKit && ed.dom.hasClass(el, 'aligncenter') ) {
-                                       ed.dom.removeClass(el, 'aligncenter');
-                                       fixSafari = 1;
-                               }
-
-                               tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
-                               if ( fixSafari ) ed.dom.addClass(el, 'aligncenter');
-
-                               tinymce.each(ed.dom.select("a"), function(n) {
-                                       if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
-
-                                               ed.dom.setAttribs(n, {
-                                                       href : f.link_href.value,
-                                                       title : f.link_title.value,
-                                                       rel : f.link_rel.value,
-                                                       target : (f.link_target.checked == true) ? '_blank' : '',
-                                                       'class' : f.link_classes.value,
-                                                       style : f.link_style.value
-                                               });
-                                       }
-                               });
-                       } else {
-                               ed.dom.setAttribs(A, {
-                                       href : f.link_href.value,
-                                       title : f.link_title.value,
-                                       rel : f.link_rel.value,
-                                       target : (f.link_target.checked == true) ? '_blank' : '',
-                                       'class' : f.link_classes.value,
-                                       style : f.link_style.value
-                               });
-                       }
-               }
-
-               if ( do_caption ) {
-                       var id, cap_id = '', cap, DT, DD, cap_width = 10 + parseInt(f.width.value), align = t.align.substring(5), div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
-
-                       if ( DL ) {
-                               ed.dom.setAttribs(DL, {
-                                       'class' : 'wp-caption '+t.align,
-                                       style : 'width: '+cap_width+'px;'
-                               });
-
-                               if ( DIV )
-                                       ed.dom.setAttrib(DIV, 'class', div_cls);
-
-                               if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
-                                       ed.dom.setHTML(DD, f.img_cap.value);
-
-                       } else {
-                               var lnk = '', pa;
-                               if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
-                                       cap_id = 'attachment_'+id[1];
-
-                               if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
-                                       if ( lnk.childNodes.length == 1 )
-                                               html = ed.dom.getOuterHTML(lnk);
-                                       else {
-                                               html = ed.dom.getOuterHTML(lnk);
-                                               html = html.match(/<a[^>]+>/i);
-                                               html = html+ed.dom.getOuterHTML(el)+'</a>';
-                                       }
-                               } else html = ed.dom.getOuterHTML(el);
-
-                               html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
-                               'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>';
-
-                               cap = ed.dom.create('div', {'class': div_cls}, html);
-
-                               if ( P ) {
-                                       P.parentNode.insertBefore(cap, P);
-                                       if ( P.childNodes.length == 1 )
-                                               ed.dom.remove(P);
-                                       else if ( lnk && lnk.childNodes.length == 1 )
-                                               ed.dom.remove(lnk);
-                                       else ed.dom.remove(el);
-                               } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
-                                       pa.appendChild(cap);
-                                       if ( lnk && lnk.childNodes.length == 1 )
-                                               ed.dom.remove(lnk);
-                                       else ed.dom.remove(el);
-                               }
-                       }
-
-               } else {
-                       if ( DL && DIV ) {
-                               var aa;
-                               if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
-                               else html = ed.dom.getOuterHTML(el);
-
-                               P = ed.dom.create('p', {}, html);
-                               DIV.parentNode.insertBefore(P, DIV);
-                               ed.dom.remove(DIV);
-                       }
-               }
-
-               if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
-                       if ( P && ( ! P.style || P.style.textAlign != 'center' ) )
-                               ed.dom.setStyle(P, 'textAlign', 'center');
-               } else {
-                       if ( P && P.style && P.style.textAlign == 'center' )
-                               ed.dom.setStyle(P, 'textAlign', '');
-               }
-
-               if ( ! f.link_href.value && A ) {
-                       b = ed.selection.getBookmark();
-                       ed.dom.remove(A, 1);
-                       ed.selection.moveToBookmark(b);
-               }
-
-               tinyMCEPopup.execCommand("mceEndUndoLevel");
-               ed.execCommand('mceRepaint');
-               tinyMCEPopup.close();
-       },
-
-       updateStyle : function(ty) {
-               var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
-
-               if (tinyMCEPopup.editor.settings.inline_styles) {
-                       // Handle align
-                       if (ty == 'align') {
-                               dom.setStyle(img, 'float', '');
-                               dom.setStyle(img, 'vertical-align', '');
-
-                               v = f.align.value;
-                               if (v) {
-                                       if (v == 'left' || v == 'right')
-                                               dom.setStyle(img, 'float', v);
-                                       else
-                                               img.style.verticalAlign = v;
-                               }
-                       }
-
-                       // Handle border
-                       if (ty == 'border') {
-                               dom.setStyle(img, 'border', '');
-
-                               v = f.border.value;
-                               if (v || v == '0') {
-                                       if (v == '0')
-                                               img.style.border = '0';
-                                       else
-                                               img.style.border = v + 'px solid black';
-                               }
-                       }
-
-                       // Handle hspace
-                       if (ty == 'hspace') {
-                               dom.setStyle(img, 'marginLeft', '');
-                               dom.setStyle(img, 'marginRight', '');
-
-                               v = f.hspace.value;
-                               if (v) {
-                                       img.style.marginLeft = v + 'px';
-                                       img.style.marginRight = v + 'px';
-                               }
-                       }
-
-                       // Handle vspace
-                       if (ty == 'vspace') {
-                               dom.setStyle(img, 'marginTop', '');
-                               dom.setStyle(img, 'marginBottom', '');
-
-                               v = f.vspace.value;
-                               if (v) {
-                                       img.style.marginTop = v + 'px';
-                                       img.style.marginBottom = v + 'px';
-                               }
-                       }
-
-                       // Merge
-                       f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
-                       this.demoSetStyle();
-               }
-       },
-
-       checkVal : function(f) {
-
-               if ( f.value == '' ) {
-       //              if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
-       //              if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
-                       if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
-               }
-       },
-
-       resetImageData : function() {
-               var f = document.forms[0];
-
-               f.width.value = f.height.value = '';
-       },
-
-       updateImageData : function() {
-               var f = document.forms[0], t = wpImage;
-
-               if ( f.width.value == '' || f.height.value == '' ) {
-                       f.width.value = t.width = t.preloadImg.width;
-                       f.height.value = t.height = t.preloadImg.height;
-               }
-
-               t.showSizeSet();
-               t.demoSetSize();
-               if ( f.img_style.value )
-                       t.demoSetStyle();
-       },
-
-       getImageData : function() {
-               var t = wpImage, f = document.forms[0];
-
-               t.preloadImg = new Image();
-               t.preloadImg.onload = t.updateImageData;
-               t.preloadImg.onerror = t.resetImageData;
-               t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
-       }
-};
-
-window.onload = function(){wpImage.init();}
-wpImage.preInit();
+var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.dom=d.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this,b=a.getWin();function c(){b.tb_remove();tinymce=tinyMCE=a.editor=a.dom=a.dom.doc=null}if(tinymce.isOpera){b.setTimeout(c,0)}else{c()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var d=tinyMCEPopup.getWin(),c=d.document.styleSheets,a,b;for(b=0;b<c.length;b++){a=c.item(b).href;if(a&&a.indexOf("colors")!=-1){document.write('<link rel="stylesheet" href="'+a+'" type="text/css" media="all" />')}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||"s100";size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var p=this,k,b,l,e,i=document.forms[0],h=tinyMCEPopup.editor,j=p.I("img_demo"),g=tinyMCEPopup.dom,a,o="",n,m;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){p.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!="IMG"){return}i.img_src.value=j.src=l=h.dom.getAttrib(b,"src");h.dom.setStyle(b,"float","");p.getImageData();k=h.dom.getAttrib(b,"class");if(a=g.getParent(b,"dl")){n=h.dom.getAttrib(a,"class");n=n.match(/align[^ "']+/i);if(n&&!g.hasClass(b,n)){k+=" "+n;tinymce.trim(k)}tinymce.each(a.childNodes,function(c){if(c.nodeName=="DD"&&g.hasClass(c,"wp-caption-dd")){o=c.innerHTML;return}})}i.img_cap.value=o;i.img_title.value=h.dom.getAttrib(b,"title");i.img_alt.value=h.dom.getAttrib(b,"alt");i.border.value=h.dom.getAttrib(b,"border");i.vspace.value=h.dom.getAttrib(b,"vspace");i.hspace.value=h.dom.getAttrib(b,"hspace");i.align.value=h.dom.getAttrib(b,"align");i.width.value=p.width=h.dom.getAttrib(b,"width");i.height.value=p.height=h.dom.getAttrib(b,"height");i.img_classes.value=k;i.img_style.value=h.dom.getAttrib(b,"style");if(g.getAttrib(b,"hspace")){p.updateStyle("hspace")}if(g.getAttrib(b,"border")){p.updateStyle("border")}if(g.getAttrib(b,"vspace")){p.updateStyle("vspace")}if(m=h.dom.getParent(b,"A")){i.link_href.value=p.current=h.dom.getAttrib(m,"href");i.link_title.value=h.dom.getAttrib(m,"title");i.link_rel.value=p.link_rel=h.dom.getAttrib(m,"rel");i.link_style.value=h.dom.getAttrib(m,"style");p.target_value=h.dom.getAttrib(m,"target");i.link_classes.value=h.dom.getAttrib(m,"class")}i.link_target.checked=(p.target_value&&p.target_value=="_blank")?"checked":"";e=l.substring(l.lastIndexOf("/"));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,"");p.link=l.substring(0,l.lastIndexOf("/"))+e;if(k.indexOf("alignleft")!=-1){p.I("alignleft").checked="checked";j.className=p.align="alignleft"}else{if(k.indexOf("aligncenter")!=-1){p.I("aligncenter").checked="checked";j.className=p.align="aligncenter"}else{if(k.indexOf("alignright")!=-1){p.I("alignright").checked="checked";j.className=p.align="alignright"}else{if(k.indexOf("alignnone")!=-1){p.I("alignnone").checked="checked";j.className=p.align="alignnone"}}}}if(p.width&&p.preloadImg.width){p.showSizeSet()}document.body.style.display=""},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!="IMG"){return}if((c=a.dom.getParent(b,"div"))&&a.dom.hasClass(c,"mceTemp")){a.dom.remove(c)}else{if((c=a.dom.getParent(b,"A"))&&c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand("mceRepaint");tinyMCEPopup.close();return},update:function(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u="",j,i,s,a,z,w="",c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!="IMG"){return}if(v.img_src.value===""){m.remove();return}if(v.img_cap.value!=""&&v.width.value!=""){o=1;k=k.replace(/align[^ "']+\s?/gi,"")}p=g.dom.getParent(e,"a");h=g.dom.getParent(e,"p");n=g.dom.getParent(e,"dl");r=g.dom.getParent(e,"div");tinyMCEPopup.execCommand("mceBeginUndoLevel");g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,"class":k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&&g.dom.hasClass(e,"aligncenter")){g.dom.removeClass(e,"aligncenter");d=1}tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});if(d){g.dom.addClass(e,"aligncenter")}tinymce.each(g.dom.select("a"),function(b){if(g.dom.getAttrib(b,"href")=="#mce_temp_url#"){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";if(n){g.dom.setAttribs(n,{"class":"wp-caption "+m.align,style:"width: "+a+"px;"});if(r){g.dom.setAttrib(r,"class",z)}if((i=g.dom.getParent(e,"dt"))&&(s=i.nextSibling)&&g.dom.hasClass(s,"wp-caption-dd")){g.dom.setHTML(s,v.img_cap.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&&q[1]){u="attachment_"+q[1]}if(v.link_href.value&&(w=g.dom.getParent(e,"a"))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/<a[^>]+>/i);l=l+g.dom.getOuterHTML(e)+"</a>"}}else{l=g.dom.getOuterHTML(e)}l='<dl id="'+u+'" class="wp-caption '+m.align+'" style="width: '+a+'px"><dt class="wp-caption-dt">'+l+'</dt><dd class="wp-caption-dd">'+v.img_cap.value+"</dd></dl>";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
\ No newline at end of file
index a946f9af1b350023b3c6d1eaf02e35ec8a083dd3..6d152ea7d66d3eabac0ead4aa332e68c27069cfd 100644 (file)
@@ -128,7 +128,7 @@ wp_admin_css( 'wp-admin', true );
                border-bottom: 0px;
        }
 </style>
-<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
+<?php if ( is_rtl() ) : ?>
 <style type="text/css">
        #wphead, #tabs {
                padding-left: auto;
@@ -210,10 +210,10 @@ wp_admin_css( 'wp-admin', true );
                <script type="text/javascript">
                if ( ! tinymce.isWebKit )
                        document.write("<tr><th>b</th><td><?php _e('Bold') ?></td><th>i</th><td><?php _e('Italic') ?></td></tr>"+
-                       "<tr><th>u</th><td><?php _e('Underline') ?></td><th>1</th><td><?php _e('Header 1') ?></td></tr>"+
-                       "<tr><th>2</th><td><?php _e('Header 2') ?></td><th>3</th><td><?php _e('Header 3') ?></td></tr>"+
-                       "<tr><th>4</th><td><?php _e('Header 4') ?></td><th>5</th><td><?php _e('Header 5') ?></td></tr>"+
-                       "<tr><th>6</th><td><?php _e('Header 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>")
+                       "<tr><th>u</th><td><?php _e('Underline') ?></td><th>1</th><td><?php _e('Heading 1') ?></td></tr>"+
+                       "<tr><th>2</th><td><?php _e('Heading 2') ?></td><th>3</th><td><?php _e('Heading 3') ?></td></tr>"+
+                       "<tr><th>4</th><td><?php _e('Heading 4') ?></td><th>5</th><td><?php _e('Heading 5') ?></td></tr>"+
+                       "<tr><th>6</th><td><?php _e('Heading 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>")
                </script>
        </table>
 
@@ -240,7 +240,7 @@ wp_admin_css( 'wp-admin', true );
        <h2><?php _e('About TinyMCE'); ?></h2>
 
     <p><?php _e('Version:'); ?> <span id="version"></span> (<span id="date"></span>)</p>
-       <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('url').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p>
+       <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.home_url('/wp-includes/js/tinymce/license.txt').'" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p>
        <p><?php _e('Copyright &copy; 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.') ?></p>
        <p><?php _e('For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.') ?></p>
 
diff --git a/wp-includes/js/tinymce/wp-tinymce.js b/wp-includes/js/tinymce/wp-tinymce.js
deleted file mode 100644 (file)
index 58c14ca..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-//core
-var tinymce={majorVersion:"3",minorVersion:"2.7",releaseDate:"2009-09-22",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1&&o.baseURL.indexOf("/")!==0){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about|data):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},getNext:function(g,f){return this._findSib(g,f,"nextSibling")},getPrev:function(g,f){return this._findSib(g,f,"previousSibling")},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(j)){if(i[g.props[j]]===true&&f===""){return j}return f?j:""}if(i.nodeName==="FORM"&&i.getAttributeNode(j)){return i.getAttributeNode(j).nodeValue}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/ig,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings,k=[];if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|noscript|style/i.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi,function(h,m,l){if(!m){m=' type="text/javascript"'}m=m.replace(/src=\"([^\"]+)\"?/i,function(n,o){if(i.url_converter){o=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(o),"src","script"))}return'mce_src="'+o+'"'});if(c.trim(l)){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n// -->"}return"<mce:script"+m+">"+l+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi,function(h,m,l){if(l){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n-->"}return"<mce:style"+m+">"+l+"</mce:style><style "+m+' mce_bogus="1">'+l+"</style>"});j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,m,l){return"<mce:noscript"+m+"><!--"+g.encode(l).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi,function(l){function h(o,m,n){if(n==="false"||n==="0"){return""}return" "+m+'="'+m+'"'}l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi,' $1="$1"$2');return l});j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,m){function l(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}p=g.encode(g.serializeStyle(g.parseStyle(p)))}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,m))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,l);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,l);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,l)});j=j.replace(/MCE_SCRIPT:([0-9]+)/g,function(l,h){return k[h]})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(j,g,k){var f=this;function i(m,l,p){var q,o;o=p.createElement("body");o.innerHTML=l;q=o.lastChild;while(q){f.insertAfter(q.cloneNode(true),m);q=q.previousSibling}f.remove(m)}return this.run(j,function(l){l=f.get(l);if(l.nodeType==1){k=k||l.ownerDocument||f.doc;if(a){try{if(a&&l.nodeType==1){l.outerHTML=g}else{i(l,g,k)}}catch(h){i(l,g,k)}}else{i(l,g,k)}}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TH|TBODY|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}if(g.nodeName==="OPTION"&&this.getAttrib(g,"selected")){f.push({specified:1,nodeName:"selected"})}g.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi,"").replace(/[\w:]+/gi,function(h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(l,k,o){var p=this,f=p.createRng(),m,j,n;function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r[q])}}function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q=q.replace(/<[^>]+>/g,"");return q.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}return q}if(l&&k){f.setStart(l.parentNode,h(l));f.setEnd(k.parentNode,h(k));m=f.extractContents();f=p.createRng();f.setStart(k.parentNode,h(k)+1);f.setEnd(l.parentNode,h(l)+1);j=f.extractContents();n=l.parentNode;g(m,"lastChild");if(!i(m)){n.insertBefore(m,l)}if(o){n.replaceChild(o,k)}else{n.insertBefore(k,l)}g(j,"firstChild");if(!i(j)){n.insertBefore(j,l)}p.remove(l);return o||k}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_findSib:function(j,g,h){var i=this,k=g;if(j){if(b(k,"string")){k=function(f){return i.is(f,g)}}for(j=j[h];j;j=j[h]){if(k(j)){return j}}}return null},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o=m.createTextRange();o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){o.tridentSel.destroy();if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){if(!e.isOpera||opera.buildNumber()>=1767){f(i.dom.select("p table",l.node).reverse(),function(p){var o=i.dom.getParent(p.parentNode,"table,p");if(o.nodeName!="TABLE"){try{i.dom.split(o,p)}catch(m){}}})}})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(r,q){var m,k=this,p,i,j,l;k._setup();q=q||{};q.format=q.format||"html";k.processObj=q;if(d){l=[];f(r.getElementsByTagName("option"),function(o){var h=k.dom.getAttrib(o,"selected");l.push(h?h:null)})}r=r.cloneNode(true);if(d){f(r.getElementsByTagName("option"),function(o,h){k.dom.setAttrib(o,"selected",l[h])})}j=r.ownerDocument.implementation;if(j.createHTMLDocument&&(e.isOpera&&opera.buildNumber()>=1767)){p=j.createHTMLDocument("");f(r.nodeName=="BODY"?r.childNodes:[r],function(h){p.body.appendChild(p.importNode(h,true))});if(r.nodeName!="BODY"){r=p.body.firstChild}else{r=p.body}i=k.dom.doc;k.dom.doc=p}k.key=""+(parseInt(k.key)+1);if(!q.no_events){q.node=r;k.onPreProcess.dispatch(k,q)}k.writer.reset();k._serializeNode(r,q.getInner);q.content=k.writer.getContent();if(i){k.dom.doc=i}if(!q.no_events){k.onPostProcess.dispatch(k,q)}k._postProcess(q);q.node=null;return e.trim(q.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){i._setActive(null);g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.isNotDirty=false;q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-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|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(G.document_base_url!=n.documentBaseURL){F.iframeHTML+='<base href="'+F.documentBaseURI.getURI()+'" />'}F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.dom.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer(f(A,{valid_elements:A.verify_html===false?"*[*]":A.valid_elements,dom:z.dom}));z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(i){var h,c,a,b,g,f;h=i.dom.Event;c=i.isIE;a=i.isGecko;b=i.isOpera;g=i.each;f=i.extend;function e(k,l){var j=l.ownerDocument.createRange();j.setStart(k.endContainer,k.endOffset);j.setEndAfter(l);return j.cloneContents().textContent.length==0}function d(j){j=j.innerHTML;j=j.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");j=j.replace(/<[^>]+>/g,"");return j.replace(/[ \t\r\n]+/g,"")==""}i.create("tinymce.ForceBlocks",{ForceBlocks:function(k){var l=this,m=k.settings,n;l.editor=k;l.dom=k.dom;n=(m.forced_root_block||"p").toLowerCase();m.element=n.toUpperCase();k.onPreInit.add(l.setup,l);l.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+n+">","gi");l.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,n),"gi");l.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,n),"gi");function j(p,q){if(b){q.content=q.content.replace(l.reOpera,"</"+n+">")}q.content=q.content.replace(l.rePadd,"<"+n+"$1$2$3$4$5$6>\u00a0</"+n+">");if(!c&&!b&&q.set){q.content=q.content.replace(l.reNbsp2BR1,"<"+n+"$1$2><br /></"+n+">");q.content=q.content.replace(l.reNbsp2BR2,"<"+n+"$1$2><br /></"+n+">")}else{q.content=q.content.replace(l.reBR2Nbsp,"<"+n+"$1$2>\u00a0</"+n+">")}}k.onBeforeSetContent.add(j);k.onPostProcess.add(j);if(m.forced_root_block){k.onInit.add(l.forceRoots,l);k.onSetContent.add(l.forceRoots,l);k.onBeforeGetContent.add(l.forceRoots,l)}},setup:function(){var k=this,j=k.editor,l=j.settings;if(l.forced_root_block){j.onKeyUp.add(k.forceRoots,k);j.onPreProcess.add(k.forceRoots,k)}if(l.force_br_newlines){if(c){j.onKeyPress.add(function(o,q){var r,p=o.selection;if(q.keyCode==13&&p.getNode().nodeName!="LI"){p.setContent('<br id="__" /> ',{format:"raw"});r=o.dom.get("__");r.removeAttribute("id");p.select(r);p.collapse();return h.cancel(q)}})}return}if(!c&&l.force_p_newlines){j.onKeyPress.add(function(n,o){if(o.keyCode==13&&!o.shiftKey){if(!k.insertPara(o)){h.cancel(o)}}});if(a){j.onKeyDown.add(function(n,o){if((o.keyCode==8||o.keyCode==46)&&!o.shiftKey){k.backspaceDelete(o,o.keyCode==8)}})}}function m(o,n){var p=j.dom.create(n);g(o.attributes,function(q){if(q.specified&&q.nodeValue){p.setAttribute(q.nodeName.toLowerCase(),q.nodeValue)}});g(o.childNodes,function(q){p.appendChild(q.cloneNode(true))});o.parentNode.replaceChild(p,o);return p}j.onPreProcess.add(function(n,p){g(n.dom.select("p,h1,h2,h3,h4,h5,h6,div",p.node),function(o){if(d(o)){g(n.dom.select("span,em,strong,b,i",p.node),function(q){if(!q.hasChildNodes()){q.appendChild(n.getDoc().createTextNode("\u00a0"));return false}})}})});if(c){if(l.element!="P"){j.onKeyPress.add(function(n,o){k.lastElm=n.selection.getNode().nodeName});j.onKeyUp.add(function(p,r){var t,q=p.selection,s=q.getNode(),o=p.getBody();if(o.childNodes.length===1&&s.nodeName=="P"){s=m(s,l.element);q.select(s);q.collapse();p.nodeChanged()}else{if(r.keyCode==13&&!r.shiftKey&&k.lastElm!="P"){t=p.dom.getParent(s,"p");if(t){m(t,l.element);p.nodeChanged()}}}})}}},find:function(p,l,m){var k=this.editor,j=k.getDoc().createTreeWalker(p,4,null,false),o=-1;while(p=j.nextNode()){o++;if(l==0&&p==m){return o}if(l==1&&o==m){return p}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType===3||(!u.dom.isBlock(G)&&G.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(G.nodeName))){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!c){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(n){return n===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);G.parentNode.replaceChild(l,G);l.appendChild(G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!c){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!c&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(k){var j=this.dom;return j.getParent(k,j.isBlock)},insertPara:function(N){var B=this,p=B.editor,J=p.dom,O=p.getDoc(),S=p.settings,C=p.selection.getSel(),D=C.getRangeAt(0),R=O.body;var G,H,E,L,K,m,k,o,u,j,z,Q,l,q,F,I=J.getViewPort(p.getWin()),x,A,w;G=O.createRange();G.setStart(C.anchorNode,C.anchorOffset);G.collapse(true);H=O.createRange();H.setStart(C.focusNode,C.focusOffset);H.collapse(true);E=G.compareBoundaryPoints(G.START_TO_END,H)<0;L=E?C.anchorNode:C.focusNode;K=E?C.anchorOffset:C.focusOffset;m=E?C.focusNode:C.anchorNode;k=E?C.focusOffset:C.anchorOffset;if(L===m&&/^(TD|TH)$/.test(L.nodeName)){if(L.firstChild.nodeName=="BR"){J.remove(L.firstChild)}if(L.childNodes.length==0){p.dom.add(L,S.element,null,"<br />");Q=p.dom.add(L,S.element,null,"<br />")}else{F=L.innerHTML;L.innerHTML="";p.dom.add(L,S.element,null,F);Q=p.dom.add(L,S.element,null,"<br />")}D=O.createRange();D.selectNodeContents(Q);D.collapse(1);p.selection.setRng(D);return false}if(L==R&&m==R&&R.firstChild&&p.dom.isBlock(R.firstChild)){L=m=L.firstChild;K=k=0;G=O.createRange();G.setStart(L,0);H=O.createRange();H.setStart(m,0)}L=L.nodeName=="HTML"?O.body:L;L=L.nodeName=="BODY"?L.firstChild:L;m=m.nodeName=="HTML"?O.body:m;m=m.nodeName=="BODY"?m.firstChild:m;o=B.getParentBlock(L);u=B.getParentBlock(m);j=o?o.nodeName:S.element;if(B.dom.getParent(o,"ol,ul,pre")){return true}if(o&&(o.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;o=null}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;u=null}if(/(TD|TABLE|TH|CAPTION)/.test(j)||(o&&j=="DIV"&&/left|right/gi.test(J.getStyle(o,"float",1)))){j=S.element;o=u=null}z=(o&&o.nodeName==j)?o.cloneNode(0):p.dom.create(j);Q=(u&&u.nodeName==j)?u.cloneNode(0):p.dom.create(j);Q.removeAttribute("id");if(/^(H[1-6])$/.test(j)&&e(D,o)){Q=p.dom.create(S.element)}F=l=L;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}l=F}while((F=F.previousSibling?F.previousSibling:F.parentNode));F=q=m;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}q=F}while((F=F.nextSibling?F.nextSibling:F.parentNode));if(l.nodeName==j){G.setStart(l,0)}else{G.setStartBefore(l)}G.setEnd(L,K);z.appendChild(G.cloneContents()||O.createTextNode(""));try{H.setEndAfter(q)}catch(M){}H.setStart(m,k);Q.appendChild(H.cloneContents()||O.createTextNode(""));D=O.createRange();if(!l.previousSibling&&l.parentNode.nodeName==j){D.setStartBefore(l.parentNode)}else{if(G.startContainer.nodeName==j&&G.startOffset==0){D.setStartBefore(G.startContainer)}else{D.setStart(G.startContainer,G.startOffset)}}if(!q.nextSibling&&q.parentNode.nodeName==j){D.setEndAfter(q.parentNode)}else{D.setEnd(H.endContainer,H.endOffset)}D.deleteContents();if(b){p.getWin().scrollTo(0,I.y)}if(z.firstChild&&z.firstChild.nodeName==j){z.innerHTML=z.firstChild.innerHTML}if(Q.firstChild&&Q.firstChild.nodeName==j){Q.innerHTML=Q.firstChild.innerHTML}if(d(z)){z.innerHTML="<br />"}function P(y,s){var r=[],U,T,t;y.innerHTML="";if(S.keep_styles){T=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(T.nodeName)){U=T.cloneNode(false);J.setAttrib(U,"id","");r.push(U)}}while(T=T.parentNode)}if(r.length>0){for(t=r.length-1,U=y;t>=0;t--){U=U.appendChild(r[t])}r[0].innerHTML=b?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=b?"&nbsp;":"<br />"}}if(d(Q)){w=P(Q,m)}if(b&&parseFloat(opera.version())<9.5){D.insertNode(z);D.insertNode(Q)}else{D.insertNode(Q);D.insertNode(z)}Q.normalize();z.normalize();function v(r){return O.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}D=O.createRange();D.selectNodeContents(a?v(w||Q):w||Q);D.collapse(1);C.removeAllRanges();C.addRange(D);x=p.dom.getPos(Q).y;A=Q.clientHeight;if(x<I.y||x+A>I.y+I.h){p.getWin().scrollTo(0,x<I.y?x:x-I.h+25)}return false},backspaceDelete:function(o,x){var z=this,m=z.editor,s=m.getBody(),l=m.dom,k,p=m.selection,j=p.getRng(),q=j.startContainer,k,u,v;if(q&&m.dom.isBlock(q)&&!/^(TD|TH)$/.test(q.nodeName)&&x){if(q.childNodes.length==0||(q.childNodes.length==1&&q.firstChild.nodeName=="BR")){k=q;while((k=k.previousSibling)&&!m.dom.isBlock(k)){}if(k){if(q!=s.firstChild){u=m.dom.doc.createTreeWalker(k,NodeFilter.SHOW_TEXT,null,false);while(v=u.nextNode()){k=v}j=m.getDoc().createRange();j.setStart(k,k.nodeValue?k.nodeValue.length:0);j.setEnd(k,k.nodeValue?k.nodeValue.length:0);p.setRng(j);m.dom.remove(q)}return h.cancel(o)}}}function y(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(k=z.getParentBlock(n))){r=n.previousSibling;h.remove(s,"DOMNodeInserted",y);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){m.dom.remove(n)}}}h._add(s,"DOMNodeInserted",y);window.setTimeout(function(){h._remove(s,"DOMNodeInserted",y)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandEnabled(b)){throw"Error"}}catch(d){if(a.isGecko){c.windowManager.confirm(c.getLang("clipboard_msg"),function(f){if(f){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{c.windowManager.alert(c.getLang("clipboard_no_support"))}}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})();
-// advanced/editor_template.js
-(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
-// plugins/directionality
-(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
-// plugins/fullscreen
-(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();tinyMCE.add(e.fullscreenEditor);e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var j=tinymce.DOM.getViewPort();e.fullscreenEditor.theme.resizeTo(j.w,j.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
-// plugins/inlinepopups
-(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
-// plugins/media
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme&&b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality","data"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}if(!f.src){f.src=f.data;delete f.data}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
-// plugins/paste
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var h=c.dom;e.onPreProcess.dispatch(e,i);i.node=h.create("div",0,i.content);e.onPostProcess.dispatch(e,i);i.content=c.serializer.serialize(i.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(i.content)){e._insertBlockContent(c,h,i.content)}else{e._insert(i.content)}}c.addCommand("mceInsertClipboardContent",function(h,i){g(i)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"\uFEFF");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);if(p.innerHTML==="\uFEFF"){c.execCommand("mcePasteWord");l.preventDefault();return}g({content:p.innerHTML});return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var q="",n=o.select("div[id=_mcePaste]");a(n,function(r){q+=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML});a(n,function(r){o.remove(r)});if(k){j.setRng(k)}g({content:q})},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,i){var b=this.editor,c=i.content,g,f;function g(h){a(h,function(j){if(j.constructor==RegExp){c=c.replace(j,"")}else{c=c.replace(j[0],j[1])}})}if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)||i.wordContent){i.wordContent=true;g([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(b.getParam("paste_convert_middot_lists",true)){g([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}g([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){g([/<\/?(span)[^>]*>/gi])}}f=b.getParam("paste_strip_class_attributes");if(f!="none"){function e(l,h){var k,j="";if(f=="all"){return""}h=tinymce.explode(h," ");for(k=h.length-1;k>=0;k--){if(!/^(Mso)/i.test(h[k])){j+=(!j?"":" ")+h[k]}}return' class="'+j+'"'}g([[/ class=\"([^\"]*)\"/gi,e],[/ class=(\w+)/gi,e]])}if(b.getParam("paste_remove_spans")){g([/<\/?(span)[^>]*>/gi])}i.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(c&&!/TD|TH/.test(c.nodeName)){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
-// plugins/safari
-(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('<p><br mce_bogus="1" /></p>',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'<span id="_mce_tmp">XX</span>');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,"</$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})();
-// plugins/spellchecker
-(function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:tinymce.majorVersion+"."+tinymce.minorVersion};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c');for(i=0;i<str.length;i++)re+='\\'+str.charAt(i);return re;},_getWords:function(){var ed=this.editor,wl=[],tx='',lo={};this._walk(ed.getBody(),function(n){if(n.nodeType==3)tx+=n.nodeValue+' ';});tx=tx.replace(new RegExp('([0-9]|['+this._getSeparators()+'])','g'),' ');tx=tinymce.trim(tx.replace(/(\s+)/g,' '));each(tx.split(' '),function(v){if(!lo[v]){wl.push(v);lo[v]=1;}});return wl;},_removeWords:function(w){var ed=this.editor,dom=ed.dom,se=ed.selection,b=se.getBookmark();each(dom.select('span').reverse(),function(n){if(n&&(dom.hasClass(n,'mceItemHiddenSpellWord')||dom.hasClass(n,'mceItemHidden'))){if(!w||dom.decode(n.innerHTML)==w)dom.remove(n,1);}});se.moveToBookmark(b);},_markWords:function(wl){var r1,r2,r3,r4,r5,w='',ed=this.editor,re=this._getSeparators(),dom=ed.dom,nl=[];var se=ed.selection,b=se.getBookmark();each(wl,function(v){w+=(w?'|':'')+v;});r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');this._walk(this.editor.getBody(),function(n){if(n.nodeType==3){nl.push(n);}});each(nl,function(n){var v;if(n.nodeType==3){v=n.nodeValue;if(r1.test(v)||r2.test(v)||r3.test(v)||r4.test(v)){v=dom.encode(v);v=v.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');v=v.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})();
-// plugins/tabfocus
-(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
-// plugins/wordpress
-(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{mceTout:0,init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f='<img src="'+d+'/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam("wordpress_adv_hidden",1)&&i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var i=c.controlManager,j=i.get(h).id;if("undefined"==j){return}if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(i,l,k,m){var j=tinymce.DOM;if("mceFullScreen"!=l){return}if("mce_fullscreen"!=i.id&&j.get("add_audio")&&j.get("add_video")&&j.get("add_image")&&j.get("add_media")){i.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}});c.addCommand("JustifyLeft",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyLeft","left")}else{c.plugins.wordpress.do_align(i,"alignleft")}});c.addCommand("JustifyRight",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyRight","right")}else{c.plugins.wordpress.do_align(i,"alignright")}});c.addCommand("JustifyCenter",function(){var k=c.selection.getNode(),j=c.dom.getParent(k,"p"),i=c.dom.getParent(k,"dl");if(k.nodeName=="IMG"&&(j||i)){c.plugins.wordpress.do_align(k,"aligncenter")}else{c.editorCommands.mceJustify("JustifyCenter","center")}});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)=="object"){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),"scroll",function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),"dragstart",function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!="IMG"){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return'<img width="300" height="200" src="'+tinymce.baseURL+'/plugins/wordpress/img/trans.gif" class="wp-oembed mceItemNoResize" alt="'+c+'" title="'+c+'" />'})},_getEmbed:function(b){return b.replace(/<img[^>]+>/g,function(c){if(c.indexOf('class="wp-oembed')!=-1){var d=c.match(/alt="([^\"]+)"/);if(d[1]){c="[embed]"+d[1]+"[/embed]"}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+"px",left:e+5+"px",display:"block"});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById("wp_editbtns")){tinymce.DOM.hide("wp_editbtns")}if(document.getElementById("wp_gallerybtns")){tinymce.DOM.hide("wp_gallerybtns")}clearTimeout(this.mceTout);this.mceTout=0},do_align:function(j,d){var h,f,g,b,i,e=tinyMCE.activeEditor;if(/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(j.className)){return}h=e.dom.getParent(j,"p");f=e.dom.getParent(j,"dl");g=e.dom.getParent(j,"div");if(f&&g){b=e.dom.hasClass(f,d)?"alignnone":d;f.className=f.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(f,b);i=(b=="aligncenter")?e.dom.addClass(g,"mceIEcenter"):e.dom.removeClass(g,"mceIEcenter")}else{if(h){b=e.dom.hasClass(j,d)?"alignnone":d;j.className=j.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(j,b);if(b=="aligncenter"){e.dom.setStyle(h,"textAlign","center")}else{if(h.style&&h.style.textAlign=="center"){e.dom.setStyle(h,"textAlign","")}}}}e.execCommand("mceRepaint")},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='<img src="'+d+'/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){g.content=g.content.replace(/<!--more(.*?)-->/g,e);g.content=g.content.replace(/<!--nextpage-->/g,b)});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i="<!--more"+j+"-->"}if(i.indexOf('class="mceWPnextpage')!==-1){i="<!--nextpage-->"}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})();
-// plugins/wpeditimage
-(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&d.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(d,f){if(tinymce.isWebKit||tinymce.isOpera){return}if(d.dom.getParent(f.target,"div.mceTemp")||d.dom.is(f.target,"div.mceTemp")){window.setTimeout(function(){var e=tinyMCE.activeEditor,h=e.selection.getNode(),g=e.dom.getParent(h,"dl.wp-caption");if(g&&h.width!=(parseInt(e.dom.getStyle(g,"width"),10)-10)){e.dom.setStyle(g,"width",parseInt(h.width,10)+10);e.execCommand("mceRepaint")}},100)}});a.onMouseDown.add(function(d,g){var f;if(g.target.nodeName=="IMG"&&d.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){d.plugins.wordpress._showButtons(g.target,"wp_editbtns");if(tinymce.isGecko&&(f=d.dom.getParent(g.target,"dl.wp-caption"))&&d.dom.hasClass(f.parentNode,"mceTemp")){d.selection.select(f.parentNode)}}});a.onKeyPress.add(function(d,i){var f,h,g;if(i.keyCode==13&&(f=d.dom.getParent(d.selection.getNode(),"DL"))&&d.dom.hasClass(f,"wp-caption")){g=d.dom.create("p",{},"&nbsp;");if((h=f.parentNode)&&h.nodeName=="DIV"){d.dom.insertAfter(g,h)}else{d.dom.insertAfter(g,f)}if(g.firstChild){d.selection.select(g.firstChild)}else{d.selection.select(g)}tinymce.dom.Event.cancel(i);return false}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
-// plugins/wpgallery
-(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onMouseDown.add(function(d,f){if(f.target.nodeName=="IMG"&&d.dom.hasClass(f.target,"wpGallery")){d.plugins.wordpress._showButtons(f.target,"wp_gallerybtns")}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_gallerybtns");d.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});e=d.add("wp_gallerybtns","img",{src:b.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:a.getLang("wordpress.editgallery")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_Gallery")});c=d.add("wp_gallerybtns","img",{src:b.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:a.getLang("wordpress.delgallery")});tinymce.dom.Event.add(c,"mousedown",function(h){var f=tinyMCE.activeEditor,g=f.selection.getNode();if(g.nodeName=="IMG"&&f.dom.hasClass(g,"wpGallery")){f.dom.remove(g);f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
-// mark as loaded
-tinyMCEPreInit.go=function(){var b=this,a=tinymce.ScriptLoader,f=b.mceInit.language,e=b.mceInit.theme,c=b.mceInit.plugins,d=b.suffix;a.markDone(b.base+"/langs/"+f+".js");a.markDone(b.base+"/themes/"+e+"/editor_template"+d+".js");a.markDone(b.base+"/themes/"+e+"/langs/"+f+".js");a.markDone(b.base+"/themes/"+e+"/langs/"+f+"_dlg.js");tinymce.each(c.split(","),function(g){if(g&&g.charAt(0)!="-"){a.markDone(b.base+"/plugins/"+g+"/editor_plugin"+d+".js");a.markDone(b.base+"/plugins/"+g+"/langs/"+f+".js");a.markDone(b.base+"/plugins/"+g+"/langs/"+f+"_dlg.js")}})};
index b2ef19d4454276fc3073c5b122423f68d5afce3d..02be3f20f357f03d6e753f9f976b6a7c422685db 100644 (file)
@@ -32,6 +32,6 @@ if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODIN
        header('Content-Encoding: gzip');
        echo $file;
 } else {
-       echo get_file($basepath . '/wp-tinymce.js');
+       echo get_file($basepath . '/tiny_mce.js');
 }
 exit;
diff --git a/wp-includes/js/wp-list-revisions.dev.js b/wp-includes/js/wp-list-revisions.dev.js
new file mode 100644 (file)
index 0000000..9c702c6
--- /dev/null
@@ -0,0 +1,24 @@
+(function(w) {
+       var init = function() {
+               var pr = document.getElementById('post-revisions'),
+               inputs = pr ? pr.getElementsByTagName('input') : [];
+               pr.onclick = function() {
+                       var i, checkCount = 0, side;
+                       for ( i = 0; i < inputs.length; i++ ) {
+                               checkCount += inputs[i].checked ? 1 : 0;
+                               side = inputs[i].getAttribute('name');
+                               if ( ! inputs[i].checked &&
+                               ( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &&
+                               ! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) )
+                                       inputs[i].style.visibility = 'hidden';
+                               else if ( 'left' == side || 'right' == side )
+                                       inputs[i].style.visibility = 'visible';
+                       }
+               }
+               pr.onclick();
+       }
+       if ( w && w.addEventListener )
+               w.addEventListener('load', init, false);
+       else if ( w && w.attachEvent )
+               w.attachEvent('onload', init);
+})(window);
diff --git a/wp-includes/js/wp-list-revisions.js b/wp-includes/js/wp-list-revisions.js
new file mode 100644 (file)
index 0000000..417572d
--- /dev/null
@@ -0,0 +1 @@
+(function(a){var b=function(){var d=document.getElementById("post-revisions"),c=d?d.getElementsByTagName("input"):[];d.onclick=function(){var g,f=0,e;for(g=0;g<c.length;g++){f+=c[g].checked?1:0;e=c[g].getAttribute("name");if(!c[g].checked&&("left"==e&&1>f||"right"==e&&1<f&&(!c[g-1]||!c[g-1].checked))&&!(c[g+1]&&c[g+1].checked&&"right"==c[g+1].getAttribute("name"))){c[g].style.visibility="hidden"}else{if("left"==e||"right"==e){c[g].style.visibility="visible"}}}};d.onclick()};if(a&&a.addEventListener){a.addEventListener("load",b,false)}else{if(a&&a.attachEvent){a.attachEvent("onload",b)}}})(window);
\ No newline at end of file
index 56176b4684cb26144ec42be5d5b3e7b45e834be4..8eb046df6a1b9673a1907ec715cddf2f1366a8f6 100644 (file)
  */
 
 /**
- * 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 a plugin.
  *
  * @since 1.2.0
  */
-if (!defined('CUSTOM_TAGS'))
-       define('CUSTOM_TAGS', false);
+if ( ! defined( 'CUSTOM_TAGS' ) )
+       define( 'CUSTOM_TAGS', false );
 
-if (!CUSTOM_TAGS) {
+if ( ! CUSTOM_TAGS ) {
        /**
         * Kses global for default allowable HTML tags.
         *
@@ -57,6 +56,22 @@ if (!CUSTOM_TAGS) {
                        'title' => array ()),
                'acronym' => array(
                        'title' => array ()),
+               'article' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
+               'aside' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'b' => array(),
                'big' => array(),
                'blockquote' => array(
@@ -94,6 +109,15 @@ if (!CUSTOM_TAGS) {
                'del' => array(
                        'datetime' => array ()),
                'dd' => array(),
+               'details' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'open' => array (),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'div' => array(
                        'align' => array (),
                        'class' => array (),
@@ -105,10 +129,34 @@ if (!CUSTOM_TAGS) {
                'dt' => array(),
                'em' => array(),
                'fieldset' => array(),
+               'figure' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
+               'figcaption' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'font' => array(
                        'color' => array (),
                        'face' => array (),
                        'size' => array ()),
+               'footer' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'form' => array(
                        'action' => array (),
                        'accept' => array (),
@@ -147,6 +195,22 @@ if (!CUSTOM_TAGS) {
                        'class' => array (),
                        'id'    => array (),
                        'style' => array ()),
+               'header' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
+               'hgroup' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'hr' => array (
                        'align' => array (),
                        'class' => array (),
@@ -177,6 +241,18 @@ if (!CUSTOM_TAGS) {
                'li' => array (
                        'align' => array (),
                        'class' => array ()),
+               'menu' => array (
+                       'class' => array (),
+                       'style' => array (),
+                       'type' => array ()),
+               'nav' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'p' => array(
                        'class' => array (),
                        'align' => array (),
@@ -198,9 +274,25 @@ if (!CUSTOM_TAGS) {
                        'style' => array (),
                        'title' => array (),
                        'xml:lang' => array()),
+               'section' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'strike' => array(),
                'strong' => array(),
                'sub' => array(),
+               'summary' => array(
+                       'align' => array (),
+                       'class' => array (),
+                       'dir' => array (),
+                       'lang' => array(),
+                       'style' => array (),
+                       'xml:lang' => array(),
+               ),
                'sup' => array(),
                'table' => array(
                        'align' => array (),
@@ -333,6 +425,50 @@ if (!CUSTOM_TAGS) {
                //      'u' => array(),
                //      'ul' => array(),
        );
+
+       $allowedentitynames = array(
+               'nbsp',    'iexcl',  'cent',    'pound',  'curren', 'yen',
+               'brvbar',  'sect',   'uml',     'copy',   'ordf',   'laquo',
+               'not',     'shy',    'reg',     'macr',   'deg',    'plusmn',
+               'acute',   'micro',  'para',    'middot', 'cedil',  'ordm',
+               'raquo',   'iquest', 'Agrave',  'Aacute', 'Acirc',  'Atilde',
+               'Auml',    'Aring',  'AElig',   'Ccedil', 'Egrave', 'Eacute',
+               'Ecirc',   'Euml',   'Igrave',  'Iacute', 'Icirc',  'Iuml',
+               'ETH',     'Ntilde', 'Ograve',  'Oacute', 'Ocirc',  'Otilde',
+               'Ouml',    'times',  'Oslash',  'Ugrave', 'Uacute', 'Ucirc',
+               'Uuml',    'Yacute', 'THORN',   'szlig',  'agrave', 'aacute',
+               'acirc',   'atilde', 'auml',    'aring',  'aelig',  'ccedil',
+               'egrave',  'eacute', 'ecirc',   'euml',   'igrave', 'iacute',
+               'icirc',   'iuml',   'eth',     'ntilde', 'ograve', 'oacute',
+               'ocirc',   'otilde', 'ouml',    'divide', 'oslash', 'ugrave',
+               'uacute',  'ucirc',  'uuml',    'yacute', 'thorn',  'yuml',
+               'quot',    'amp',    'lt',      'gt',     'apos',   'OElig',
+               'oelig',   'Scaron', 'scaron',  'Yuml',   'circ',   'tilde',
+               'ensp',    'emsp',   'thinsp',  'zwnj',   'zwj',    'lrm',
+               'rlm',     'ndash',  'mdash',   'lsquo',  'rsquo',  'sbquo',
+               'ldquo',   'rdquo',  'bdquo',   'dagger', 'Dagger', 'permil',
+               'lsaquo',  'rsaquo', 'euro',    'fnof',   'Alpha',  'Beta',
+               'Gamma',   'Delta',  'Epsilon', 'Zeta',   'Eta',    'Theta',
+               'Iota',    'Kappa',  'Lambda',  'Mu',     'Nu',     'Xi',
+               'Omicron', 'Pi',     'Rho',     'Sigma',  'Tau',    'Upsilon',
+               'Phi',     'Chi',    'Psi',     'Omega',  'alpha',  'beta',
+               'gamma',   'delta',  'epsilon', 'zeta',   'eta',    'theta',
+               'iota',    'kappa',  'lambda',  'mu',     'nu',     'xi',
+               'omicron', 'pi',     'rho',     'sigmaf', 'sigma',  'tau',
+               'upsilon', 'phi',    'chi',     'psi',    'omega',  'thetasym',
+               'upsih',   'piv',    'bull',    'hellip', 'prime',  'Prime',
+               'oline',   'frasl',  'weierp',  'image',  'real',   'trade',
+               'alefsym', 'larr',   'uarr',    'rarr',   'darr',   'harr',
+               'crarr',   'lArr',   'uArr',    'rArr',   'dArr',   'hArr',
+               'forall',  'part',   'exist',   'empty',  'nabla',  'isin',
+               'notin',   'ni',     'prod',    'sum',    'minus',  'lowast',
+               'radic',   'prop',   'infin',   'ang',    'and',    'or',
+               'cap',     'cup',    'int',     'sim',    'cong',   'asymp',
+               'ne',      'equiv',  'le',      'ge',     'sub',    'sup',
+               'nsub',    'sube',   'supe',    'oplus',  'otimes', 'perp',
+               'sdot',    'lceil',  'rceil',   'lfloor', 'rfloor', 'lang',
+               'rang',    'loz',    'spades',  'clubs',  'hearts', 'diams',
+       );
 }
 
 /**
@@ -344,9 +480,9 @@ if (!CUSTOM_TAGS) {
  * 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.
+ * 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This
+ * covers all common link protocols, except for 'javascript' which should not
+ * be allowed for untrusted users.
  *
  * @since 1.0.0
  *
@@ -355,7 +491,8 @@ if (!CUSTOM_TAGS) {
  * @param array $allowed_protocols Optional. Allowed protocol in links.
  * @return string Filtered content with only allowed HTML elements
  */
-function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) {
+function wp_kses($string, $allowed_html, $allowed_protocols = array ()) {
+       $allowed_protocols = wp_parse_args( $allowed_protocols, apply_filters('kses_allowed_protocols', array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn') ));
        $string = wp_kses_no_null($string);
        $string = wp_kses_js_entities($string);
        $string = wp_kses_normalize_entities($string);
@@ -495,7 +632,7 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
        # Is there a closing XHTML slash at the end of the attributes?
 
        $xhtml_slash = '';
-       if (preg_match('%\s/\s*$%', $attr))
+       if (preg_match('%\s*/\s*$%', $attr))
                $xhtml_slash = ' /';
 
        # Are any attributes allowed at all for this element?
@@ -621,7 +758,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
 
                        case 2 : # attribute value, a URL after href= for instance
 
-                               if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
+                               if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match))
                                        # "value"
                                        {
                                        $thisval = $match[1];
@@ -637,7 +774,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        break;
                                }
 
-                               if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
+                               if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
                                        # 'value'
                                        {
                                        $thisval = $match[1];
@@ -653,7 +790,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        break;
                                }
 
-                               if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
+                               if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
                                        # value
                                        {
                                        $thisval = $match[1];
@@ -696,10 +833,10 @@ function wp_kses_hair($attr, $allowed_protocols) {
  * @since 1.0.0
  *
  * @param string $value Attribute value
- * @param string $vless Whether the value is valueless or not. Use 'y' or 'n'
+ * @param string $vless Whether the value is valueless. Use 'y' or 'n'
  * @param string $checkname What $checkvalue is checking for.
  * @param mixed $checkvalue What constraint the value should pass
- * @return bool Whether check passes (true) or not (false)
+ * @return bool Whether check passes
  */
 function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
        $ok = true;
@@ -908,7 +1045,7 @@ function wp_kses_bad_protocol_once2($matches) {
        global $_kses_allowed_protocols;
 
        if ( is_array($matches) ) {
-               if ( ! isset($matches[1]) || empty($matches[1]) )
+               if ( empty($matches[1]) )
                        return '';
 
                $string = $matches[1];
@@ -952,13 +1089,34 @@ 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);
-       $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);
+       $string = preg_replace_callback('/&amp;([A-Za-z]{2,8});/', 'wp_kses_named_entities', $string);
+       $string = preg_replace_callback('/&amp;#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);
+       $string = preg_replace_callback('/&amp;#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string);
 
        return $string;
 }
 
+/**
+ * Callback for wp_kses_normalize_entities() regular expression.
+ *
+ * This function only accepts valid named entity references, which are finite,
+ * case-sensitive, and highly scrutinized by HTML and XML validators.
+ *
+ * @since 3.0.0
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_named_entities($matches) {
+       global $allowedentitynames;
+
+       if ( empty($matches[1]) )
+               return '';
+
+       $i = $matches[1];
+       return ( ( ! in_array($i, $allowedentitynames) ) ? "&amp;$i;" : "&$i;" );
+}
+
 /**
  * Callback for wp_kses_normalize_entities() regular expression.
  *
@@ -972,11 +1130,18 @@ function wp_kses_normalize_entities($string) {
  * @return string Correctly encoded entity
  */
 function wp_kses_normalize_entities2($matches) {
-       if ( ! isset($matches[1]) || empty($matches[1]) )
+       if ( empty($matches[1]) )
                return '';
 
        $i = $matches[1];
-       return ( ( ! valid_unicode($i) ) || ($i > 65535) ? "&amp;#$i;" : "&#$i;" );
+       if (valid_unicode($i)) {
+               $i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT);
+               $i = "&#$i;";
+       } else {
+               $i = "&amp;#$i;";
+       }
+
+       return $i;
 }
 
 /**
@@ -991,11 +1156,11 @@ function wp_kses_normalize_entities2($matches) {
  * @return string Correctly encoded entity
  */
 function wp_kses_normalize_entities3($matches) {
-       if ( ! isset($matches[2]) || empty($matches[2]) )
+       if ( empty($matches[1]) )
                return '';
 
-       $hexchars = $matches[2];
-       return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : "&#x$hexchars;" );
+       $hexchars = $matches[1];
+       return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' );
 }
 
 /**
@@ -1196,7 +1361,15 @@ function kses_init() {
 add_action('init', 'kses_init');
 add_action('set_current_user', 'kses_init');
 
+/**
+ * Inline CSS filter
+ *
+ * @since 2.8.1
+ */
 function safecss_filter_attr( $css, $deprecated = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.8.1' ); // Never implemented
+
        $css = wp_kses_no_null($css);
        $css = str_replace(array("\n","\r","\t"), '', $css);
 
index e138c8016314fd4ede40e0fe6f93931c9013878b..8baa2ab52132050bcbf7440f55034634b9f1ea5e 100644 (file)
@@ -35,6 +35,16 @@ function get_locale() {
        if ( defined( 'WPLANG' ) )
                $locale = WPLANG;
 
+       // If multisite, check options.
+       if ( is_multisite() && !defined('WP_INSTALLING') ) {
+               $ms_locale = get_option('WPLANG');
+               if ( $ms_locale === false )
+                       $ms_locale = get_site_option('WPLANG');
+
+               if ( $ms_locale !== false )
+                       $locale = $ms_locale;
+       }
+
        if ( empty( $locale ) )
                $locale = 'en_US';
 
@@ -67,21 +77,6 @@ function before_last_bar( $string ) {
                return substr( $string, 0, $last_bar );
 }
 
-/**
- * Translates $text like translate(), but assumes that the text
- * contains a context after its last vertical bar.
- *
- * @since 2.5
- * @uses translate()
- *
- * @param string $text Text to translate
- * @param string $domain Domain to retrieve the translated text
- * @return string Translated text
- */
-function translate_with_context( $text, $domain = 'default' ) {
-       return before_last_bar( translate( $text, $domain ) );
-}
-
 function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
        $translations = &get_translations_for_domain( $domain );
        return apply_filters( 'gettext_with_context', $translations->translate( $text, $context ), $text, $context, $domain );
@@ -182,20 +177,34 @@ function esc_html_e( $text, $domain = 'default' ) {
  * found in more than two places but with different translated context.
  *
  * By including the context in the pot file translators can translate the two
- * string differently
+ * string differently.
  *
- * @since 2.8
+ * @since 2.8.0
  *
  * @param string $text Text to translate
  * @param string $context Context information for the translators
  * @param string $domain Optional. Domain to retrieve the translated text
  * @return string Translated context string without pipe
  */
-
 function _x( $single, $context, $domain = 'default' ) {
        return translate_with_gettext_context( $single, $context, $domain );
 }
 
+/**
+ * Displays translated string with gettext context
+ *
+ * @see _x
+ * @since 3.0.0
+ *
+ * @param string $text Text to translate
+ * @param string $context Context information for the translators
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated context string without pipe
+ */
+function _ex( $single, $context, $domain = 'default' ) {
+       echo _x( $single, $context, $domain );
+}
+
 function esc_attr_x( $single, $context, $domain = 'default' ) {
        return esc_attr( translate_with_gettext_context( $single, $context, $domain ) );
 }
@@ -204,12 +213,6 @@ function esc_html_x( $single, $context, $domain = 'default' ) {
        return esc_html( translate_with_gettext_context( $single, $context, $domain ) );
 }
 
-function __ngettext() {
-       _deprecated_function( __FUNCTION__, '2.8', '_n()' );
-       $args = func_get_args();
-       return call_user_func_array('_n', $args);
-}
-
 /**
  * Retrieve the plural or single form based on the amount.
  *
@@ -221,7 +224,7 @@ function __ngettext() {
  * to the 'ngettext' filter hook along with the same parameters. The expected
  * type will be a string.
  *
- * @since 1.2.0
+ * @since 2.8.0
  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
  * @uses apply_filters() Calls 'ngettext' hook on domains text returned,
  *             along with $single, $plural, and $number parameters. Expected to return string.
@@ -239,30 +242,18 @@ function _n( $single, $plural, $number, $domain = 'default' ) {
 }
 
 /**
- * @see _n() A version of _n(), which supports contexts --
- * strips everything from the translation after the last bar
+ * A hybrid of _n() and _x(). It supports contexts and plurals.
+ *
+ * @see _n()
+ * @see _x()
  *
  */
-function _nc( $single, $plural, $number, $domain = 'default' ) {
-       return before_last_bar( _n( $single, $plural, $number, $domain ) );
-}
-
 function _nx($single, $plural, $number, $context, $domain = 'default') {
        $translations = &get_translations_for_domain( $domain );
        $translation = $translations->translate_plural( $single, $plural, $number, $context );
        return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
 }
 
-/**
- * @deprecated Use _n_noop()
- */
-function __ngettext_noop() {
-       _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
-       $args = func_get_args();
-       return call_user_func_array('_n_noop', $args);
-
-}
-
 /**
  * Register plural strings in POT file, but don't translate them.
  *
@@ -296,7 +287,6 @@ function _nx_noop( $single, $plural, $context ) {
        return array( $single, $plural, $context );
 }
 
-
 /**
  * Loads a MO file into the domain $domain.
  *
@@ -315,15 +305,15 @@ function _nx_noop( $single, $plural, $context ) {
  */
 function load_textdomain( $domain, $mofile ) {
        global $l10n;
-       
+
        $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );
-       
+
        if ( true == $plugin_override ) {
                return true;
        }
-       
+
        do_action( 'load_textdomain', $domain, $mofile );
-               
+
        $mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
 
        if ( !is_readable( $mofile ) ) return false;
@@ -335,10 +325,35 @@ function load_textdomain( $domain, $mofile ) {
                $mo->merge_with( $l10n[$domain] );
 
        $l10n[$domain] = &$mo;
-       
+
        return true;
 }
 
+/**
+ * Unloads translations for a domain
+ *
+ * @since 3.0.0
+ * @param string $domain Textdomain to be unloaded
+ * @return bool Whether textdomain was unloaded
+ */
+function unload_textdomain( $domain ) {
+       global $l10n;
+
+       $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );
+
+       if ( $plugin_override )
+               return true;
+
+       do_action( 'unload_textdomain', $domain );
+
+       if ( isset( $l10n[$domain] ) ) {
+               unset( $l10n[$domain] );
+               return true;
+       }
+
+       return false;
+}
+
 /**
  * Loads default translated strings based on locale.
  *
@@ -350,9 +365,11 @@ function load_textdomain( $domain, $mofile ) {
 function load_default_textdomain() {
        $locale = get_locale();
 
-       $mofile = WP_LANG_DIR . "/$locale.mo";
+       load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );
 
-       return load_textdomain( 'default', $mofile );
+       if ( is_multisite() || ( defined( 'WP_NETWORK_ADMIN_PAGE' ) && WP_NETWORK_ADMIN_PAGE ) ) {
+               load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" );
+       }
 }
 
 /**
@@ -369,19 +386,36 @@ function load_default_textdomain() {
  * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path
  */
 function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) {
-       $locale = get_locale();
+       $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
 
-       if ( false !== $plugin_rel_path )
+       if ( false !== $plugin_rel_path ) {
                $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
-       else if ( false !== $abs_rel_path )
+       } else if ( false !== $abs_rel_path ) {
+               _deprecated_argument( __FUNCTION__, '2.7' );
                $path = ABSPATH . trim( $abs_rel_path, '/' );
-       else
+       } else {
                $path = WP_PLUGIN_DIR;
+       }
 
        $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
        return load_textdomain( $domain, $mofile );
 }
 
+/**
+ * Load the translated strings for a plugin residing in the mu-plugins dir.
+ *
+ * @since 3.0.0
+ *
+ * @param string $domain Unique identifier for retrieving translated strings
+ * @param strings $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which
+ * the MO file resides. Defaults is empty string.
+ */
+function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
+       $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
+       $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
+       load_textdomain( $domain, trailingslashit( $path ) . "$domain-$locale.mo" );
+}
+
 /**
  * Loads the theme's translated strings.
  *
@@ -394,8 +428,8 @@ function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_pat
  *
  * @param string $domain Unique identifier for retrieving translated strings
  */
-function load_theme_textdomain($domain, $path = false) {
-       $locale = get_locale();
+function load_theme_textdomain( $domain, $path = false ) {
+       $locale = apply_filters( 'theme_locale', get_locale(), $domain );
 
        $path = ( empty( $path ) ) ? get_template_directory() : $path;
 
@@ -415,13 +449,13 @@ function load_theme_textdomain($domain, $path = false) {
  *
  * @param string $domain Unique identifier for retrieving translated strings
  */
-function load_child_theme_textdomain($domain, $path = false) {
-        $locale = get_locale();
+function load_child_theme_textdomain( $domain, $path = false ) {
+       $locale = apply_filters( 'theme_locale', get_locale(), $domain );
 
-        $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path;
+       $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path;
 
-        $mofile = "$path/$locale.mo";
-        return load_textdomain($domain, $mofile);
+       $mofile = "$path/$locale.mo";
+       return load_textdomain($domain, $mofile);
 }
 
 /**
@@ -439,6 +473,18 @@ function &get_translations_for_domain( $domain ) {
        return $l10n[$domain];
 }
 
+/**
+ * Whether there are translations for the domain
+ *
+ * @since 3.0.0
+ * @param string $domain
+ * @return bool Whether there are translations
+ */
+function is_textdomain_loaded( $domain ) {
+       global $l10n;
+       return isset( $l10n[$domain] );
+}
+
 /**
  * Translates role name. Since the role names are in the database and
  * not in the source there are dummy gettext calls to get them into the POT
@@ -452,4 +498,23 @@ function &get_translations_for_domain( $domain ) {
 function translate_user_role( $name ) {
        return translate_with_gettext_context( before_last_bar($name), 'User role' );
 }
-?>
+
+/**
+ * Get all available languages based on the presence of *.mo files in a given directory. The default directory is WP_LANG_DIR.
+ *
+ * @since 3.0.0
+ *
+ * @param string $dir A directory in which to search for language files. The default directory is WP_LANG_DIR.
+ * @return array Array of language codes or an empty array if no languages are present.  Language codes are formed by stripping the .mo extension from the language file names.
+ */
+function get_available_languages( $dir = null ) {
+       $languages = array();
+
+       foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
+               $lang_file = basename($lang_file, '.mo');
+               if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) )
+                       $languages[] = $lang_file;
+       }
+
+       return $languages;
+}
\ No newline at end of file
index 4a1787dbaccd7d5b94bc6b51090aacc57bd4788f..0b92174d0afc010329a10898fe6feede4e1b8c06 100644 (file)
@@ -100,16 +100,21 @@ function get_permalink($id = 0, $leavename = false) {
                $sample = false;
        }
 
-       if ( empty($post->ID) ) return false;
+       if ( empty($post->ID) )
+               return false;
 
        if ( $post->post_type == 'page' )
                return get_page_link($post->ID, $leavename, $sample);
-       elseif ($post->post_type == 'attachment')
+       elseif ( $post->post_type == 'attachment' )
                return get_attachment_link($post->ID);
+       elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
+               return get_post_permalink($post, $leavename, $sample);
 
        $permalink = get_option('permalink_structure');
 
-       if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending')) ) {
+       $permalink = apply_filters('pre_post_link', $permalink, $post, $leavename);
+
+       if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
                $unixtime = strtotime($post->post_date);
 
                $category = '';
@@ -150,13 +155,56 @@ function get_permalink($id = 0, $leavename = false) {
                        $author,
                        $post->post_name,
                );
-               $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
+               $permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );
                $permalink = user_trailingslashit($permalink, 'single');
-               return apply_filters('post_link', $permalink, $post, $leavename);
        } else { // if they're not using the fancy permalink option
-               $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID;
-               return apply_filters('post_link', $permalink, $post, $leavename);
+               $permalink = home_url('?p=' . $post->ID);
+       }
+       return apply_filters('post_link', $permalink, $post, $leavename);
+}
+
+/**
+ * Retrieve the permalink for a post with a custom post type.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $leavename Optional, defaults to false. Whether to keep post name.
+ * @param bool $sample Optional, defaults to false. Is it a sample permalink.
+ * @return string
+ */
+function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
+       global $wp_rewrite;
+
+       $post = &get_post($id);
+
+       if ( is_wp_error( $post ) )
+               return $post;
+
+       $post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
+
+       $slug = $post->post_name;
+
+       $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
+
+       $post_type = get_post_type_object($post->post_type);
+
+       if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
+               if ( ! $leavename ) {
+                       if ( $post_type->hierarchical )
+                               $slug = get_page_uri($id);
+                       $post_link = str_replace("%$post->post_type%", $slug, $post_link);
+               }
+               $post_link = home_url( user_trailingslashit($post_link) );
+       } else {
+               if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
+                       $post_link = add_query_arg($post_type->query_var, $slug, '');
+               else
+                       $post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
+               $post_link = home_url($post_link);
        }
+
+       return apply_filters('post_type_link', $post_link, $id, $leavename, $sample);
 }
 
 /**
@@ -168,7 +216,10 @@ function get_permalink($id = 0, $leavename = false) {
  * @param mixed $deprecated Not used.
  * @return string
  */
-function post_permalink($post_id = 0, $deprecated = '') {
+function post_permalink( $post_id = 0, $deprecated = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '1.3' );
+
        return get_permalink($post_id);
 }
 
@@ -192,11 +243,11 @@ function get_page_link( $id = false, $leavename = false, $sample = false ) {
                $id = (int) $post->ID;
 
        if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
-               $link = get_option('home');
+               $link = home_url('/');
        else
                $link = _get_page_link( $id , $leavename, $sample );
 
-       return apply_filters('page_link', $link, $id);
+       return apply_filters('page_link', $link, $id, $sample);
 }
 
 /**
@@ -220,15 +271,15 @@ function _get_page_link( $id = false, $leavename = false, $sample = false ) {
        else
                $post = &get_post($id);
 
-       $pagestruct = $wp_rewrite->get_page_permastruct();
+       $link = $wp_rewrite->get_page_permastruct();
 
-       if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
-               $link = get_page_uri($id);
-               $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
-               $link = trailingslashit(get_option('home')) . "$link";
+       if ( '' != $link && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
+               if ( ! $leavename )
+                       $link = str_replace('%pagename%', get_page_uri($id), $link);
+               $link = home_url($link);
                $link = user_trailingslashit($link, 'page');
        } else {
-               $link = trailingslashit(get_option('home')) . "?page_id=$id";
+               $link = home_url("?page_id=$id");
        }
 
        return apply_filters( '_get_page_link', $link, $id );
@@ -249,9 +300,8 @@ function get_attachment_link($id = false) {
 
        $link = false;
 
-       if (! $id) {
+       if ( ! $id)
                $id = (int) $post->ID;
-       }
 
        $object = get_post($id);
        if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) {
@@ -260,17 +310,18 @@ function get_attachment_link($id = false) {
                        $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
                else
                        $parentlink = get_permalink( $object->post_parent );
+
                if ( is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
                        $name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
                else
                        $name = $object->post_name;
-               if (strpos($parentlink, '?') === false)
+
+               if ( strpos($parentlink, '?') === false )
                        $link = user_trailingslashit( trailingslashit($parentlink) . $name );
        }
 
-       if (! $link ) {
-               $link = trailingslashit(get_bloginfo('url')) . "?attachment_id=$id";
-       }
+       if ( ! $link )
+               $link = home_url( "/?attachment_id=$id" );
 
        return apply_filters('attachment_link', $link, $id);
 }
@@ -286,13 +337,13 @@ function get_attachment_link($id = false) {
 function get_year_link($year) {
        global $wp_rewrite;
        if ( !$year )
-               $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
+               $year = gmdate('Y', current_time('timestamp'));
        $yearlink = $wp_rewrite->get_year_permastruct();
        if ( !empty($yearlink) ) {
                $yearlink = str_replace('%year%', $year, $yearlink);
-               return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
+               return apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year') ), $year);
        } else {
-               return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year);
+               return apply_filters('year_link', home_url('?m=' . $year), $year);
        }
 }
 
@@ -308,16 +359,16 @@ function get_year_link($year) {
 function get_month_link($year, $month) {
        global $wp_rewrite;
        if ( !$year )
-               $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
+               $year = gmdate('Y', current_time('timestamp'));
        if ( !$month )
-               $month = gmdate('m', time()+(get_option('gmt_offset') * 3600));
+               $month = gmdate('m', current_time('timestamp'));
        $monthlink = $wp_rewrite->get_month_permastruct();
        if ( !empty($monthlink) ) {
                $monthlink = str_replace('%year%', $year, $monthlink);
                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
-               return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
+               return apply_filters('month_link', home_url( user_trailingslashit($monthlink, 'month') ), $year, $month);
        } else {
-               return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);
+               return apply_filters('month_link', home_url( '?m=' . $year . zeroise($month, 2) ), $year, $month);
        }
 }
 
@@ -334,23 +385,36 @@ function get_month_link($year, $month) {
 function get_day_link($year, $month, $day) {
        global $wp_rewrite;
        if ( !$year )
-               $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
+               $year = gmdate('Y', current_time('timestamp'));
        if ( !$month )
-               $month = gmdate('m', time()+(get_option('gmt_offset') * 3600));
+               $month = gmdate('m', current_time('timestamp'));
        if ( !$day )
-               $day = gmdate('j', time()+(get_option('gmt_offset') * 3600));
+               $day = gmdate('j', current_time('timestamp'));
 
        $daylink = $wp_rewrite->get_day_permastruct();
        if ( !empty($daylink) ) {
                $daylink = str_replace('%year%', $year, $daylink);
                $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
-               return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
+               return apply_filters('day_link', home_url( user_trailingslashit($daylink, 'day') ), $year, $month, $day);
        } else {
-               return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
+               return apply_filters('day_link', home_url( '?m=' . $year . zeroise($month, 2) . zeroise($day, 2) ), $year, $month, $day);
        }
 }
 
+/**
+ * Display the permalink for the feed type.
+ *
+ * @since 3.0.0
+ *
+ * @param string $anchor The link's anchor text.
+ * @param string $feed Optional, defaults to default feed. Feed type.
+ */
+function the_feed_link( $anchor, $feed = '' ) {
+       $link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
+       echo apply_filters( 'the_feed_link', $link, $feed );
+}
+
 /**
  * Retrieve the permalink for the feed type.
  *
@@ -374,7 +438,7 @@ function get_feed_link($feed = '') {
 
                $permalink = str_replace('%feed%', $feed, $permalink);
                $permalink = preg_replace('#/+#', '/', "/$permalink");
-               $output =  get_option('home') . user_trailingslashit($permalink, 'feed');
+               $output =  home_url( user_trailingslashit($permalink, 'feed') );
        } else {
                if ( empty($feed) )
                        $feed = get_default_feed();
@@ -382,7 +446,7 @@ function get_feed_link($feed = '') {
                if ( false !== strpos($feed, 'comments_') )
                        $feed = str_replace('comments_', 'comments-', $feed);
 
-               $output = trailingslashit(get_option('home')) . "?feed={$feed}";
+               $output = home_url("?feed={$feed}");
        }
 
        return apply_filters('feed_link', $output, $feed);
@@ -407,16 +471,21 @@ function get_post_comments_feed_link($post_id = '', $feed = '') {
                $feed = get_default_feed();
 
        if ( '' != get_option('permalink_structure') ) {
-               $url = trailingslashit( get_permalink($post_id) ) . 'feed';
+               if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
+                       $url = _get_page_link( $post_id );
+               else
+                       $url = get_permalink($post_id);
+
+               $url = trailingslashit($url) . 'feed';
                if ( $feed != get_default_feed() )
                        $url .= "/$feed";
                $url = user_trailingslashit($url, 'single_feed');
        } else {
                $type = get_post_field('post_type', $post_id);
                if ( 'page' == $type )
-                       $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;page_id=$post_id";
+                       $url = home_url("?feed=$feed&amp;page_id=$post_id");
                else
-                       $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;p=$post_id";
+                       $url = home_url("?feed=$feed&amp;p=$post_id");
        }
 
        return apply_filters('post_comments_feed_link', $url);
@@ -468,7 +537,7 @@ function get_author_feed_link( $author_id, $feed = '' ) {
                $feed = get_default_feed();
 
        if ( '' == $permalink_structure ) {
-               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;author=" . $author_id;
+               $link = home_url("?feed=$feed&amp;author=" . $author_id);
        } else {
                $link = get_author_posts_url($author_id);
                if ( $feed == get_default_feed() )
@@ -499,31 +568,64 @@ function get_author_feed_link( $author_id, $feed = '' ) {
  * @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;
+       return get_term_feed_link($cat_id, 'category', $feed);
+}
 
-       $category = get_category($cat_id);
+/**
+ * Retrieve the feed link for a taxonomy.
+ *
+ * Returns a link to the feed for all post in a given term. A specific feed
+ * can be requested or left blank to get the default feed.
+ *
+ * @since 3.0
+ *
+ * @param int $term_id ID of a category.
+ * @param string $taxonomy Optional. Taxonomy of $term_id
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the taxonomy specified by $term_id and $taxonomy.
+*/
+function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
+       global $wp_rewrite;
+
+       $term_id = ( int ) $term_id;
 
-       if ( empty($category) || is_wp_error($category) )
+       $term = get_term( $term_id, $taxonomy  );
+
+       if ( empty( $term ) || is_wp_error( $term ) )
                return false;
 
-       if ( empty($feed) )
+       if ( empty( $feed ) )
                $feed = get_default_feed();
 
-       $permalink_structure = get_option('permalink_structure');
+       $permalink_structure = get_option( 'permalink_structure' );
 
        if ( '' == $permalink_structure ) {
-               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;cat=" . $cat_id;
+               if ( 'category' == $taxonomy ) {
+                       $link = home_url("?feed=$feed&amp;cat=$term_id");
+               }
+               elseif ( 'post_tag' == $taxonomy ) {
+                       $link = home_url("?feed=$feed&amp;tag=$term->slug");
+               } else {
+                       $t = get_taxonomy( $taxonomy );
+                       $link = home_url("?feed=$feed&amp;$t->query_var=$term->slug");
+               }
        } else {
-               $link = get_category_link($cat_id);
-               if( $feed == get_default_feed() )
+               $link = get_term_link( $term_id, $term->taxonomy );
+               if ( $feed == get_default_feed() )
                        $feed_link = 'feed';
                else
                        $feed_link = "feed/$feed";
 
-               $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
+               $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
        }
 
-       $link = apply_filters('category_feed_link', $link, $feed);
+       if ( 'category' == $taxonomy )
+               $link = apply_filters( 'category_feed_link', $link, $feed );
+       elseif ( 'post_tag' == $taxonomy )
+               $link = apply_filters( 'category_feed_link', $link, $feed );
+       else
+               $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy );
+
 
        return $link;
 }
@@ -538,32 +640,7 @@ function get_category_feed_link($cat_id, $feed = '') {
  * @return string
  */
 function get_tag_feed_link($tag_id, $feed = '') {
-       $tag_id = (int) $tag_id;
-
-       $tag = get_tag($tag_id);
-
-       if ( empty($tag) || is_wp_error($tag) )
-               return false;
-
-       $permalink_structure = get_option('permalink_structure');
-
-       if ( empty($feed) )
-               $feed = get_default_feed();
-
-       if ( '' == $permalink_structure ) {
-               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;tag=" . $tag->slug;
-       } else {
-               $link = get_tag_link($tag->term_id);
-               if ( $feed == get_default_feed() )
-                       $feed_link = 'feed';
-               else
-                       $feed_link = "feed/$feed";
-               $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
-       }
-
-       $link = apply_filters('tag_feed_link', $link, $feed);
-
-       return $link;
+       return get_term_feed_link($tag_id, 'post_tag', $feed);
 }
 
 /**
@@ -575,12 +652,14 @@ function get_tag_feed_link($tag_id, $feed = '') {
  * @return string
  */
 function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
-       $tag = get_term($tag_id, $taxonomy);
-
-       if ( !current_user_can('manage_categories') )
+       global $post_type;
+       $tax = get_taxonomy($taxonomy);
+       if ( !current_user_can($tax->cap->edit_terms) )
                return;
 
-       $location = admin_url('edit-tags.php?action=edit&amp;taxonomy=' . $taxonomy . '&amp;tag_ID=' . $tag->term_id);
+       $tag = get_term($tag_id, $taxonomy);
+
+       $location = admin_url('edit-tags.php?action=edit&amp;taxonomy=' . $taxonomy . '&amp;' . (!empty($post_type) ? 'post_type=' . $post_type .'&amp;' : '') .'tag_ID=' . $tag->term_id);
        return apply_filters( 'get_edit_tag_link', $location );
 }
 
@@ -596,18 +675,48 @@ function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
  * @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') )
+       $tax = get_taxonomy('post_tag');
+       if ( !current_user_can($tax->cap->edit_terms) )
                return;
 
+       $tag = get_term($tag, 'post_tag');
+
        if ( empty($link) )
                $link = __('Edit This');
 
-       $link = '<a href="' . get_edit_tag_link( $tag->term_id ) . '" title="' . __( 'Edit tag' ) . '">' . $link . '</a>';
+       $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 permalink for search.
+*
+* @since  3.0.0
+* @param string $query Optional. The query string to use. If empty the current query is used.
+* @return string
+*/
+function get_search_link( $query = '' ) {
+       global $wp_rewrite;
+
+       if ( empty($query) )
+               $search = get_search_query( false );
+       else
+               $search = stripslashes($query);
+
+       $permastruct = $wp_rewrite->get_search_permastruct();
+
+       if ( empty( $permastruct ) ) {
+               $link = home_url('?s=' . urlencode($search) );
+       } else {
+               $search = urlencode($search);
+               $search = str_replace('%2F', '/', $search); // %2F(/) is not valid within a URL, send it unencoded.
+               $link = str_replace( '%search%', $search, $permastruct );
+               $link = home_url( user_trailingslashit( $link, 'search' ) );
+       }
+
+       return apply_filters( 'search_link', $link, $search );
+}
+
 /**
  * Retrieve the permalink for the feed of the search results.
  *
@@ -618,17 +727,22 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
  * @return string
  */
 function get_search_feed_link($search_query = '', $feed = '') {
-       if ( empty($search_query) )
-               $search = esc_attr( urlencode(get_search_query()) );
-       else
-               $search = esc_attr( urlencode(stripslashes($search_query)) );
+       global $wp_rewrite;
+       $link = get_search_link($search_query);
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
-       $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=$feed";
+       $permastruct = $wp_rewrite->get_search_permastruct();
 
-       $link = apply_filters('search_feed_link', $link);
+       if ( empty($permastruct) ) {
+               $link = add_query_arg('feed', $feed, $link);
+       } else {
+               $link = trailingslashit($link);
+               $link .= "feed/$feed/";
+       }
+
+       $link = apply_filters('search_feed_link', $link, $feed, 'posts');
 
        return $link;
 }
@@ -643,17 +757,21 @@ function get_search_feed_link($search_query = '', $feed = '') {
  * @return string
  */
 function get_search_comments_feed_link($search_query = '', $feed = '') {
-       if ( empty($search_query) )
-               $search = esc_attr( urlencode(get_search_query()) );
-       else
-               $search = esc_attr( urlencode(stripslashes($search_query)) );
+       global $wp_rewrite;
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
-       $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=comments-$feed";
+       $link = get_search_feed_link($search_query, $feed);
+
+       $permastruct = $wp_rewrite->get_search_permastruct();
 
-       $link = apply_filters('search_feed_link', $link);
+       if ( empty($permastruct) )
+               $link = add_query_arg('feed', 'comments-' . $feed, $link);
+       else
+               $link = add_query_arg('withcomments', 1, $link);
+
+       $link = apply_filters('search_feed_link', $link, $feed, 'comments');
 
        return $link;
 }
@@ -675,39 +793,18 @@ function get_edit_post_link( $id = 0, $context = 'display' ) {
                return;
 
        if ( 'display' == $context )
-               $action = 'action=edit&amp;';
+               $action = '&amp;action=edit';
        else
-               $action = 'action=edit&';
+               $action = '&action=edit';
 
-       switch ( $post->post_type ) :
-       case 'page' :
-               if ( !current_user_can( 'edit_page', $post->ID ) )
-                       return;
-               $file = 'page';
-               $var  = 'post';
-               break;
-       case 'attachment' :
-               if ( !current_user_can( 'edit_post', $post->ID ) )
-                       return;
-               $file = 'media';
-               $var  = 'attachment_id';
-               break;
-       case 'revision' :
-               if ( !current_user_can( 'edit_post', $post->ID ) )
-                       return;
-               $file = 'revision';
-               $var  = 'revision';
-               $action = '';
-               break;
-       default :
-               if ( !current_user_can( 'edit_post', $post->ID ) )
-                       return apply_filters( 'get_edit_post_link', '', $post->ID, $context );;
-               $file = 'post';
-               $var  = 'post';
-               break;
-       endswitch;
+       $post_type_object = get_post_type_object( $post->post_type );
+       if ( !$post_type_object )
+               return;
 
-       return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
+       if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )
+               return;
+
+       return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), $post->ID, $context );
 }
 
 /**
@@ -730,60 +827,42 @@ function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
        if ( null === $link )
                $link = __('Edit This');
 
-       $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
+       $post_type_obj = get_post_type_object( $post->post_type );
+       $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';
        echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
 }
 
 /**
  * Retrieve delete posts link for post.
  *
- * Can be used within the WordPress loop or outside of it. Can be used with
- * pages, posts, attachments, and revisions.
+ * Can be used within the WordPress loop or outside of it, with any post type.
  *
  * @since 2.9.0
  *
  * @param int $id Optional. Post ID.
- * @param string $context Optional, default to display. How to write the '&', defaults to '&amp;'.
+ * @param string $deprecated Not used.
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
  * @return string
  */
-function get_delete_post_link($id = 0, $context = 'display') {
+function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
+       if ( ! empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '3.0.0' );
+
        if ( !$post = &get_post( $id ) )
                return;
 
-       if ( 'display' == $context )
-               $action = 'action=trash&amp;';
-       else
-               $action = 'action=trash&';
+       $post_type_object = get_post_type_object( $post->post_type );
+       if ( !$post_type_object )
+               return;
 
-       switch ( $post->post_type ) :
-       case 'page' :
-               if ( !current_user_can( 'delete_page', $post->ID ) )
-                       return;
-               $file = 'page';
-               $var  = 'post';
-               break;
-       case 'attachment' :
-               if ( !current_user_can( 'delete_post', $post->ID ) )
-                       return;
-               $file = 'media';
-               $var  = 'attachment_id';
-               break;
-       case 'revision' :
-               if ( !current_user_can( 'delete_post', $post->ID ) )
-                       return;
-               $file = 'revision';
-               $var  = 'revision';
-               $action = '';
-               break;
-       default :
-               if ( !current_user_can( 'edit_post', $post->ID ) )
-                       return apply_filters( 'get_delete_post_link', '', $post->ID, $context );;
-               $file = 'post';
-               $var  = 'post';
-               break;
-       endswitch;
+       if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
+               return;
 
-       return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url("$file.php?{$action}$var=$post->ID"), "trash-{$file}_" . $post->ID ), $context );
+       $action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
+
+       $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
+
+       return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-{$post->post_type}_{$post->ID}" ), $post->ID, $force_delete );
 }
 
 /**
@@ -875,7 +954,7 @@ function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark =
        if ( empty($link) )
                $link = __('Edit This');
 
-       $link = '<a href="' . get_edit_bookmark_link( $link ) . '" title="' . __( 'Edit link' ) . '">' . $link . '</a>';
+       $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;
 }
 
@@ -922,7 +1001,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
 function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
        global $post, $wpdb;
 
-       if ( empty($post) || !is_single() || is_attachment() )
+       if ( empty( $post ) )
                return null;
 
        $current_post_date = $post->post_date;
@@ -933,7 +1012,7 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
                $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
 
                if ( $in_same_cat ) {
-                       $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
+                       $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
                        $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
                }
 
@@ -987,7 +1066,7 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
  * @return string
  */
 function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
-       if ( $previous && is_attachment() )
+       if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) )
                $post = & get_post($GLOBALS['post']->post_parent);
        else
                $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
@@ -1002,7 +1081,7 @@ function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $ex
 
        $title = str_replace('%title', $post->post_title, $title);
        $title = str_replace('%date', $date, $title);
-       $title = apply_filters('the_title', $title, $post);
+       $title = apply_filters('the_title', $title, $post->ID);
 
        $link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
        $link .= esc_attr( $title );
@@ -1026,6 +1105,19 @@ function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $exclu
        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
 }
 
+/**
+ * Display relational links for the posts adjacent to the current post for single post pages.
+ *
+ * This is meant to be attached to actions like 'wp_head'.  Do not call this directly in plugins or theme templates.
+ * @since 3.0.0
+ *
+ */
+function adjacent_posts_rel_link_wp_head() {
+       if ( !is_singular() || is_attachment() )
+               return;
+       adjacent_posts_rel_link();
+}
+
 /**
  * Display relational link for the next post adjacent to the current post.
  *
@@ -1066,7 +1158,7 @@ function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_c
  * @return object
  */
 function get_boundary_post($in_same_cat = false, $excluded_categories = '', $start = true) {
-       global $post, $wpdb;
+       global $post;
 
        if ( empty($post) || !is_single() || is_attachment() )
                return null;
@@ -1075,7 +1167,7 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
        $excluded_categories = array();
        if ( !empty($in_same_cat) || !empty($excluded_categories) ) {
                if ( !empty($in_same_cat) ) {
-                       $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
+                       $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
                }
 
                if ( !empty($excluded_categories) ) {
@@ -1095,7 +1187,7 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
 
        $order = $start ? 'ASC' : 'DESC';
 
-       return get_posts( array('numberposts' => 1, 'order' => $order, 'orderby' => 'ID', 'category' => $categories) );
+       return get_posts( array('numberposts' => 1, 'no_found_rows' => true, 'order' => $order, 'orderby' => 'ID', 'category' => $categories) );
 }
 
 /**
@@ -1113,20 +1205,21 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
  */
 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
        $posts = get_boundary_post($in_same_cat,$excluded_categories,$start);
+       // If there is no post stop.
+       if ( empty($posts) )
+               return;
+
        // Even though we limited get_posts to return only 1 item it still returns an array of objects.
        $post = $posts[0];
 
-       if ( empty($post) )
-                        return;
-
-               if ( empty($post->post_title) )
-                               $post->post_title = $start ? __('First Post') : __('Last Post');
+       if ( empty($post->post_title) )
+               $post->post_title = $start ? __('First Post') : __('Last Post');
 
        $date = mysql2date(get_option('date_format'), $post->post_date);
 
        $title = str_replace('%title', $post->post_title, $title);
        $title = str_replace('%date', $date, $title);
-       $title = apply_filters('the_title', $title, $post);
+       $title = apply_filters('the_title', $title, $post->ID);
 
        $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
        $link .= esc_attr($title);
@@ -1157,7 +1250,7 @@ function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_
  * @return string
  */
 function get_index_rel_link() {
-       $link = "<link rel='index' title='" . esc_attr(get_bloginfo('name')) . "' href='" . get_bloginfo('siteurl') . "' />\n";
+       $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
        return apply_filters( "index_rel_link", $link );
 }
 
@@ -1189,7 +1282,7 @@ function get_parent_post_rel_link($title = '%title') {
 
        $title = str_replace('%title', $post->post_title, $title);
        $title = str_replace('%date', $date, $title);
-       $title = apply_filters('the_title', $title, $post);
+       $title = apply_filters('the_title', $title, $post->ID);
 
        $link = "<link rel='up' title='";
        $link .= esc_attr( $title );
@@ -1262,7 +1355,7 @@ function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_cate
        if ( empty($post->post_title) )
                $title = $previous ? __('Previous Post') : __('Next Post');
 
-       $title = apply_filters('the_title', $title, $post);
+       $title = apply_filters('the_title', $title, $post->ID);
        $date = mysql2date(get_option('date_format'), $post->post_date);
        $rel = $previous ? 'prev' : 'next';
 
@@ -1292,7 +1385,7 @@ function get_pagenum_link($pagenum = 1) {
 
        $request = remove_query_arg( 'paged' );
 
-       $home_root = parse_url(get_option('home'));
+       $home_root = parse_url(home_url());
        $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
        $home_root = preg_quote( trailingslashit( $home_root ), '|' );
 
@@ -1300,7 +1393,7 @@ function get_pagenum_link($pagenum = 1) {
        $request = preg_replace('|^/+|', '', $request);
 
        if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
-               $base = trailingslashit( get_bloginfo( 'home' ) );
+               $base = trailingslashit( get_bloginfo( 'url' ) );
 
                if ( $pagenum > 1 ) {
                        $result = add_query_arg( 'paged', $pagenum, $base . $request );
@@ -1390,9 +1483,8 @@ function next_posts( $max_page = 0, $echo = true ) {
 function get_next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
        global $paged, $wp_query;
 
-       if ( !$max_page ) {
+       if ( !$max_page )
                $max_page = $wp_query->max_num_pages;
-       }
 
        if ( !$paged )
                $paged = 1;
@@ -1401,7 +1493,7 @@ function get_next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
 
        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>';
+               return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
        }
 }
 
@@ -1516,7 +1608,7 @@ function get_posts_nav_link( $args = array() ) {
 
                if ( $max_num_pages > 1 ) {
                        $return = get_previous_posts_link($args['prelabel']);
-                       $return .= preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $args['sep']);
+                       $return .= preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $args['sep']);
                        $return .= get_next_posts_link($args['nxtlabel']);
                }
        }
@@ -1605,7 +1697,7 @@ function get_next_comments_link( $label = '', $max_page = 0 ) {
        if ( empty($label) )
                $label = __('Newer Comments &raquo;');
 
-       return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+       return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
 }
 
 /**
@@ -1642,7 +1734,7 @@ function get_previous_comments_link( $label = '' ) {
        if ( empty($label) )
                $label = __('&laquo; Older Comments');
 
-       return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+       return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
 }
 
 /**
@@ -1666,7 +1758,7 @@ function previous_comments_link( $label = '' ) {
  * @return string Markup for pagination links.
 */
 function paginate_comments_links($args = array()) {
-       global $wp_query, $wp_rewrite;
+       global $wp_rewrite;
 
        if ( !is_singular() || !get_option('page_comments') )
                return;
@@ -1726,7 +1818,61 @@ function get_shortcut_link() {
 }
 
 /**
- * Retrieve the site url.
+ * Retrieve the home url for the current site.
+ *
+ * Returns the 'home' option with the appropriate protocol,  'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ *
+ * @uses get_home_url()
+ *
+ * @param  string $path   (optional) Path relative to the home url.
+ * @param  string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
+ * @return string Home url link with optional path appended.
+*/
+function home_url( $path = '', $scheme = null ) {
+       return get_home_url(null, $path, $scheme);
+}
+
+/**
+ * Retrieve the home url for a given site.
+ *
+ * Returns the 'home' option with the appropriate protocol,  'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ *
+ * @param  int $blog_id   (optional) Blog ID. Defaults to current blog.
+ * @param  string $path   (optional) Path relative to the home url.
+ * @param  string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
+ * @return string Home url link with optional path appended.
+*/
+function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
+       $orig_scheme = $scheme;
+
+       if ( !in_array( $scheme, array( 'http', 'https' ) ) )
+               $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
+
+       if ( empty( $blog_id ) || !is_multisite() )
+               $home = get_option( 'home' );
+       else
+               $home = get_blog_option( $blog_id, 'home' );
+
+       $url = str_replace( 'http://', "$scheme://", $home );
+
+       if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
+               $url .= '/' . ltrim( $path, '/' );
+
+       return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
+}
+
+/**
+ * Retrieve the site url for the current site.
  *
  * 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
@@ -1735,48 +1881,90 @@ function get_shortcut_link() {
  * @package WordPress
  * @since 2.6.0
  *
+ * @uses get_site_url()
+ *
+ * @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 ) {
+       return get_site_url(null, $path, $scheme);
+}
+
+/**
+ * Retrieve the site url for a given site.
+ *
+ * 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
+ * @since 3.0.0
+ *
+ * @param int $blog_id (optional) Blog ID. Defaults to current blog.
  * @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) {
+function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
        // should the list of allowed schemes be maintained elsewhere?
        $orig_scheme = $scheme;
-       if ( !in_array($scheme, array('http', 'https')) ) {
+       if ( !in_array( $scheme, array( 'http', 'https' ) ) ) {
                if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
                        $scheme = 'https';
-               elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
+               elseif ( ( 'login' == $scheme ) && force_ssl_admin() )
                        $scheme = 'https';
-               elseif ( ('admin' == $scheme) && force_ssl_admin() )
+               elseif ( ( 'admin' == $scheme ) && force_ssl_admin() )
                        $scheme = 'https';
                else
                        $scheme = ( is_ssl() ? 'https' : 'http' );
        }
 
-       $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
+       if ( empty( $blog_id ) || !is_multisite() )
+               $url = get_option( 'siteurl' );
+       else
+               $url = get_blog_option( $blog_id, 'siteurl' );
 
-       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
-               $url .= '/' . ltrim($path, '/');
+       $url = str_replace( 'http://', "{$scheme}://", $url );
 
-       return apply_filters('site_url', $url, $path, $orig_scheme);
+       if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
+               $url .= '/' . ltrim( $path, '/' );
+
+       return apply_filters( 'site_url', $url, $path, $orig_scheme, $blog_id );
 }
 
 /**
- * Retrieve the url to the admin area.
+ * Retrieve the url to the admin area for the current site.
  *
  * @package WordPress
  * @since 2.6.0
  *
  * @param string $path Optional path relative to the admin url
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
  * @return string Admin url link with optional path appended
 */
-function admin_url($path = '') {
-       $url = site_url('wp-admin/', 'admin');
+function admin_url( $path = '', $scheme = 'admin' ) {
+       return get_admin_url(null, $path, $scheme);
+}
+
+/**
+ * Retrieve the url to the admin area for a given site.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ *
+ * @param int $blog_id (optional) Blog ID. Defaults to current blog.
+ * @param string $path Optional path relative to the admin url
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended
+*/
+function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
+       $url = get_site_url($blog_id, 'wp-admin/', $scheme);
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= ltrim($path, '/');
 
-       return apply_filters('admin_url', $url, $path);
+       return apply_filters('admin_url', $url, $path, $blog_id);
 }
 
 /**
@@ -1807,12 +1995,9 @@ function includes_url($path = '') {
  * @return string Content url link with optional path appended.
 */
 function content_url($path = '') {
-       $scheme = ( is_ssl() ? 'https' : 'http' );
        $url = WP_CONTENT_URL;
-       if ( 0 === strpos($url, 'http') ) {
-               if ( is_ssl() )
-                       $url = str_replace( 'http://', "{$scheme}://", $url );
-       }
+       if ( 0 === strpos($url, 'http') && is_ssl() )
+               $url = str_replace( 'http://', 'https://', $url );
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= '/' . ltrim($path, '/');
@@ -1832,22 +2017,24 @@ function content_url($path = '') {
  * @return string Plugins url link with optional path appended.
 */
 function plugins_url($path = '', $plugin = '') {
-       $scheme = ( is_ssl() ? 'https' : 'http' );
 
-       if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) {
+       $mu_plugin_dir = WPMU_PLUGIN_DIR;
+       foreach ( array('path', 'plugin', 'mu_plugin_dir') as $var ) {
+               $$var = str_replace('\\' ,'/', $$var); // sanitize for Win32 installs
+               $$var = preg_replace('|/+|', '/', $$var);
+       }
+
+       if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
                $url = WPMU_PLUGIN_URL;
-       } else {
+       else
                $url = WP_PLUGIN_URL;
-       }
 
-       if ( 0 === strpos($url, 'http') ) {
-               if ( is_ssl() )
-                       $url = str_replace( 'http://', "{$scheme}://", $url );
-       }
+       if ( 0 === strpos($url, 'http') && is_ssl() )
+               $url = str_replace( 'http://', 'https://', $url );
 
        if ( !empty($plugin) && is_string($plugin) ) {
                $folder = dirname(plugin_basename($plugin));
-               if ('.' != $folder)
+               if ( '.' != $folder )
                        $url .= '/' . ltrim($folder, '/');
        }
 
@@ -1857,6 +2044,102 @@ function plugins_url($path = '', $plugin = '') {
        return apply_filters('plugins_url', $url, $path, $plugin);
 }
 
+/**
+ * Retrieve the site url for the current network.
+ *
+ * Returns the site url with the appropriate protocol,  'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @package WordPress
+ * @since 3.0.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.
+*/
+function network_site_url( $path = '', $scheme = null ) {
+       global $current_site;
+
+       if ( !is_multisite() )
+               return site_url($path, $scheme);
+
+       $orig_scheme = $scheme;
+       if ( !in_array($scheme, array('http', 'https')) ) {
+               if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
+                       $scheme = 'https';
+               elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
+                       $scheme = 'https';
+               elseif ( ('admin' == $scheme) && force_ssl_admin() )
+                       $scheme = 'https';
+               else
+                       $scheme = ( is_ssl() ? 'https' : 'http' );
+       }
+
+       $url = 'http://' . $current_site->domain . $current_site->path;
+
+       $url = str_replace( 'http://', "{$scheme}://", $url );
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= ltrim($path, '/');
+
+       return apply_filters('network_site_url', $url, $path, $orig_scheme);
+}
+
+/**
+ * Retrieve the home url for the current network.
+ *
+ * Returns the home url with the appropriate protocol,  'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ *
+ * @param  string $path   (optional) Path relative to the home url.
+ * @param  string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
+ * @return string Home url link with optional path appended.
+*/
+function network_home_url( $path = '', $scheme = null ) {
+       global $current_site;
+
+       if ( !is_multisite() )
+               return home_url($path, $scheme);
+
+       $orig_scheme = $scheme;
+
+       if ( !in_array($scheme, array('http', 'https')) )
+               $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
+
+       $url = 'http://' . $current_site->domain . $current_site->path;
+
+       $url = str_replace( 'http://', "$scheme://", $url );
+
+       if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
+               $url .= ltrim( $path, '/' );
+
+       return apply_filters( 'network_home_url', $url, $path, $orig_scheme);
+}
+
+/**
+ * Retrieve the url to the admin area for the network.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ *
+ * @param string $path Optional path relative to the admin url
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended
+*/
+function network_admin_url( $path = '', $scheme = 'admin' ) {
+       $url = network_site_url('wp-admin/', $scheme);
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= ltrim($path, '/');
+
+       return apply_filters('network_admin_url', $url, $path);
+}
+
 /**
  * Output rel=canonical for singular queries
  *
@@ -1875,4 +2158,117 @@ function rel_canonical() {
        echo "<link rel='canonical' href='$link' />\n";
 }
 
+/**
+ * Return a shortlink for a post, page, attachment, or blog.
+ *
+ * This function exists to provide a shortlink tag that all themes and plugins can target.  A plugin must hook in to
+ * provide the actual shortlinks.  Default shortlink support is limited to providing ?p= style links for posts.
+ * Plugins can short circuit this function via the pre_get_shortlink filter or filter the output
+ * via the get_shortlink filter.
+ *
+ * @since 3.0.0.
+ *
+ * @param int $id A post or blog id.  Default is 0, which means the current post or blog.
+ * @param string $contex Whether the id is a 'blog' id, 'post' id, or 'media' id.  If 'post', the post_type of the post is consulted.  If 'query', the current query is consulted to determine the id and context. Default is 'post'.
+ * @param bool $allow_slugs Whether to allow post slugs in the shortlink. It is up to the plugin how and whether to honor this.
+ * @return string A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks are not enabled.
+ */
+function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
+       // Allow plugins to short-circuit this function.
+       $shortlink = apply_filters('pre_get_shortlink', false, $id, $context, $allow_slugs);
+       if ( false !== $shortlink )
+               return $shortlink;
+
+       global $wp_query;
+       $post_id = 0;
+       if ( 'query' == $context && is_single() ) {
+               $post_id = $wp_query->get_queried_object_id();
+       } elseif ( 'post' == $context ) {
+               $post = get_post($id);
+               $post_id = $post->ID;
+       }
+
+       $shortlink = '';
+
+       // Return p= link for posts.
+       if ( !empty($post_id) && '' != get_option('permalink_structure') ) {
+               $post = get_post($post_id);
+               if ( isset($post->post_type) && 'post' == $post->post_type )
+                       $shortlink = home_url('?p=' . $post->ID);
+       }
+
+       return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
+}
+
+/**
+ *  Inject rel=sortlink into head if a shortlink is defined for the current page.
+ *
+ *  Attached to the wp_head action.
+ *
+ * @since 3.0.0
+ *
+ * @uses wp_get_shortlink()
+ */
+function wp_shortlink_wp_head() {
+       $shortlink = wp_get_shortlink( 0, 'query' );
+
+       if ( empty( $shortlink ) )
+               return;
+
+       echo "<link rel='shortlink' href='" . esc_url_raw( $shortlink ) . "' />\n";
+}
+
+/**
+ * Send a Link: rel=shortlink header if a shortlink is defined for the current page.
+ *
+ * Attached to the wp action.
+ *
+ * @since 3.0.0
+ *
+ * @uses wp_get_shortlink()
+ */
+function wp_shortlink_header() {
+    if ( headers_sent() )
+               return;
+
+       $shortlink = wp_get_shortlink(0, 'query');
+
+       if ( empty($shortlink) )
+               return;
+
+       header('Link: <' . $shortlink . '>; rel=shortlink', false);
+}
+
+/**
+ * Display the Short Link for a Post
+ *
+ * Must be called from inside "The Loop"
+ *
+ * Call like the_shortlink(__('Shortlinkage FTW'))
+ *
+ * @since 3.0.0
+ *
+ * @param string $text Optional The link text or HTML to be displayed.  Defaults to 'This is the short link.'
+ * @param string $title Optional The tooltip for the link.  Must be sanitized.  Defaults to the sanitized post title.
+ * @param string $before Optional HTML to display before the link.
+ * @param string $before Optional HTML to display after the link.
+ */
+function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
+       global $post;
+
+       if ( empty( $text ) )
+               $text = __('This is the short link.');
+
+       if ( empty( $title ) )
+               $title = the_title_attribute( array( 'echo' => FALSE ) );
+
+       $shortlink = wp_get_shortlink( $post->ID );
+
+       if ( !empty( $shortlink ) ) {
+               $link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
+               $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
+               echo $before, $link, $after;
+       }
+}
+
 ?>
diff --git a/wp-includes/load.php b/wp-includes/load.php
new file mode 100644 (file)
index 0000000..a514498
--- /dev/null
@@ -0,0 +1,588 @@
+<?php
+/**
+ * These functions are needed to load WordPress.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Turn register globals off.
+ *
+ * @access private
+ * @since 2.1.0
+ * @return null Will return null if register_globals PHP directive was disabled
+ */
+function wp_unregister_GLOBALS() {
+       if ( !ini_get( 'register_globals' ) )
+               return;
+
+       if ( isset( $_REQUEST['GLOBALS'] ) )
+               die( /*WP_I18N_GLOBALS_OVERWRITE*/'GLOBALS overwrite attempt detected'/*/WP_I18N_GLOBALS_OVERWRITE*/ );
+
+       // Variables that shouldn't be unset
+       $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
+
+       $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
+       foreach ( $input as $k => $v )
+               if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
+                       $GLOBALS[$k] = null;
+                       unset( $GLOBALS[$k] );
+               }
+}
+
+/**
+ * Fix $_SERVER variables for various setups.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_fix_server_vars() {
+       global $PHP_SELF;
+
+       $default_server_values = array(
+               'SERVER_SOFTWARE' => '',
+               'REQUEST_URI' => '',
+       );
+
+       $_SERVER = array_merge( $default_server_values, $_SERVER );
+
+       // Fix for IIS when running with PHP ISAPI
+       if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+
+               // IIS Mod-Rewrite
+               if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
+                       $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+               }
+               // IIS Isapi_Rewrite
+               else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
+                       $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+               } else {
+                       // Use ORIG_PATH_INFO if there is no PATH_INFO
+                       if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
+                               $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+
+                       // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
+                       if ( isset( $_SERVER['PATH_INFO'] ) ) {
+                               if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
+                                       $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
+                               else
+                                       $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
+                       }
+
+                       // Append the query string if it exists and isn't null
+                       if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
+                               $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+                       }
+               }
+       }
+
+       // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+       if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
+               $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+
+       // Fix for Dreamhost and other PHP as CGI hosts
+       if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
+               unset( $_SERVER['PATH_INFO'] );
+
+       // Fix empty PHP_SELF
+       $PHP_SELF = $_SERVER['PHP_SELF'];
+       if ( empty( $PHP_SELF ) )
+               $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
+}
+
+/**
+ * Check for the required PHP version, and the MySQL extension or a database drop-in.
+ *
+ * Dies if requirements are not met.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_check_php_mysql_versions() {
+       // we can probably extend this function to check if wp_die() exists then use translated strings, and then use it in install.php etc.
+
+       global $required_php_version, $wp_version;
+       $php_version = phpversion();
+       if ( version_compare( $required_php_version, $php_version, '>' ) )
+               die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'/*/WP_I18N_OLD_PHP*/, $php_version, $wp_version, $required_php_version ) );
+
+       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*/ );
+}
+
+/**
+ * Don't load all of WordPress when handling a favicon.ico request.
+ * Instead, send the headers for a zero-length favicon and bail.
+ *
+ * @since 3.0.0
+ */
+function wp_favicon_request() {
+       if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
+               header('Content-Type: image/vnd.microsoft.icon');
+               header('Content-Length: 0');
+               exit;
+       }
+}
+
+/**
+ * Dies with a maintenance message when conditions are met.
+ *
+ * Checks for a file in the WordPress root directory named ".maintenance".
+ * This file will contain the variable $upgrading, set to the time the file
+ * was created. If the file was created less than 10 minutes ago, WordPress
+ * enters maintenance mode and displays a message.
+ *
+ * The default message can be replaced by using a drop-in (maintenance.php in
+ * the wp-content directory).
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_maintenance() {
+       if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
+               return;
+
+       global $upgrading;
+
+       include( ABSPATH . '.maintenance' );
+       // If the $upgrading timestamp is older than 10 minutes, don't die.
+       if ( ( time() - $upgrading ) >= 600 )
+               return;
+
+       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' );
+       header( 'Retry-After: 600' );
+?>
+       <!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><?php echo /*WP_I18N_MAINTENANCE*/'Maintenance'/*/WP_I18N_MAINTENANCE*/; ?></title>
+
+       </head>
+       <body>
+               <h1><?php echo /*WP_I18N_MAINT_MSG*/'Briefly unavailable for scheduled maintenance. Check back in a minute.'/*/WP_I18N_MAINT_MSG*/; ?></h1>
+       </body>
+       </html>
+<?php
+       die();
+}
+
+/**
+ * PHP 4 standard microtime start capture.
+ *
+ * @access private
+ * @since 0.71
+ * @global int $timestart Seconds and Microseconds added together from when function is called.
+ * @return bool Always returns true.
+ */
+function timer_start() {
+       global $timestart;
+       $mtime = explode( ' ', microtime() );
+       $timestart = $mtime[1] + $mtime[0];
+       return true;
+}
+
+/**
+ * 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>
+ * $nTimePageTookToExecute = timer_stop();
+ * echo $nTimePageTookToExecute;
+ * </code>
+ *
+ * Or instead, you can do:
+ * <code>
+ * timer_stop(1);
+ * </code>
+ * which will do what the above does. If you need the result, you can assign it to a variable, but
+ * most cases, you only need to echo it.
+ *
+ * @since 0.71
+ * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
+ * @global int $timeend  Seconds and Microseconds added together from when function is called
+ *
+ * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
+ * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
+ * @return float The "second.microsecond" finished time calculation
+ */
+function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal
+       global $timestart, $timeend;
+       $mtime = microtime();
+       $mtime = explode( ' ', $mtime );
+       $timeend = $mtime[1] + $mtime[0];
+       $timetotal = $timeend - $timestart;
+       $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
+       if ( $display )
+               echo $r;
+       return $r;
+}
+
+/**
+ * Sets PHP error handling and handles WordPress debug mode.
+ *
+ * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be
+ * defined in wp-config.php. Example: <code> define( 'WP_DEBUG', true ); </code>
+ *
+ * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.
+ * WP_DEBUG defaults to false.
+ *
+ * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display
+ * notices, including one when a deprecated WordPress function, function argument,
+ * or file is used. Deprecated code may be removed from a later version.
+ *
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG in their
+ * development environments.
+ *
+ * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed.
+ * WP_DEBUG_DISPLAY defaults to true. Defining it as false prevents WordPress from
+ * changing the global configuration setting. (Defining WP_DEBUG_DISPLAY as false
+ * will never force errors to be hidden.)
+ *
+ * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.
+ * WP_DEBUG_LOG defaults to false.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_debug_mode() {
+       if ( WP_DEBUG ) {
+               if ( defined( 'E_DEPRECATED' ) )
+                       error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
+               else
+                       error_reporting( E_ALL );
+
+               if ( WP_DEBUG_DISPLAY )
+                       ini_set( 'display_errors', 1 );
+
+               if ( WP_DEBUG_LOG ) {
+                       ini_set( 'log_errors', 1 );
+                       ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
+               }
+       } else {
+               if ( defined( 'E_RECOVERABLE_ERROR' ) )
+                       error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
+               else
+                       error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING );
+       }
+}
+
+/**
+ * Sets the location of the language directory.
+ *
+ * To set directory manually, define <code>WP_LANG_DIR</code> in wp-config.php.
+ *
+ * First looks for language folder in WP_CONTENT_DIR and uses that folder if it
+ * exists. Or it uses the "languages" folder in WPINC.
+ *
+ * The WP_LANG_DIR constant was introduced in 2.1.0.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_set_lang_dir() {
+       if ( !defined( 'WP_LANG_DIR' ) ) {
+               if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) {
+                       define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
+                       if ( !defined( 'LANGDIR' ) ) {
+                               // Old static relative path maintained for limited backwards compatibility - won't work in some cases
+                               define( 'LANGDIR', 'wp-content/languages' );
+                       }
+               } else {
+                       define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
+                       if ( !defined( 'LANGDIR' ) ) {
+                               // Old relative path maintained for backwards compatibility
+                               define( 'LANGDIR', WPINC . '/languages' );
+                       }
+               }
+       }
+}
+
+/**
+ * Sets the database table prefix and the format specifiers for database table columns.
+ *
+ * Columns not listed here default to %s.
+ *
+ * @see wpdb::$field_types Since 2.8.0
+ * @see wpdb::prepare()
+ * @see wpdb::insert()
+ * @see wpdb::update()
+ * @see wpdb::set_prefix()
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_set_wpdb_vars() {
+       global $wpdb, $table_prefix;
+       if ( !empty( $wpdb->error ) )
+               dead_db();
+
+       $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
+               'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
+               'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
+               'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d',
+               // multisite:
+               'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d',
+       );
+
+       $prefix = $wpdb->set_prefix( $table_prefix );
+
+       if ( is_wp_error( $prefix ) )
+               wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );
+}
+
+/**
+ * Starts the WordPress object cache.
+ *
+ * If an object-cache.php file exists in the wp-content directory,
+ * it uses that drop-in as an external object cache.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_start_object_cache() {
+       global $_wp_using_ext_object_cache;
+
+       $first_init = false;
+       if ( ! function_exists( 'wp_cache_init' ) ) {
+               if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
+                       require_once ( WP_CONTENT_DIR . '/object-cache.php' );
+                       $_wp_using_ext_object_cache = true;
+               } else {
+                       require_once ( ABSPATH . WPINC . '/cache.php' );
+                       $_wp_using_ext_object_cache = false;
+               }
+               $first_init = true;
+       } else if ( !$_wp_using_ext_object_cache && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
+               // Sometimes advanced-cache.php can load object-cache.php before it is loaded here.
+               // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache
+               // being set incorrectly.  Double check if an external cache exists.
+               $_wp_using_ext_object_cache = true;
+       }
+
+       // If cache supports reset, reset instead of init if already initialized.
+       // Reset signals to the cache that global IDs have changed and it may need to update keys
+       // and cleanup caches.
+       if ( !$first_init && function_exists('wp_cache_reset') )
+               wp_cache_reset();
+       else
+               wp_cache_init();
+
+       if ( function_exists( 'wp_cache_add_global_groups' ) ) {
+               wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
+               wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
+       }
+}
+
+/**
+ * Redirects to the installer if WordPress is not installed.
+ *
+ * Dies with an error message when multisite is enabled.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_not_installed() {
+       if ( is_multisite() ) {
+               if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) )
+                       wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
+       } elseif ( ! is_blog_installed() && false === strpos( $_SERVER['PHP_SELF'], 'install.php' ) && !defined( 'WP_INSTALLING' ) ) {
+               if ( defined( 'WP_SITEURL' ) )
+                       $link = WP_SITEURL . '/wp-admin/install.php';
+               elseif ( false !== strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) )
+                       $link = preg_replace( '|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php';
+               else
+                       $link = preg_replace( '|/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php';
+               require( ABSPATH . WPINC . '/kses.php' );
+               require( ABSPATH . WPINC . '/pluggable.php' );
+               require( ABSPATH . WPINC . '/formatting.php' );
+               wp_redirect( $link );
+               die();
+       }
+}
+
+/**
+ * Returns array of must-use plugin files to be included in global scope.
+ *
+ * The default directory is wp-content/mu-plugins. To change the default directory
+ * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code>
+ * in wp-config.php.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return array Files to include
+ */
+function wp_get_mu_plugins() {
+       $mu_plugins = array();
+       if ( !is_dir( WPMU_PLUGIN_DIR ) )
+               return $mu_plugins;
+       if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
+               return $mu_plugins;
+       while ( ( $plugin = readdir( $dh ) ) !== false ) {
+               if ( substr( $plugin, -4 ) == '.php' )
+                       $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
+       }
+       closedir( $dh );
+       sort( $mu_plugins );
+
+       return $mu_plugins;
+}
+
+/**
+ * Returns array of plugin files to be included in global scope.
+ *
+ * The default directory is wp-content/plugins. To change the default directory
+ * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>
+ * in wp-config.php.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return array Files to include
+ */
+function wp_get_active_and_valid_plugins() {
+       $plugins = array();
+       $active_plugins = (array) get_option( 'active_plugins', array() );
+
+       // Get active network plugins
+       if ( is_multisite() ) {
+               $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
+               if ( !empty($active_sitewide_plugins) ) {
+                       $active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) );
+                       sort( $active_plugins );
+               }
+       }
+
+       // Check for hacks file if the option is enabled
+       if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
+               _deprecated_file( 'my-hacks.php', '1.5' );
+               array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
+       }
+
+       if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
+               return $plugins;
+
+       foreach ( $active_plugins as $plugin ) {
+               if ( ! validate_file( $plugin ) // $plugin must validate as file
+                       && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
+                       && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
+                       )
+               $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
+       }
+       return $plugins;
+}
+
+/**
+ * Sets internal encoding using mb_internal_encoding().
+ *
+ * In most cases the default internal encoding is latin1, which is of no use,
+ * since we want to use the mb_ functions for utf-8 strings.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_set_internal_encoding() {
+       if ( function_exists( 'mb_internal_encoding' ) ) {
+               if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) )
+                       mb_internal_encoding( 'UTF-8' );
+       }
+}
+
+/**
+ * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
+ *
+ * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
+ * or $_ENV are needed, use those superglobals directly.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_magic_quotes() {
+       // If already slashed, strip.
+       if ( get_magic_quotes_gpc() ) {
+               $_GET    = stripslashes_deep( $_GET    );
+               $_POST   = stripslashes_deep( $_POST   );
+               $_COOKIE = stripslashes_deep( $_COOKIE );
+       }
+
+       // Escape with wpdb.
+       $_GET    = add_magic_quotes( $_GET    );
+       $_POST   = add_magic_quotes( $_POST   );
+       $_COOKIE = add_magic_quotes( $_COOKIE );
+       $_SERVER = add_magic_quotes( $_SERVER );
+
+       // Force REQUEST to be GET + POST.
+       $_REQUEST = array_merge( $_GET, $_POST );
+}
+
+/**
+ * Runs just before PHP shuts down execution.
+ *
+ * @access private
+ * @since 1.2.0
+ */
+function shutdown_action_hook() {
+       do_action( 'shutdown' );
+       wp_cache_close();
+}
+
+/**
+ * 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;
+}
+
+/**
+ * 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;
+}
+
+/**
+ * Whether Multisite support is enabled
+ *
+ * @since 3.0.0
+ *
+ * @return bool True if multisite is enabled, false otherwise.
+ */
+function is_multisite() {
+       if ( defined( 'MULTISITE' ) )
+               return MULTISITE;
+
+       if ( defined( 'VHOST' ) || defined( 'SUNRISE' ) )
+               return true;
+
+       return false;
+}
+
+?>
index 7f5392c1bce5844e0223a022ca0ef5ad83110e4e..e69cbf5d29396966e9fb3773aba8d114f1c42c60 100644 (file)
@@ -105,65 +105,65 @@ class WP_Locale {
         */
        function init() {
                // The Weekdays
-               $this->weekday[0] = __('Sunday');
-               $this->weekday[1] = __('Monday');
-               $this->weekday[2] = __('Tuesday');
-               $this->weekday[3] = __('Wednesday');
-               $this->weekday[4] = __('Thursday');
-               $this->weekday[5] = __('Friday');
-               $this->weekday[6] = __('Saturday');
+               $this->weekday[0] = /* translators: weekday */ __('Sunday');
+               $this->weekday[1] = /* translators: weekday */ __('Monday');
+               $this->weekday[2] = /* translators: weekday */ __('Tuesday');
+               $this->weekday[3] = /* translators: weekday */ __('Wednesday');
+               $this->weekday[4] = /* translators: weekday */ __('Thursday');
+               $this->weekday[5] = /* translators: weekday */ __('Friday');
+               $this->weekday[6] = /* translators: weekday */ __('Saturday');
 
                // The first letter of each day.  The _%day%_initial suffix is a hack to make
                // sure the day initials are unique.
-               $this->weekday_initial[__('Sunday')]    = __('S_Sunday_initial');
-               $this->weekday_initial[__('Monday')]    = __('M_Monday_initial');
-               $this->weekday_initial[__('Tuesday')]   = __('T_Tuesday_initial');
-               $this->weekday_initial[__('Wednesday')] = __('W_Wednesday_initial');
-               $this->weekday_initial[__('Thursday')]  = __('T_Thursday_initial');
-               $this->weekday_initial[__('Friday')]    = __('F_Friday_initial');
-               $this->weekday_initial[__('Saturday')]  = __('S_Saturday_initial');
+               $this->weekday_initial[__('Sunday')]    = /* translators: one-letter abbreviation of the weekday */ __('S_Sunday_initial');
+               $this->weekday_initial[__('Monday')]    = /* translators: one-letter abbreviation of the weekday */ __('M_Monday_initial');
+               $this->weekday_initial[__('Tuesday')]   = /* translators: one-letter abbreviation of the weekday */ __('T_Tuesday_initial');
+               $this->weekday_initial[__('Wednesday')] = /* translators: one-letter abbreviation of the weekday */ __('W_Wednesday_initial');
+               $this->weekday_initial[__('Thursday')]  = /* translators: one-letter abbreviation of the weekday */ __('T_Thursday_initial');
+               $this->weekday_initial[__('Friday')]    = /* translators: one-letter abbreviation of the weekday */ __('F_Friday_initial');
+               $this->weekday_initial[__('Saturday')]  = /* translators: one-letter abbreviation of the weekday */ __('S_Saturday_initial');
 
                foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
                        $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
                }
 
                // Abbreviations for each day.
-               $this->weekday_abbrev[__('Sunday')]    = __('Sun');
-               $this->weekday_abbrev[__('Monday')]    = __('Mon');
-               $this->weekday_abbrev[__('Tuesday')]   = __('Tue');
-               $this->weekday_abbrev[__('Wednesday')] = __('Wed');
-               $this->weekday_abbrev[__('Thursday')]  = __('Thu');
-               $this->weekday_abbrev[__('Friday')]    = __('Fri');
-               $this->weekday_abbrev[__('Saturday')]  = __('Sat');
+               $this->weekday_abbrev[__('Sunday')]    = /* translators: three-letter abbreviation of the weekday */ __('Sun');
+               $this->weekday_abbrev[__('Monday')]    = /* translators: three-letter abbreviation of the weekday */ __('Mon');
+               $this->weekday_abbrev[__('Tuesday')]   = /* translators: three-letter abbreviation of the weekday */ __('Tue');
+               $this->weekday_abbrev[__('Wednesday')] = /* translators: three-letter abbreviation of the weekday */ __('Wed');
+               $this->weekday_abbrev[__('Thursday')]  = /* translators: three-letter abbreviation of the weekday */ __('Thu');
+               $this->weekday_abbrev[__('Friday')]    = /* translators: three-letter abbreviation of the weekday */ __('Fri');
+               $this->weekday_abbrev[__('Saturday')]  = /* translators: three-letter abbreviation of the weekday */ __('Sat');
 
                // The Months
-               $this->month['01'] = __('January');
-               $this->month['02'] = __('February');
-               $this->month['03'] = __('March');
-               $this->month['04'] = __('April');
-               $this->month['05'] = __('May');
-               $this->month['06'] = __('June');
-               $this->month['07'] = __('July');
-               $this->month['08'] = __('August');
-               $this->month['09'] = __('September');
-               $this->month['10'] = __('October');
-               $this->month['11'] = __('November');
-               $this->month['12'] = __('December');
+               $this->month['01'] = /* translators: month name */ __('January');
+               $this->month['02'] = /* translators: month name */ __('February');
+               $this->month['03'] = /* translators: month name */ __('March');
+               $this->month['04'] = /* translators: month name */ __('April');
+               $this->month['05'] = /* translators: month name */ __('May');
+               $this->month['06'] = /* translators: month name */ __('June');
+               $this->month['07'] = /* translators: month name */ __('July');
+               $this->month['08'] = /* translators: month name */ __('August');
+               $this->month['09'] = /* translators: month name */ __('September');
+               $this->month['10'] = /* translators: month name */ __('October');
+               $this->month['11'] = /* translators: month name */ __('November');
+               $this->month['12'] = /* translators: month name */ __('December');
 
                // Abbreviations for each month. Uses the same hack as above to get around the
                // 'May' duplication.
-               $this->month_abbrev[__('January')] = __('Jan_January_abbreviation');
-               $this->month_abbrev[__('February')] = __('Feb_February_abbreviation');
-               $this->month_abbrev[__('March')] = __('Mar_March_abbreviation');
-               $this->month_abbrev[__('April')] = __('Apr_April_abbreviation');
-               $this->month_abbrev[__('May')] = __('May_May_abbreviation');
-               $this->month_abbrev[__('June')] = __('Jun_June_abbreviation');
-               $this->month_abbrev[__('July')] = __('Jul_July_abbreviation');
-               $this->month_abbrev[__('August')] = __('Aug_August_abbreviation');
-               $this->month_abbrev[__('September')] = __('Sep_September_abbreviation');
-               $this->month_abbrev[__('October')] = __('Oct_October_abbreviation');
-               $this->month_abbrev[__('November')] = __('Nov_November_abbreviation');
-               $this->month_abbrev[__('December')] = __('Dec_December_abbreviation');
+               $this->month_abbrev[__('January')] = /* translators: three-letter abbreviation of the month */ __('Jan_January_abbreviation');
+               $this->month_abbrev[__('February')] = /* translators: three-letter abbreviation of the month */ __('Feb_February_abbreviation');
+               $this->month_abbrev[__('March')] = /* translators: three-letter abbreviation of the month */ __('Mar_March_abbreviation');
+               $this->month_abbrev[__('April')] = /* translators: three-letter abbreviation of the month */ __('Apr_April_abbreviation');
+               $this->month_abbrev[__('May')] = /* translators: three-letter abbreviation of the month */ __('May_May_abbreviation');
+               $this->month_abbrev[__('June')] = /* translators: three-letter abbreviation of the month */ __('Jun_June_abbreviation');
+               $this->month_abbrev[__('July')] = /* translators: three-letter abbreviation of the month */ __('Jul_July_abbreviation');
+               $this->month_abbrev[__('August')] = /* translators: three-letter abbreviation of the month */ __('Aug_August_abbreviation');
+               $this->month_abbrev[__('September')] = /* translators: three-letter abbreviation of the month */ __('Sep_September_abbreviation');
+               $this->month_abbrev[__('October')] = /* translators: three-letter abbreviation of the month */ __('Oct_October_abbreviation');
+               $this->month_abbrev[__('November')] = /* translators: three-letter abbreviation of the month */ __('Nov_November_abbreviation');
+               $this->month_abbrev[__('December')] = /* translators: three-letter abbreviation of the month */ __('Dec_December_abbreviation');
 
                foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
                        $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
@@ -178,18 +178,14 @@ class WP_Locale {
                // Numbers formatting
                // See http://php.net/number_format
 
-               /* translators: $decimals argument for http://php.net/number_format, default is 0 */
-               $trans = __('number_format_decimals');
-               $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
+               /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
+               $trans = __('number_format_thousands_sep');
+               $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
 
                /* translators: $dec_point argument for http://php.net/number_format, default is . */
                $trans = __('number_format_decimal_point');
                $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
 
-               /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
-               $trans = __('number_format_thousands_sep');
-               $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
-
                // Import global locale vars set during inclusion of $locale.php.
                foreach ( (array) $this->locale_vars as $var ) {
                        if ( isset($GLOBALS[$var]) )
@@ -330,6 +326,26 @@ class WP_Locale {
                $this->init();
                $this->register_globals();
        }
+       /**
+        * Checks if current locale is RTL.
+        *
+        * @since 3.0.0
+        * @return bool Whether locale is RTL.
+        */
+        function is_rtl() {
+               return 'rtl' == $this->text_direction;
+        }
+}
+
+/**
+ * Checks if current locale is RTL.
+ *
+ * @since 3.0.0
+ * @return bool Whether locale is RTL.
+ */
+function is_rtl() {
+       global $wp_locale;
+       return $wp_locale->is_rtl();
 }
 
 ?>
index 8f0bf3aaa1435e034986b2f7c0cf457d5791514f..ee4db93b32817aedb5dfccb4fb0e3dde4c87aa0a 100644 (file)
@@ -64,7 +64,7 @@ function image_constrain_size_for_editor($width, $height, $size = 'medium') {
        } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
                $max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
                $max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
-               if ( intval($content_width) > 0 )
+               if ( intval($content_width) > 0 && is_admin() ) // Only in admin. Assume that theme authors know what they're doing.
                        $max_width = min( intval($content_width), $max_width );
        }
        // $size == 'full' has no constraint
@@ -230,11 +230,38 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
        return $html;
 }
 
+/**
+ * Load an image from a string, if PHP supports it.
+ *
+ * @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 ) )
+               $file = get_attached_file( $file );
+
+       if ( ! file_exists( $file ) )
+               return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
+
+       if ( ! function_exists('imagecreatefromstring') )
+               return __('The GD image library is not installed.');
+
+       // Set artificially high because GD uses uncompressed images in memory
+       @ini_set('memory_limit', '256M');
+       $image = imagecreatefromstring( file_get_contents( $file ) );
+
+       if ( !is_resource( $image ) )
+               return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
+
+       return $image;
+}
+
 /**
  * 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
+ * If either width or height are empty, no constraint is applied on
  * that dimension.
  *
  * @since 2.5.0
@@ -250,17 +277,41 @@ function wp_constrain_dimensions( $current_width, $current_height, $max_width=0,
                return array( $current_width, $current_height );
 
        $width_ratio = $height_ratio = 1.0;
+       $did_width = $did_height = false;
 
-       if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width )
+       if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) {
                $width_ratio = $max_width / $current_width;
+               $did_width = true;
+       }
 
-       if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height )
+       if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) {
                $height_ratio = $max_height / $current_height;
+               $did_height = true;
+       }
 
-       // the smaller ratio is the one we need to fit it to the constraining box
-       $ratio = min( $width_ratio, $height_ratio );
-
-       return array( intval($current_width * $ratio), intval($current_height * $ratio) );
+       // Calculate the larger/smaller ratios
+       $smaller_ratio = min( $width_ratio, $height_ratio );
+       $larger_ratio  = max( $width_ratio, $height_ratio );
+
+       if ( intval( $current_width * $larger_ratio ) > $max_width || intval( $current_height * $larger_ratio ) > $max_height )
+               // The larger ratio is too big. It would result in an overflow.
+               $ratio = $smaller_ratio;
+       else
+               // The larger ratio fits, and is likely to be a more "snug" fit.
+               $ratio = $larger_ratio;
+
+       $w = intval( $current_width  * $ratio );
+       $h = intval( $current_height * $ratio );
+
+       // Sometimes, due to rounding, we'll end up with a result like this: 465x700 in a 177x177 box is 117x176... a pixel short
+       // We also have issues with recursive calls resulting in an ever-changing result. Contraining to the result of a constraint should yield the original result.
+       // Thus we look for dimensions that are one pixel shy of the max value and bump them up
+       if ( $did_width && $w == $max_width - 1 )
+               $w = $max_width; // Round it up
+       if ( $did_height && $h == $max_height - 1 )
+               $h = $max_height; // Round it up
+
+       return array( $w, $h );
 }
 
 /**
@@ -349,13 +400,13 @@ function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = fal
  * @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()}
+ * @return mixed WP_Error on failure. String with new destination path.
  */
 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
 
        $image = wp_load_image( $file );
        if ( !is_resource( $image ) )
-               return new WP_Error('error_loading_image', $image);
+               return new WP_Error( 'error_loading_image', $image, $file );
 
        $size = @getimagesize( $file );
        if ( !$size )
@@ -364,7 +415,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
 
        $dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop);
        if ( !$dims )
-               return $dims;
+               return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
        list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
 
        $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
@@ -372,7 +423,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
        imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
 
        // convert from full colors to index colors, like original PNG.
-       if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $image ) )
+       if ( IMAGETYPE_PNG == $orig_type && function_exists('imageistruecolor') && !imageistruecolor( $image ) )
                imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
 
        // we don't need the original in memory anymore
@@ -457,7 +508,13 @@ function image_make_intermediate_size($file, $width, $height, $crop=false) {
  *
  * The url path will be given, when the $size parameter is a string.
  *
+ * If you are passing an array for the $size, you should consider using
+ * add_image_size() so that a cropped version is generated. It's much more
+ * efficient than having to find the closest-sized image and then having the
+ * browser scale down the image.
+ *
  * @since 2.5.0
+ * @see add_image_size()
  *
  * @param int $post_id Attachment ID for image.
  * @param array|string $size Optional, default is 'thumbnail'. Size of image, either array or string.
@@ -485,6 +542,13 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
                        foreach ( $areas as $_size ) {
                                $data = $imagedata['sizes'][$_size];
                                if ( $data['width'] >= $size[0] || $data['height'] >= $size[1] ) {
+                                       // Skip images with unexpectedly divergent aspect ratios (crops)
+                                       // First, we calculate what size the original image would be if constrained to a box the size of the current image in the loop
+                                       $maybe_cropped = image_resize_dimensions($imagedata['width'], $imagedata['height'], $data['width'], $data['height'], false );
+                                       // If the size doesn't match within one pixel, then it is of a different aspect ratio, so we skip it, unless it's the thumbnail size
+                                       if ( 'thumbnail' != $_size && ( !$maybe_cropped || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] ) || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] ) ) )
+                                               continue;
+                                       // If we're still here, then we're going to use this size
                                        $file = $data['file'];
                                        list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
                                        return compact( 'file', 'width', 'height' );
@@ -506,6 +570,20 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
        return $data;
 }
 
+/**
+ * Get the available image sizes
+ * @since 3.0.0
+ * @return array Returns a filtered array of image size strings
+ */
+function get_intermediate_image_sizes() {
+       global $_wp_additional_image_sizes;
+       $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
+       if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
+               $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
+
+       return apply_filters( 'intermediate_image_sizes', $image_sizes );
+}
+
 /**
  * Retrieve an image to represent an attachment.
  *
@@ -539,6 +617,12 @@ function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon =
 /**
  * Get an HTML img element representing an image attachment
  *
+ * While $size will accept an array, it is better to register a size with
+ * add_image_size() so that a cropped version is generated. It's much more
+ * efficient than having to find the closest-sized image and then having the
+ * browser scale down the image.
+ *
+ * @see add_image_size()
  * @uses apply_filters() Calls 'wp_get_attachment_image_attributes' hook on attributes array
  * @uses wp_get_attachment_image_src() Gets attachment file URL and dimensions
  * @since 2.5.0
@@ -561,9 +645,14 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
                $default_attr = array(
                        'src'   => $src,
                        'class' => "attachment-$size",
-                       'alt'   => trim(strip_tags( $attachment->post_excerpt )),
+                       'alt'   => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
                        'title' => trim(strip_tags( $attachment->post_title )),
                );
+               if ( empty($default_attr['alt']) )
+                       $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
+               if ( empty($default_attr['alt']) )
+                       $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
+
                $attr = wp_parse_args($attr, $default_attr);
                $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
                $attr = array_map( 'esc_attr', $attr );
@@ -582,7 +671,6 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
  * Uses the begin_fetch_post_thumbnail_html and end_fetch_post_thumbnail_html action hooks to
  * dynamically add/remove itself so as to only filter post thumbnail thumbnails
  *
- * @author Mark Jaquith
  * @since 2.9.0
  * @param array $attr Attributes including src, class, alt, title
  * @return array
@@ -595,7 +683,6 @@ function _wp_post_thumbnail_class_filter( $attr ) {
 /**
  * Adds _wp_post_thumbnail_class_filter to the wp_get_attachment_image_attributes filter
  *
- * @author Mark Jaquith
  * @since 2.9.0
  */
 function _wp_post_thumbnail_class_filter_add( $attr ) {
@@ -605,7 +692,6 @@ function _wp_post_thumbnail_class_filter_add( $attr ) {
 /**
  * Removes _wp_post_thumbnail_class_filter from the wp_get_attachment_image_attributes filter
  *
- * @author Mark Jaquith
  * @since 2.9.0
  */
 function _wp_post_thumbnail_class_filter_remove( $attr ) {
@@ -731,8 +817,8 @@ function gallery_shortcode($attr) {
        $captiontag = tag_escape($captiontag);
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
-       $float = $wp_locale->text_direction == 'rtl' ? 'right' : 'left'; 
-       
+       $float = is_rtl() ? 'right' : 'left';
+
        $selector = "gallery-{$instance}";
 
        $output = apply_filters('gallery_style', "
@@ -945,6 +1031,9 @@ class WP_Embed {
                // Hack to get the [embed] shortcode to run before wpautop()
                add_filter( 'the_content', array(&$this, 'run_shortcode'), 8 );
 
+               // Shortcode placeholder for strip_shortcodes()
+               add_shortcode( 'embed', '__return_false' );
+
                // Attempts to embed all URLs in a post
                if ( get_option('embed_autourls') )
                        add_filter( 'the_content', array(&$this, 'autoembed'), 8 );
@@ -1099,7 +1188,7 @@ class WP_Embed {
                        }
 
                        // Use oEmbed to get the HTML
-                       $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) ) ? true : false;
+                       $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
                        $html = wp_oembed_get( $url, $attr );
 
                        // Cache the result
@@ -1232,15 +1321,20 @@ function wp_embed_defaults() {
 
        $width = get_option('embed_size_w');
 
-       if ( !$width && !empty($theme_width) )
+       if ( empty($width) && !empty($theme_width) )
                $width = $theme_width;
 
-       if ( !$width )
+       if ( empty($width) )
                $width = 500;
 
+       $height = get_option('embed_size_h');
+
+       if ( empty($height) )
+               $height = 700;
+
        return apply_filters( 'embed_defaults', array(
-               'width' => $width,
-               'height' => 700,
+               'width'  => $width,
+               'height' => $height,
        ) );
 }
 
@@ -1279,7 +1373,7 @@ function wp_expand_dimensions( $example_width, $example_height, $max_width, $max
  * @return string The original URL on failure or the embed HTML on success.
  */
 function wp_oembed_get( $url, $args = '' ) {
-       require_once( 'class-oembed.php' );
+       require_once( ABSPATH . WPINC . '/class-oembed.php' );
        $oembed = _wp_oembed_get_object();
        return $oembed->get_html( $url, $args );
 }
@@ -1294,10 +1388,10 @@ function wp_oembed_get( $url, $args = '' ) {
  *
  * @param string $format The format of URL that this provider can handle. You can use asterisks as wildcards.
  * @param string $provider The URL to the oEmbed provider.
- * @param boolean $regex Whether the $format parameter is in a regex format or not.
+ * @param boolean $regex Whether the $format parameter is in a regex format.
  */
 function wp_oembed_add_provider( $format, $provider, $regex = false ) {
-       require_once( 'class-oembed.php' );
+       require_once( ABSPATH . WPINC . '/class-oembed.php' );
        $oembed = _wp_oembed_get_object();
        $oembed->providers[$format] = array( $provider, $regex );
 }
index de34eef0b985d572d240136dd7d077439bd99327..67ea8611e157a0168ffe825a1bca39e4e600741e 100644 (file)
@@ -1,18 +1,40 @@
 <?php
 /**
- * Meta API
+ * Metadata API
  *
- * Functions for retrieving and manipulating metadata
+ * Functions for retrieving and manipulating metadata of various WordPress object types.  Metadata
+ * for an object is a represented by a simple key-value pair.  Objects may contain multiple
+ * metadata entries that share the same key and differ only in their value.
  *
  * @package WordPress
  * @subpackage Meta
  * @since 2.9.0
  */
 
+/**
+ * Add metadata for the specified object.
+ *
+ * @since 2.9.0
+ * @uses $wpdb WordPress database object for queries.
+ * @uses do_action() Calls 'added_{$meta_type}_meta' with meta_id of added metadata entry,
+ *             object ID, meta key, and meta value
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $object_id ID of the object metadata is for
+ * @param string $meta_key Metadata key
+ * @param string $meta_value Metadata value
+ * @param bool $unique Optional, default is false.  Whether the specified metadata key should be
+ *             unique for the object.  If true, and the object already has a value for the specified
+ *             metadata key, no change will be made
+ * @return bool True on successful update, false on failure.
+ */
 function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
        if ( !$meta_type || !$meta_key )
                return false;
 
+       if ( !$object_id = absint($object_id) )
+               return false;
+
        if ( ! $table = _get_meta_table($meta_type) )
                return false;
 
@@ -28,6 +50,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
                $meta_key, $object_id ) ) )
                return false;
 
+       $_meta_value = $meta_value;
        $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
        $wpdb->insert( $table, array(
@@ -37,16 +60,41 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
        ) );
 
        wp_cache_delete($object_id, $meta_type . '_meta');
+       // users cache stores usermeta that must be cleared.
+       if ( 'user' == $meta_type )
+               clean_user_cache($object_id);
 
-       do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $meta_value );
+       do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $_meta_value );
 
        return true;
 }
 
+/**
+ * Update metadata for the specified object.  If no value already exists for the specified object
+ * ID and metadata key, the metadata will be added.
+ *
+ * @since 2.9.0
+ * @uses $wpdb WordPress database object for queries.
+ * @uses do_action() Calls 'update_{$meta_type}_meta' before updating metadata with meta_id of
+ *             metadata entry to update, object ID, meta key, and meta value
+ * @uses do_action() Calls 'updated_{$meta_type}_meta' after updating metadata with meta_id of
+ *             updated metadata entry, object ID, meta key, and meta value
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $object_id ID of the object metadata is for
+ * @param string $meta_key Metadata key
+ * @param string $meta_value Metadata value
+ * @param string $prev_value Optional.  If specified, only update existing metadata entries with
+ *             the specified value.  Otherwise, update all entries.
+ * @return bool True on successful update, false on failure.
+ */
 function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
        if ( !$meta_type || !$meta_key )
                return false;
 
+       if ( !$object_id = absint($object_id) )
+               return false;
+
        if ( ! $table = _get_meta_table($meta_type) )
                return false;
 
@@ -61,6 +109,16 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
        if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )
                return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
 
+       // Compare existing value to new value if no prev value given and the key exists only once.
+       if ( empty($prev_value) ) {
+               $old_value = get_metadata($meta_type, $object_id, $meta_key);
+               if ( count($old_value) == 1 ) {
+                       if ( $old_value[0] == $meta_value )
+                               return false;
+               }
+       }
+
+       $_meta_value = $meta_value;
        $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
        $data  = compact( 'meta_value' );
@@ -71,18 +129,42 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
                $where['meta_value'] = $prev_value;
        }
 
-       do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value );
+       do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
 
        $wpdb->update( $table, $data, $where );
        wp_cache_delete($object_id, $meta_type . '_meta');
+       // users cache stores usermeta that must be cleared.
+       if ( 'user' == $meta_type )
+               clean_user_cache($object_id);
 
-       do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value );
+       do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
 
        return true;
 }
 
+/**
+ * Delete metadata for the specified object.
+ *
+ * @since 2.9.0
+ * @uses $wpdb WordPress database object for queries.
+ * @uses do_action() Calls 'deleted_{$meta_type}_meta' after deleting with meta_id of
+ *             deleted metadata entries, object ID, meta key, and meta value
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $object_id ID of the object metadata is for
+ * @param string $meta_key Metadata key
+ * @param string $meta_value Optional. Metadata value.  If specified, only delete metadata entries
+ *             with this value.  Otherwise, delete all entries with the specified meta_key.
+ * @param bool $delete_all Optional, default is false.  If true, delete matching metadata entries
+ *             for all objects, ignoring the specified object_id.  Otherwise, only delete matching
+ *             metadata entries for the specified object_id.
+ * @return bool True on successful delete, false on failure.
+ */
 function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
-       if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
+       if ( !$meta_type || !$meta_key )
+               return false;
+
+       if ( (!$object_id = absint($object_id)) && !$delete_all )
                return false;
 
        if ( ! $table = _get_meta_table($meta_type) )
@@ -116,16 +198,35 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
                return false;
 
        wp_cache_delete($object_id, $meta_type . '_meta');
+       // users cache stores usermeta that must be cleared.
+       if ( 'user' == $meta_type )
+               clean_user_cache($object_id);
 
        do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value );
 
        return true;
 }
 
+/**
+ * Retrieve metadata for the specified object.
+ *
+ * @since 2.9.0
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $object_id ID of the object metadata is for
+ * @param string $meta_key Optional.  Metadata key.  If not specified, retrieve all metadata for
+ *             the specified object.
+ * @param bool $single Optional, default is false.  If true, return only the first value of the
+ *             specified meta_key.  This parameter has no effect if meta_key is not specified.
+ * @return string|array Single metadata value, or array of values
+ */
 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
        if ( !$meta_type )
                return false;
 
+       if ( !$object_id = absint($object_id) )
+               return false;
+
        $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
 
        if ( !$meta_cache ) {
@@ -137,11 +238,10 @@ function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
                return $meta_cache;
 
        if ( isset($meta_cache[$meta_key]) ) {
-               if ( $single ) {
+               if ( $single )
                        return maybe_unserialize( $meta_cache[$meta_key][0] );
-               } else {
+               else
                        return array_map('maybe_unserialize', $meta_cache[$meta_key]);
-               }
        }
 
        if ($single)
@@ -150,6 +250,16 @@ function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
                return array();
 }
 
+/**
+ * Update the metadata cache for the specified objects.
+ *
+ * @since 2.9.0
+ * @uses $wpdb WordPress database object for queries.
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int|array $object_ids array or comma delimited list of object IDs to update cache for
+ * @return mixed Metadata cache for the specified objects, or false on failure.
+ */
 function update_meta_cache($meta_type, $object_ids) {
        if ( empty( $meta_type ) || empty( $object_ids ) )
                return false;
@@ -212,6 +322,15 @@ function update_meta_cache($meta_type, $object_ids) {
        return $cache;
 }
 
+/**
+ * Retrieve the name of the metadata table for the specified object type.
+ *
+ * @since 2.9.0
+ * @uses $wpdb WordPress database object for queries.
+ *
+ * @param string $meta_type Type of object to get metadata table for (e.g., comment, post, or user)
+ * @return mixed Metadata table name, or false if no metadata table exists
+ */
 function _get_meta_table($type) {
        global $wpdb;
 
diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php
new file mode 100644 (file)
index 0000000..80462f3
--- /dev/null
@@ -0,0 +1,542 @@
+<?php
+
+/**
+ * Site/blog functions that work with the blogs table and related data.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+// @todo use update_blog_details
+function wpmu_update_blogs_date() {
+       global $wpdb;
+
+       $wpdb->update( $wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $wpdb->blogid) );
+       refresh_blog_details( $wpdb->blogid );
+
+       do_action( 'wpmu_blog_updated', $wpdb->blogid );
+}
+
+function get_blogaddress_by_id( $blog_id ) {
+       $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
+       return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );
+}
+
+function get_blogaddress_by_name( $blogname ) {
+       global $current_site;
+
+       if ( is_subdomain_install() ) {
+               if ( $blogname == 'main' )
+                       $blogname = 'www';
+               $url = rtrim( network_home_url(), '/' );
+               if ( !empty( $blogname ) )
+                       $url = preg_replace( '|^([^\.]+://)|', '$1' . $blogname . '.', $url );
+       } else {
+               $url = network_home_url( $blogname );
+       }
+       return esc_url( $url . '/' );
+}
+
+function get_blogaddress_by_domain( $domain, $path ){
+       if ( is_subdomain_install() ) {
+               $url = "http://".$domain.$path;
+       } else {
+               if ( $domain != $_SERVER['HTTP_HOST'] ) {
+                       $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
+                       $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
+                       // we're not installing the main blog
+                       if ( $blogname != 'www.' )
+                               $url .= $blogname . '/';
+               } else { // main blog
+                       $url = 'http://' . $domain . $path;
+               }
+       }
+       return esc_url( $url );
+}
+
+function get_id_from_blogname( $name ) {
+       global $wpdb, $current_site;
+       $blog_id = wp_cache_get( "get_id_from_blogname_" . $name, 'blog-details' );
+       if ( $blog_id )
+               return $blog_id;
+
+       if ( is_subdomain_install() ) {
+               $domain = $name . '.' . $current_site->domain;
+               $path = $current_site->path;
+       } else {
+               $domain = $current_site->domain;
+               $path = $current_site->path . $name . '/';
+       }
+       $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) );
+       wp_cache_set( 'get_id_from_blogname_' . $name, $blog_id, 'blog-details' );
+       return $blog_id;
+}
+
+/**
+ * Retrieve the details for a blog from the blogs table and blog options.
+ *
+ * @since 3.0.0
+ * @param int|string|array $fields A blog ID, a blog name, or an array of fields to query against.
+ * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
+ * @return object Blog details.
+ */
+function get_blog_details( $fields, $get_all = true ) {
+       global $wpdb;
+
+       if ( is_array($fields ) ) {
+               if ( isset($fields['blog_id']) ) {
+                       $blog_id = $fields['blog_id'];
+               } elseif ( isset($fields['domain']) && isset($fields['path']) ) {
+                       $key = md5( $fields['domain'] . $fields['path'] );
+                       $blog = wp_cache_get($key, 'blog-lookup');
+                       if ( false !== $blog )
+                               return $blog;
+                       if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
+                               $nowww = substr( $fields['domain'], 4 );
+                               $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
+                       } else {
+                               $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) );
+                       }
+                       if ( $blog ) {
+                               wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
+                               $blog_id = $blog->blog_id;
+                       } else {
+                               return false;
+                       }
+               } elseif ( isset($fields['domain']) && is_subdomain_install() ) {
+                       $key = md5( $fields['domain'] );
+                       $blog = wp_cache_get($key, 'blog-lookup');
+                       if ( false !== $blog )
+                               return $blog;
+                       if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
+                               $nowww = substr( $fields['domain'], 4 );
+                               $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) );
+                       } else {
+                               $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) );
+                       }
+                       if ( $blog ) {
+                               wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
+                               $blog_id = $blog->blog_id;
+                       } else {
+                               return false;
+                       }
+               } else {
+                       return false;
+               }
+       } else {
+               if ( !is_numeric( $fields ) )
+                       $blog_id = get_id_from_blogname( $fields );
+               else
+                       $blog_id = $fields;
+       }
+
+       $blog_id = (int) $blog_id;
+
+       $all = $get_all == true ? '' : 'short';
+       $details = wp_cache_get( $blog_id . $all, 'blog-details' );
+
+       if ( $details ) {
+               if ( ! is_object( $details ) ) {
+                       if ( $details == -1 ) {
+                               return false;
+                       } else {
+                               // Clear old pre-serialized objects. Cache clients do better with that.
+                               wp_cache_delete( $blog_id . $all, 'blog-details' );
+                               unset($details);
+                       }
+               } else {
+                       return $details;
+               }
+       }
+
+       // Try the other cache.
+       if ( $get_all ) {
+               $details = wp_cache_get( $blog_id . 'short', 'blog-details' );
+       } else {
+               $details = wp_cache_get( $blog_id, 'blog-details' );
+               // If short was requested and full cache is set, we can return.
+               if ( $details ) {
+                       if ( ! is_object( $details ) ) {
+                               if ( $details == -1 ) {
+                                       return false;
+                               } else {
+                                       // Clear old pre-serialized objects. Cache clients do better with that.
+                                       wp_cache_delete( $blog_id, 'blog-details' );
+                                       unset($details);
+                               }
+                       } else {
+                               return $details;
+                       }
+               }
+       }
+
+       if ( empty($details) ) {
+               $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) );
+               if ( ! $details ) {
+                       // Set the full cache.
+                       wp_cache_set( $blog_id, -1, 'blog-details' );
+                       return false;
+               }
+       }
+
+       if ( ! $get_all ) {
+               wp_cache_set( $blog_id . $all, $details, 'blog-details' );
+               return $details;
+       }
+
+       $details->blogname              = get_blog_option( $blog_id, 'blogname' );
+       $details->siteurl               = get_blog_option( $blog_id, 'siteurl' );
+       $details->post_count    = get_blog_option( $blog_id, 'post_count' );
+
+       $details = apply_filters( 'blog_details', $details );
+
+       wp_cache_set( $blog_id . $all, $details, 'blog-details' );
+
+       $key = md5( $details->domain . $details->path );
+       wp_cache_set( $key, $details, 'blog-lookup' );
+
+       return $details;
+}
+
+/**
+ * Clear the blog details cache.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ */
+function refresh_blog_details( $blog_id ) {
+       $blog_id = (int) $blog_id;
+       $details = get_blog_details( $blog_id, false );
+
+       wp_cache_delete( $blog_id , 'blog-details' );
+       wp_cache_delete( $blog_id . 'short' , 'blog-details' );
+       wp_cache_delete( md5( $details->domain . $details->path )  , 'blog-lookup' );
+       wp_cache_delete( 'current_blog_' . $details->domain, 'site-options' );
+       wp_cache_delete( 'current_blog_' . $details->domain . $details->path, 'site-options' );
+}
+
+/**
+ * Update the details for a blog. Updates the blogs table for a given blog id.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ * @param array $details Array of details keyed by blogs table field names.
+ * @return bool True if update succeeds, false otherwise.
+ */
+function update_blog_details( $blog_id, $details = array() ) {
+       global $wpdb;
+
+       if ( empty($details) )
+               return false;
+
+       if ( is_object($details) )
+               $details = get_object_vars($details);
+
+       $current_details = get_blog_details($blog_id, false);
+       if ( empty($current_details) )
+               return false;
+
+       $current_details = get_object_vars($current_details);
+
+       $details = array_merge($current_details, $details);
+       $details['last_updated'] = current_time('mysql', true);
+
+       $update_details = array();
+       $fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
+       foreach ( array_intersect( array_keys( $details ), $fields ) as $field )
+               $update_details[$field] = $details[$field];
+
+       $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
+
+       // If spam status changed, issue actions.
+       if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) {
+               if ( $details[ 'spam' ] == 1 )
+                       do_action( "make_spam_blog", $blog_id );
+               else
+                       do_action( "make_ham_blog", $blog_id );
+       }
+
+       if ( isset($details[ 'public' ]) )
+               update_blog_option( $blog_id, 'blog_public', $details[ 'public' ], false );
+
+       refresh_blog_details($blog_id);
+
+       return true;
+}
+
+/**
+ * Retrieve option value based on setting name and blog_id.
+ *
+ * If the option does not exist or does not have a value, then the return value
+ * will be false. This is useful to check whether you need to install an option
+ * and is commonly used during installation of plugin options and to test
+ * whether upgrading is required.
+ *
+ * There is a filter called 'blog_option_$option' with the $option being
+ * replaced with the option name. The filter takes two parameters. $value and
+ * $blog_id. It returns $value.
+ * The 'option_$option' filter in get_option() is not called.
+ *
+ * @since NA
+ * @package WordPress MU
+ * @subpackage Option
+ * @uses apply_filters() Calls 'blog_option_$optionname' with the option name value.
+ *
+ * @param int $blog_id is the id of the blog.
+ * @param string $setting Name of option to retrieve. Should already be SQL-escaped
+ * @param string $default (optional) Default value returned if option not found.
+ * @return mixed Value set for the option.
+ */
+function get_blog_option( $blog_id, $setting, $default = false ) {
+       global $wpdb;
+
+       $key = $blog_id."-".$setting."-blog_option";
+       $value = wp_cache_get( $key, "site-options" );
+       if ( $value == null ) {
+               if ( $blog_id == $wpdb->blogid ) {
+                       $value = get_option( $setting, $default );
+                       $notoptions = wp_cache_get( 'notoptions', 'options' );
+                       if ( isset( $notoptions[$setting] ) ) {
+                               wp_cache_set( $key, 'noop', 'site-options' );
+                               $value = $default;
+                       } elseif ( $value == false ) {
+                               wp_cache_set( $key, 'falsevalue', 'site-options' );
+                       } else {
+                               wp_cache_set( $key, $value, 'site-options' );
+                       }
+                       return apply_filters( 'blog_option_' . $setting, $value, $blog_id );
+               } else {
+                       $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
+                       $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting ) );
+                       if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
+                               $value = $row->option_value;
+                               if ( $value == false )
+                                       wp_cache_set( $key, 'falsevalue', 'site-options' );
+                               else
+                                       wp_cache_set( $key, $value, 'site-options' );
+                       } else { // option does not exist, so we must cache its non-existence
+                               wp_cache_set( $key, 'noop', 'site-options' );
+                               $value = $default;
+                       }
+               }
+       } elseif ( $value == 'noop' ) {
+               $value = $default;
+       } elseif ( $value == 'falsevalue' ) {
+               $value = false;
+       }
+       // If home is not set use siteurl.
+       if ( 'home' == $setting && '' == $value )
+               return get_blog_option( $blog_id, 'siteurl' );
+
+       if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
+               $value = untrailingslashit( $value );
+
+       if (! @unserialize( $value ) )
+               $value = stripslashes( $value );
+
+       return apply_filters( 'blog_option_' . $setting, maybe_unserialize( $value ), $blog_id );
+}
+
+function add_blog_option( $id, $key, $value ) {
+       $id = (int) $id;
+
+       switch_to_blog($id);
+       add_option( $key, $value );
+       restore_current_blog();
+       wp_cache_set( $id."-".$key."-blog_option", $value, 'site-options' );
+}
+
+function delete_blog_option( $id, $key ) {
+       $id = (int) $id;
+
+       switch_to_blog($id);
+       delete_option( $key );
+       restore_current_blog();
+       wp_cache_set( $id."-".$key."-blog_option", '', 'site-options' );
+}
+
+function update_blog_option( $id, $key, $value, $refresh = true ) {
+       $id = (int) $id;
+
+       switch_to_blog($id);
+       update_option( $key, $value );
+       restore_current_blog();
+
+       if ( $refresh == true )
+               refresh_blog_details( $id );
+       wp_cache_set( $id."-".$key."-blog_option", $value, 'site-options');
+}
+
+function switch_to_blog( $new_blog, $validate = false ) {
+       global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
+
+       if ( empty($new_blog) )
+               $new_blog = $blog_id;
+
+       if ( $validate && ! get_blog_details( $new_blog ) )
+               return false;
+
+       if ( empty($switched_stack) )
+               $switched_stack = array();
+
+       $switched_stack[] = $blog_id;
+
+       /* If we're switching to the same blog id that we're on,
+       * set the right vars, do the associated actions, but skip
+       * the extra unnecessary work */
+       if ( $blog_id == $new_blog ) {
+               do_action( 'switch_blog', $blog_id, $blog_id );
+               $switched = true;
+               return true;
+       }
+
+       $wpdb->set_blog_id($new_blog);
+       $table_prefix = $wpdb->prefix;
+       $prev_blog_id = $blog_id;
+       $blog_id = $new_blog;
+
+       if ( is_object( $wp_roles ) ) {
+               $wpdb->suppress_errors();
+               if ( method_exists( $wp_roles ,'_init' ) )
+                       $wp_roles->_init();
+               elseif ( method_exists( $wp_roles, '__construct' ) )
+                       $wp_roles->__construct();
+               $wpdb->suppress_errors( false );
+       }
+
+       if ( is_object( $current_user ) )
+               $current_user->for_blog( $blog_id );
+
+       if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
+               $global_groups = $wp_object_cache->global_groups;
+       else
+               $global_groups = false;
+
+       wp_cache_init();
+       if ( function_exists('wp_cache_add_global_groups') ) {
+               if ( is_array( $global_groups ) )
+                       wp_cache_add_global_groups( $global_groups );
+               else
+                       wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'site-transient', 'global-posts' ) );
+               wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+       }
+
+       do_action('switch_blog', $blog_id, $prev_blog_id);
+       $switched = true;
+       return true;
+}
+
+function restore_current_blog() {
+       global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $current_user, $wp_object_cache;
+
+       if ( !$switched )
+               return false;
+
+       if ( !is_array( $switched_stack ) )
+               return false;
+
+       $blog = array_pop( $switched_stack );
+       if ( $blog_id == $blog ) {
+               do_action( 'switch_blog', $blog, $blog );
+               /* If we still have items in the switched stack, consider ourselves still 'switched' */
+               $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 );
+               return true;
+       }
+
+       $wpdb->set_blog_id($blog);
+       $prev_blog_id = $blog_id;
+       $blog_id = $blog;
+       $table_prefix = $wpdb->prefix;
+
+       if ( is_object( $wp_roles ) ) {
+               $wpdb->suppress_errors();
+               if ( method_exists( $wp_roles ,'_init' ) )
+                       $wp_roles->_init();
+               elseif ( method_exists( $wp_roles, '__construct' ) )
+                       $wp_roles->__construct();
+               $wpdb->suppress_errors( false );
+       }
+
+       if ( is_object( $current_user ) )
+               $current_user->for_blog( $blog_id );
+
+       if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
+               $global_groups = $wp_object_cache->global_groups;
+       else
+               $global_groups = false;
+
+       wp_cache_init();
+       if ( function_exists('wp_cache_add_global_groups') ) {
+               if ( is_array( $global_groups ) )
+                       wp_cache_add_global_groups( $global_groups );
+               else
+                       wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'site-transient' ) );
+               wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+       }
+
+       do_action('switch_blog', $blog_id, $prev_blog_id);
+
+       /* If we still have items in the switched stack, consider ourselves still 'switched' */
+       $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 );
+       return true;
+}
+
+function is_archived( $id ) {
+       return get_blog_status($id, 'archived');
+}
+
+function update_archived( $id, $archived ) {
+       update_blog_status($id, 'archived', $archived);
+       return $archived;
+}
+
+/**
+ * Update a blog details field.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id BLog ID
+ * @param string $pref A field name
+ * @param string $value Value for $pref
+ * @param bool $refresh Whether to refresh the blog details cache. Default is true.
+ */
+function update_blog_status( $blog_id, $pref, $value, $refresh = true ) {
+       global $wpdb;
+
+       if ( !in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) )
+               return $value;
+
+       $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
+
+       if ( $refresh )
+               refresh_blog_details($blog_id);
+
+       if ( $pref == 'spam' ) {
+               if ( $value == 1 )
+                       do_action( "make_spam_blog", $blog_id );
+               else
+                       do_action( "make_ham_blog", $blog_id );
+       }
+
+       return $value;
+}
+
+function get_blog_status( $id, $pref ) {
+       global $wpdb;
+
+       $details = get_blog_details( $id, false );
+       if ( $details )
+               return $details->$pref;
+
+       return $wpdb->get_var( $wpdb->prepare("SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id) );
+}
+
+function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
+       global $wpdb;
+       return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
+}
+
+?>
diff --git a/wp-includes/ms-default-constants.php b/wp-includes/ms-default-constants.php
new file mode 100644 (file)
index 0000000..12dc661
--- /dev/null
@@ -0,0 +1,140 @@
+<?php
+/**
+ * Defines constants and global variables that can be overridden, generally in wp-config.php.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/**
+ * Defines Multisite upload constants.
+ *
+ * @since 3.0.0
+ */
+function ms_upload_constants(  ) {
+       global $wpdb;
+
+       /** @since 3.0.0 */
+       // Base uploads dir relative to ABSPATH
+       if ( !defined( 'UPLOADBLOGSDIR' ) )
+               define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
+
+       /** @since 3.0.0 */
+       if ( !defined( 'UPLOADS' ) ) {
+               // Uploads dir relative to ABSPATH
+               define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
+               if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )
+                       define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
+       }
+}
+
+/**
+ * Defines Multisite cookie constants.
+ *
+ * @since 3.0.0
+ */
+function ms_cookie_constants(  ) {
+       global $current_site;
+
+       /**
+        * @since 1.2.0
+        */
+       if ( !defined( 'COOKIEPATH' ) )
+               define( 'COOKIEPATH', $current_site->path );
+
+       /**
+        * @since 1.5.0
+        */
+       if ( !defined( 'SITECOOKIEPATH' ) )
+               define( 'SITECOOKIEPATH', $current_site->path );
+
+       /**
+        * @since 2.6.0
+        */
+       if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
+               if( !is_subdomain_install() ) {
+                       define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
+               } else {
+                       define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
+               }
+       }
+
+       /**
+        * @since 2.0.0
+        */
+       if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
+               if ( !empty( $current_site->cookie_domain ) )
+                       define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
+               else
+                       define('COOKIE_DOMAIN', '.' . $current_site->domain);
+       }
+}
+
+/**
+ * Defines Multisite file constants.
+ *
+ * @since 3.0.0
+ */
+function ms_file_constants(  ) {
+       /**
+        * Optional support for X-Sendfile header
+        * @since 3.0.0
+        */
+       if ( !defined( 'WPMU_SENDFILE' ) )
+               define( 'WPMU_SENDFILE', false );
+
+       /**
+        * Optional support for X-Accel-Redirect header
+        * @since 3.0.0
+        */
+       if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
+               define( 'WPMU_ACCEL_REDIRECT', false );
+}
+
+/**
+ * Defines Multisite subdomain constants and handles warnings and notices.
+ *
+ * VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool.
+ *
+ * On first call, the constants are checked and defined. On second call,
+ * we will have translations loaded and can trigger warnings easily.
+ *
+ * @since 3.0.0
+ */
+function ms_subdomain_constants() {
+       static $error = null;
+       static $error_warn = false;
+
+       if ( false === $error )
+               return;
+
+       if ( $error ) {
+               $vhost_deprecated = __( 'The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' );
+               if ( $error_warn ) {
+                       trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING );
+               } else {
+                       _deprecated_argument( 'define()', '3.0', $vhost_deprecated );
+               }
+               return;
+       }
+
+       if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
+               if ( SUBDOMAIN_INSTALL == ( 'yes' == VHOST ) ) {
+                       $error = true;
+               } else {
+                       $error = $error_warn = true;
+               }
+       } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
+               define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
+       } elseif ( defined( 'VHOST' ) ) {
+               $error = true;
+               define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
+       } else {
+               define( 'SUBDOMAIN_INSTALL', false );
+               define( 'VHOST', 'no' );
+       }
+}
+add_action( 'init', 'ms_subdomain_constants' );
+
+?>
diff --git a/wp-includes/ms-default-filters.php b/wp-includes/ms-default-filters.php
new file mode 100644 (file)
index 0000000..b4d39ad
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Sets up the default filters and actions for Multisite.
+ *
+ * If you need to remove a default hook, this file will give you the priority
+ * for which to use to remove the hook.
+ *
+ * Not all of the Multisite default hooks are found in ms-default-filters.php
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @see default-filters.php
+ * @since 3.0.0
+ */
+
+// Users
+add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
+add_action( 'init', 'maybe_add_existing_user_to_blog' );
+add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
+add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
+add_action( 'sanitize_user', 'strtolower' );
+
+// Blogs
+add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
+add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
+add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
+
+// Register Nonce
+add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
+
+// Template
+add_action( 'template_redirect', 'maybe_redirect_404' );
+add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
+
+// Administration
+add_filter( 'term_id_filter', 'global_terms', 10, 2 );
+add_action( 'publish_post', 'update_posts_count' );
+add_action( 'delete_post', 'wpmu_update_blogs_date' );
+add_action( 'private_to_published', 'wpmu_update_blogs_date' );
+add_action( 'publish_phone', 'wpmu_update_blogs_date' );
+add_action( 'publish_post', 'wpmu_update_blogs_date' );
+
+// Files
+add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
+add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
+add_filter( 'upload_mimes', 'check_upload_mimes' );
+add_filter( 'upload_size_limit', 'upload_size_limit_filter' );
+
+// Mail
+add_filter( 'wp_mail_from', 'wordpressmu_wp_mail_from' );
+add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
+
+// Disable somethings by default for multisite
+add_filter( 'enable_update_services_configuration', '__return_false' );
+if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
+       add_filter( 'enable_post_by_email_configuration', '__return_false' );
+if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
+       add_filter( 'enable_edit_any_user_configuration', '__return_false' );
+
+// WP_HOME and WP_SITEURL should not have any effect in MS
+remove_filter( 'option_siteurl', '_config_wp_siteurl' );
+remove_filter( 'option_home',    '_config_wp_home'    );
+
+?>
diff --git a/wp-includes/ms-deprecated.php b/wp-includes/ms-deprecated.php
new file mode 100644 (file)
index 0000000..b607362
--- /dev/null
@@ -0,0 +1,203 @@
+<?php
+/**
+ * Deprecated functions from WordPress MU and the multisite feature. You shouldn't
+ * use these functions and look for the alternatives instead. The functions will be
+ * removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @since 3.0.0
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+/**
+ * @since unknown
+ * @deprecated 3.0.0
+ * @deprecated Use wp_generate_password()
+ * @see wp_generate_password()
+ */
+function generate_random_password( $len = 8 ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
+       return wp_generate_password( $len );
+}
+
+/**
+ * Determine if user is a site admin.
+ *
+ * Plugins should use is_multisite() instead of checking if this function exists
+ * to determine if multisite is enabled.
+ *
+ * This function must reside in a file included only if is_multisite() due to
+ * legacy function_exists() checks to determine if multisite is enabled.
+ *
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use is_super_admin()
+ * @see is_super_admin()
+ * @see is_multisite()
+ *
+ */
+function is_site_admin( $user_login = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
+
+       if ( empty( $user_login ) ) {
+               $user_id = get_current_user_id();
+               if ( !$user_id )
+                       return false;
+       } else {
+               $user = new WP_User( null, $user_login) ;
+               if ( empty( $user->id ) )
+                       return false;
+               $user_id = $user->id;
+       }
+
+       return is_super_admin( $user_id );
+}
+
+if ( !function_exists( 'graceful_fail' ) ) :
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use wp_die()
+ * @see wp_die()
+ */
+function graceful_fail( $message ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
+       $message = apply_filters( 'graceful_fail', $message );
+       $message_template = apply_filters( 'graceful_fail_template',
+'<!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 profile="http://gmpg.org/xfn/11">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Error!</title>
+<style type="text/css">
+img {
+       border: 0;
+}
+body {
+line-height: 1.6em; font-family: Georgia, serif; width: 390px; margin: auto;
+text-align: center;
+}
+.message {
+       font-size: 22px;
+       width: 350px;
+       margin: auto;
+}
+</style>
+</head>
+<body>
+<p class="message">%s</p>
+</body>
+</html>' );
+       die( sprintf( $message_template, $message ) );
+}
+endif;
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use get_user_by()
+ * @see get_user_by()
+ */
+function get_user_details( $username ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
+       return get_user_by('login', $username);
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use clean_post_cache()
+ * @see clean_post_cache()
+ */
+function clear_global_post_cache( $post_id ) {
+       _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use is_main_site()
+ * @see is_main_site()
+ */
+function is_main_blog() {
+       _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
+       return is_main_site();
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use is_email()
+ * @see is_email()
+ */
+function validate_email( $email, $check_domain = true) {
+       _deprecated_function( __FUNCTION__, '3.0', 'is_email()' );
+       return is_email( $email, $check_domain );
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Don't use this, really.
+ */
+function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
+       _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
+
+       global $wpdb;
+       $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
+
+       foreach ( (array) $blogs as $details ) {
+               $blog_list[ $details['blog_id'] ] = $details;
+               $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
+       }
+       unset( $blogs );
+       $blogs = $blog_list;
+
+       if ( false == is_array( $blogs ) )
+               return array();
+
+       if ( $num == 'all' )
+               return array_slice( $blogs, $start, count( $blogs ) );
+       else
+               return array_slice( $blogs, $start, $num );
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Don't use this, really.
+ */
+function get_most_active_blogs( $num = 10, $display = true ) {
+       _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
+
+       $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
+       if ( is_array( $blogs ) ) {
+               reset( $blogs );
+               foreach ( (array) $blogs as $key => $details ) {
+                       $most_active[ $details['blog_id'] ] = $details['postcount'];
+                       $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
+               }
+               arsort( $most_active );
+               reset( $most_active );
+               foreach ( (array) $most_active as $key => $details )
+                       $t[ $key ] = $blog_list[ $key ];
+
+               unset( $most_active );
+               $most_active = $t;
+       }
+
+       if ( $display == true ) {
+               if ( is_array( $most_active ) ) {
+                       reset( $most_active );
+                       foreach ( (array) $most_active as $key => $details ) {
+                               $url = esc_url('http://' . $details['domain'] . $details['path']);
+                               echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
+                       }
+               }
+       }
+       return array_slice( $most_active, 0, $num );
+}
+?>
diff --git a/wp-includes/ms-files.php b/wp-includes/ms-files.php
new file mode 100644 (file)
index 0000000..f5af8e0
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Multisite upload handler.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ */
+
+define( 'SHORTINIT', true );
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+if( !is_multisite() )
+       die( 'Multisite support not enabled' );
+
+ms_file_constants();
+
+error_reporting( 0 );
+
+if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
+       status_header( 404 );
+       die( '404 &#8212; File not found.' );
+}
+
+$file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
+if ( !is_file( $file ) ) {
+       status_header( 404 );
+       die( '404 &#8212; File not found.' );
+}
+
+$mime = wp_check_filetype( $_SERVER[ 'REQUEST_URI' ] );
+if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
+       $mime[ 'type' ] = mime_content_type( $file );
+
+if( $mime[ 'type' ] )
+       $mimetype = $mime[ 'type' ];
+else
+       $mimetype = 'image/' . substr( $_SERVER[ 'REQUEST_URI' ], strrpos( $_SERVER[ 'REQUEST_URI' ], '.' ) + 1 );
+
+header( 'Content-type: ' . $mimetype ); // always send this
+if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
+       header( 'Content-Length: ' . filesize( $file ) );
+
+// Optional support for X-Sendfile and X-Accel-Redirect
+if ( WPMU_ACCEL_REDIRECT ) {
+       header( 'X-Accel-Redirect: ' . str_replace( WP_CONTENT_DIR, '', $file ) );
+       exit;
+} elseif ( WPMU_SENDFILE ) {
+       header( 'X-Sendfile: ' . $file );
+       exit;
+}
+
+$last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) );
+$etag = '"' . md5( $last_modified ) . '"';
+header( "Last-Modified: $last_modified GMT" );
+header( 'ETag: ' . $etag );
+header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' );
+
+// Support for Conditional GET
+$client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;
+
+if( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
+       $_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
+
+$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
+// If string is empty, return 0. If not, attempt to parse into a timestamp
+$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;
+
+// Make a timestamp for our most recent modification...
+$modified_timestamp = strtotime($last_modified);
+
+if ( ( $client_last_modified && $client_etag )
+       ? ( ( $client_modified_timestamp >= $modified_timestamp) && ( $client_etag == $etag ) )
+       : ( ( $client_modified_timestamp >= $modified_timestamp) || ( $client_etag == $etag ) )
+       ) {
+       status_header( 304 );
+       exit;
+}
+
+// If we made it this far, just serve the file
+readfile( $file );
+?>
diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php
new file mode 100644 (file)
index 0000000..cd9fbdc
--- /dev/null
@@ -0,0 +1,1446 @@
+<?php
+/**
+ * Multi-site WordPress API
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+function get_sitestats() {
+       global $wpdb;
+
+       $stats['blogs'] = get_blog_count();
+
+       $count_ts = get_site_option( 'user_count_ts' );
+       if ( time() - $count_ts > 3600 ) {
+               $count = $wpdb->get_var( "SELECT COUNT(ID) FROM $wpdb->users" );
+               update_site_option( 'user_count', $count );
+               update_site_option( 'user_count_ts', time() );
+       } else {
+               $count = get_site_option( 'user_count' );
+       }
+       $stats['users'] = $count;
+       return $stats;
+}
+
+function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
+       global $wpdb;
+
+       if ( ! $sitedomain )
+               $site_id = $wpdb->siteid;
+       else
+               $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) );
+
+       if ( $site_id )
+               return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $site_id ), ARRAY_A );
+
+       return false;
+}
+
+function get_blogs_of_user( $id, $all = false ) {
+       global $wpdb;
+
+       $cache_suffix = $all ? '_all' : '_short';
+       $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' );
+       if ( $return )
+               return apply_filters( 'get_blogs_of_user', $return, $id, $all );
+
+       $user = get_userdata( (int) $id );
+       if ( !$user )
+               return false;
+
+       $blogs = $match = array();
+       $prefix_length = strlen($wpdb->base_prefix);
+       foreach ( (array) $user as $key => $value ) {
+               if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix )
+                       continue;
+               if ( substr($key, -12, 12) != 'capabilities' )
+                       continue;
+               if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) {
+                       if ( count( $match ) > 2 )
+                               $blog_id = $match[ 2 ];
+                       else
+                               $blog_id = 1;
+                       $blog = get_blog_details( $blog_id );
+                       if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) {
+                               $blogs[ $blog_id ]->userblog_id = $blog_id;
+                               $blogs[ $blog_id ]->blogname            = $blog->blogname;
+                               $blogs[ $blog_id ]->domain              = $blog->domain;
+                               $blogs[ $blog_id ]->path                        = $blog->path;
+                               $blogs[ $blog_id ]->site_id             = $blog->site_id;
+                               $blogs[ $blog_id ]->siteurl             = $blog->siteurl;
+                       }
+               }
+       }
+
+       wp_cache_add( 'blogs_of_user_' . $id . $cache_suffix, $blogs, 'users', 5 );
+       return apply_filters( 'get_blogs_of_user', $blogs, $id, $all );
+}
+
+function get_active_blog_for_user( $user_id ) { // get an active blog for user - either primary blog or from blogs list
+       global $wpdb;
+       $blogs = get_blogs_of_user( $user_id );
+       if ( empty( $blogs ) ) {
+               $details = get_dashboard_blog();
+               add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
+               update_user_meta( $user_id, 'primary_blog', $details->blog_id );
+               wp_cache_delete( $user_id, 'users' );
+               return $details;
+       }
+
+       $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
+       $details = get_dashboard_blog();
+       if ( $primary_blog ) {
+               $blogs = get_blogs_of_user( $user_id );
+               if ( isset( $blogs[ $primary_blog ] ) == false ) {
+                       add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
+                       update_user_meta( $user_id, 'primary_blog', $details->blog_id );
+                       wp_cache_delete( $user_id, 'users' );
+               } else {
+                       $details = get_blog_details( $primary_blog );
+               }
+       } else {
+               add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
+               update_user_meta( $user_id, 'primary_blog', $details->blog_id );
+       }
+
+       if ( ( is_object( $details ) == false ) || ( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) ) {
+               $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
+               $ret = false;
+               if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
+                       foreach ( (array) $blogs as $blog_id => $blog ) {
+                               if ( $blog->site_id != $wpdb->siteid )
+                                       continue;
+                               $details = get_blog_details( $blog_id );
+                               if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
+                                       $ret = $blog;
+                                       $changed = false;
+                                       if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
+                                               update_user_meta( $user_id, 'primary_blog', $blog_id );
+                                               $changed = true;
+                                       }
+                                       if ( !get_user_meta($user_id , 'source_domain', true) ) {
+                                               update_user_meta( $user_id, 'source_domain', $blog->domain );
+                                               $changed = true;
+                                       }
+                                       if ( $changed )
+                                               wp_cache_delete( $user_id, 'users' );
+                                       break;
+                               }
+                       }
+               } else {
+                       // Should never get here
+                       $dashboard_blog = get_dashboard_blog();
+                       add_user_to_blog( $dashboard_blog->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
+                       update_user_meta( $user_id, 'primary_blog', $dashboard_blog->blog_id );
+                       return $dashboard_blog;
+               }
+               return $ret;
+       } else {
+               return $details;
+       }
+}
+
+function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
+       $user_id = (int) $user_id;
+       $blog_id = (int) $blog_id;
+
+       if ( $blog_id == 0 ) {
+               global $wpdb;
+               $blog_id = $wpdb->blogid;
+       }
+
+       $blogs = get_blogs_of_user( $user_id );
+       if ( is_array( $blogs ) )
+               return array_key_exists( $blog_id, $blogs );
+       else
+               return false;
+}
+
+function get_user_count() {
+       global $wpdb;
+
+       $count_ts = get_site_option( 'user_count_ts' );
+       if ( time() - $count_ts > 3600 ) {
+               $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'") );
+               update_site_option( 'user_count', $count );
+               update_site_option( 'user_count_ts', time() );
+       }
+
+       $count = get_site_option( 'user_count' );
+
+       return $count;
+}
+
+function get_blog_count( $id = 0 ) {
+       global $wpdb;
+
+       if ( $id == 0 )
+               $id = $wpdb->siteid;
+
+       $count_ts = get_site_option( 'blog_count_ts' );
+       if ( time() - $count_ts > 3600 ) {
+               $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $id) );
+               update_site_option( 'blog_count', $count );
+               update_site_option( 'blog_count_ts', time() );
+       }
+
+       $count = get_site_option( 'blog_count' );
+
+       return $count;
+}
+
+function get_blog_post( $blog_id, $post_id ) {
+       global $wpdb;
+
+       $key = $blog_id . '-' . $post_id;
+       $post = wp_cache_get( $key, 'global-posts' );
+       if ( $post == false ) {
+               $post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) );
+               wp_cache_add( $key, $post, 'global-posts' );
+       }
+
+       return $post;
+}
+
+function add_user_to_blog( $blog_id, $user_id, $role ) {
+       switch_to_blog($blog_id);
+
+       $user = new WP_User($user_id);
+
+       if ( empty($user) || !$user->ID )
+               return new WP_Error('user_does_not_exist', __('That user does not exist.'));
+
+       if ( !get_user_meta($user_id, 'primary_blog', true) ) {
+               update_user_meta($user_id, 'primary_blog', $blog_id);
+               $details = get_blog_details($blog_id);
+               update_user_meta($user_id, 'source_domain', $details->domain);
+       }
+
+       $user->set_role($role);
+
+       do_action('add_user_to_blog', $user_id, $role, $blog_id);
+       wp_cache_delete( $user_id, 'users' );
+       restore_current_blog();
+       return true;
+}
+
+function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
+       global $wpdb;
+       switch_to_blog($blog_id);
+       $user_id = (int) $user_id;
+       do_action('remove_user_from_blog', $user_id, $blog_id);
+
+       // If being removed from the primary blog, set a new primary if the user is assigned
+       // to multiple blogs.
+       $primary_blog = get_user_meta($user_id, 'primary_blog', true);
+       if ( $primary_blog == $blog_id ) {
+               $new_id = '';
+               $new_domain = '';
+               $blogs = get_blogs_of_user($user_id);
+               foreach ( (array) $blogs as $blog ) {
+                       if ( $blog->userblog_id == $blog_id )
+                               continue;
+                       $new_id = $blog->userblog_id;
+                       $new_domain = $blog->domain;
+                       break;
+               }
+
+               update_user_meta($user_id, 'primary_blog', $new_id);
+               update_user_meta($user_id, 'source_domain', $new_domain);
+       }
+
+       // wp_revoke_user($user_id);
+       $user = new WP_User($user_id);
+       $user->remove_all_caps();
+
+       $blogs = get_blogs_of_user($user_id);
+       if ( count($blogs) == 0 ) {
+               update_user_meta($user_id, 'primary_blog', '');
+               update_user_meta($user_id, 'source_domain', '');
+       }
+
+       if ( $reassign != '' ) {
+               $reassign = (int) $reassign;
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
+       }
+
+       restore_current_blog();
+}
+
+function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
+       $domain                 = addslashes( $domain );
+       $weblog_title   = addslashes( $weblog_title );
+
+       if ( empty($path) )
+               $path = '/';
+
+       // Check if the domain has been used already. We should return an error message.
+       if ( domain_exists($domain, $path, $site_id) )
+               return __( 'Error: Site URL already taken.' );
+
+       // Need to backup wpdb table names, and create a new wp_blogs entry for new blog.
+       // Need to get blog_id from wp_blogs, and create new table names.
+       // Must restore table names at the end of function.
+
+       if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
+               return __( 'Error: problem creating site entry.' );
+
+       switch_to_blog($blog_id);
+       install_blog($blog_id);
+       restore_current_blog();
+
+       return $blog_id;
+}
+
+function get_blog_permalink( $_blog_id, $post_id ) {
+       $key = "{$_blog_id}-{$post_id}-blog_permalink";
+       $link = wp_cache_get( $key, 'site-options' );
+       if ( $link == false ) {
+               switch_to_blog( $_blog_id );
+               $link = get_permalink( $post_id );
+               restore_current_blog();
+               wp_cache_add( $key, $link, 'site-options', 360 );
+       }
+       return $link;
+}
+
+function get_blog_id_from_url( $domain, $path = '/' ) {
+       global $wpdb;
+
+       $domain = strtolower( $wpdb->escape( $domain ) );
+       $path = strtolower( $wpdb->escape( $path ) );
+       $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
+
+       if ( $id == -1 ) { // blog does not exist
+               return 0;
+       } elseif ( $id ) {
+               return (int)$id;
+       }
+
+       $id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs WHERE domain = '$domain' and path = '$path' /* get_blog_id_from_url */" );
+
+       if ( !$id ) {
+               wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
+               return false;
+       }
+       wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
+
+       return $id;
+}
+
+// wpmu admin functions
+
+function wpmu_admin_do_redirect( $url = '' ) {
+       $ref = '';
+       if ( isset( $_GET['ref'] ) )
+               $ref = $_GET['ref'];
+       if ( isset( $_POST['ref'] ) )
+               $ref = $_POST['ref'];
+
+       if ( $ref ) {
+               $ref = wpmu_admin_redirect_add_updated_param( $ref );
+               wp_redirect( $ref );
+               exit();
+       }
+       if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
+               wp_redirect( $_SERVER['HTTP_REFERER'] );
+               exit();
+       }
+
+       $url = wpmu_admin_redirect_add_updated_param( $url );
+       if ( isset( $_GET['redirect'] ) ) {
+               if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
+                       $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
+       } elseif ( isset( $_POST['redirect'] ) ) {
+               $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
+       }
+       wp_redirect( $url );
+       exit();
+}
+
+function wpmu_admin_redirect_add_updated_param( $url = '' ) {
+       if ( strpos( $url, 'updated=true' ) === false ) {
+               if ( strpos( $url, '?' ) === false )
+                       return $url . '?updated=true';
+               else
+                       return $url . '&updated=true';
+       }
+       return $url;
+}
+
+function is_blog_user( $blog_id = 0 ) {
+       global $current_user, $wpdb;
+
+       if ( !$blog_id )
+               $blog_id = $wpdb->blogid;
+
+       $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
+
+       if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
+               return true;
+
+       return false;
+}
+
+function is_email_address_unsafe( $user_email ) {
+       $banned_names = get_site_option( 'banned_email_domains' );
+       if ($banned_names && !is_array( $banned_names ))
+               $banned_names = explode( "\n", $banned_names);
+
+       if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
+               $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
+               foreach ( (array) $banned_names as $banned_domain ) {
+                       if ( $banned_domain == '' )
+                               continue;
+                       if (
+                               strstr( $email_domain, $banned_domain ) ||
+                               (
+                                       strstr( $banned_domain, '/' ) &&
+                                       preg_match( $banned_domain, $email_domain )
+                               )
+                       )
+                       return true;
+               }
+       }
+       return false;
+}
+
+function wpmu_validate_user_signup($user_name, $user_email) {
+       global $wpdb;
+
+       $errors = new WP_Error();
+
+       $orig_username = $user_name;
+       $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
+       $maybe = array();
+       preg_match( '/[a-z0-9]+/', $user_name, $maybe );
+
+       if ( $user_name != $orig_username || $user_name != $maybe[0] ) {
+               $errors->add( 'user_name', __( "Only the lowercase letters a-z and numbers allowed" ) );
+               $user_name = $orig_username;
+       }
+
+       $user_email = sanitize_email( $user_email );
+
+       if ( empty( $user_name ) )
+               $errors->add('user_name', __('Please enter a username'));
+
+       $illegal_names = get_site_option( 'illegal_names' );
+       if ( is_array( $illegal_names ) == false ) {
+               $illegal_names = array(  'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
+               add_site_option( 'illegal_names', $illegal_names );
+       }
+       if ( in_array( $user_name, $illegal_names ) == true )
+               $errors->add('user_name',  __('That username is not allowed'));
+
+       if ( is_email_address_unsafe( $user_email ) )
+               $errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
+
+       if ( strlen( $user_name ) < 4 )
+               $errors->add('user_name',  __('Username must be at least 4 characters'));
+
+       if ( strpos( ' ' . $user_name, '_' ) != false )
+               $errors->add( 'user_name', __( 'Sorry, usernames may not contain the character &#8220;_&#8221;!' ) );
+
+       // all numeric?
+       $match = array();
+       preg_match( '/[0-9]*/', $user_name, $match );
+       if ( $match[0] == $user_name )
+               $errors->add('user_name', __('Sorry, usernames must have letters too!'));
+
+       if ( !is_email( $user_email ) )
+               $errors->add('user_email', __('Please enter a correct email address'));
+
+       $limited_email_domains = get_site_option( 'limited_email_domains' );
+       if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
+               $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
+               if ( in_array( $emaildomain, $limited_email_domains ) == false )
+                       $errors->add('user_email', __('Sorry, that email address is not allowed!'));
+       }
+
+       // Check if the username has been used already.
+       if ( username_exists($user_name) )
+               $errors->add('user_name', __('Sorry, that username already exists!'));
+
+       // Check if the email address has been used already.
+       if ( email_exists($user_email) )
+               $errors->add('user_email', __('Sorry, that email address is already used!'));
+
+       // Has someone already signed up for this username?
+       $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
+       if ( $signup != null ) {
+               $registered_at =  mysql2date('U', $signup->registered);
+               $now = current_time( 'timestamp', true );
+               $diff = $now - $registered_at;
+               // If registered more than two days ago, cancel registration and let this signup go through.
+               if ( $diff > 172800 )
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_login = %s", $user_name) );
+               else
+                       $errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
+
+               if ( $signup->active == 0 && $signup->user_email == $user_email )
+                       $errors->add('user_email_used', __('username and email used'));
+       }
+
+       $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
+       if ( $signup != null ) {
+               $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
+               // If registered more than two days ago, cancel registration and let this signup go through.
+               if ( $diff > 172800 )
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_email = %s", $user_email) );
+               else
+                       $errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
+       }
+
+       $result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
+
+       return apply_filters('wpmu_validate_user_signup', $result);
+}
+
+function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
+       global $wpdb, $domain, $base, $current_site;
+
+       $blog_title = strip_tags( $blog_title );
+       $blog_title = substr( $blog_title, 0, 50 );
+
+       $errors = new WP_Error();
+       $illegal_names = get_site_option( 'illegal_names' );
+       if ( $illegal_names == false ) {
+               $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
+               add_site_option( 'illegal_names', $illegal_names );
+       }
+
+       // On sub dir installs, Some names are so illegal, only a filter can spring them from jail
+       if (! is_subdomain_install() )
+               $illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) );
+
+
+       if ( empty( $blogname ) )
+               $errors->add('blogname', __('Please enter a site name'));
+
+       $maybe = array();
+       preg_match( '/[a-z0-9]+/', $blogname, $maybe );
+       if ( $blogname != $maybe[0] )
+               $errors->add('blogname', __('Only lowercase letters and numbers allowed'));
+
+       if ( in_array( $blogname, $illegal_names ) == true )
+               $errors->add('blogname',  __('That name is not allowed'));
+
+       if ( strlen( $blogname ) < 4 && !is_super_admin() )
+               $errors->add('blogname',  __('Site name must be at least 4 characters'));
+
+       if ( strpos( ' ' . $blogname, '_' ) != false )
+               $errors->add( 'blogname', __( 'Sorry, site names may not contain the character &#8220;_&#8221;!' ) );
+
+       // do not allow users to create a blog that conflicts with a page on the main blog.
+       if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
+               $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
+
+       // all numeric?
+       $match = array();
+       preg_match( '/[0-9]*/', $blogname, $match );
+       if ( $match[0] == $blogname )
+               $errors->add('blogname', __('Sorry, site names must have letters too!'));
+
+       $blogname = apply_filters( 'newblogname', $blogname );
+
+       $blog_title = stripslashes(  $blog_title );
+
+       if ( empty( $blog_title ) )
+               $errors->add('blog_title', __('Please enter a site title'));
+
+       // Check if the domain/path has been used already.
+       if ( is_subdomain_install() ) {
+               $mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain );
+               $path = $base;
+       } else {
+               $mydomain = "$domain";
+               $path = $base.$blogname.'/';
+       }
+       if ( domain_exists($mydomain, $path) )
+               $errors->add('blogname', __('Sorry, that site already exists!'));
+
+       if ( username_exists( $blogname ) ) {
+               if ( is_object( $user ) == false || ( is_object($user) && ( $user->user_login != $blogname ) ) )
+                       $errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
+       }
+
+       // Has someone already signed up for this domain?
+       $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); // TODO: Check email too?
+       if ( ! empty($signup) ) {
+               $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
+               // If registered more than two days ago, cancel registration and let this signup go through.
+               if ( $diff > 172800 )
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) );
+               else
+                       $errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
+       }
+
+       $result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors);
+       return apply_filters('wpmu_validate_blog_signup', $result);
+}
+
+// Record signup information for future activation. wpmu_validate_signup() should be run
+// on the inputs before calling wpmu_signup().
+function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = '') {
+       global $wpdb;
+
+       $key = substr( md5( time() . rand() . $domain ), 0, 16 );
+       $meta = serialize($meta);
+       $domain = $wpdb->escape($domain);
+       $path = $wpdb->escape($path);
+       $title = $wpdb->escape($title);
+
+       $wpdb->insert( $wpdb->signups, array(
+               'domain' => $domain,
+               'path' => $path,
+               'title' => $title,
+               'user_login' => $user,
+               'user_email' => $user_email,
+               'registered' => current_time('mysql', true),
+               'activation_key' => $key,
+               'meta' => $meta
+       ) );
+
+       wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta);
+}
+
+function wpmu_signup_user($user, $user_email, $meta = '') {
+       global $wpdb;
+
+       // Format data
+       $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
+       $user_email = sanitize_email( $user_email );
+       $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
+       $meta = serialize($meta);
+
+       $wpdb->insert( $wpdb->signups, array(
+               'domain' => '',
+               'path' => '',
+               'title' => '',
+               'user_login' => $user,
+               'user_email' => $user_email,
+               'registered' => current_time('mysql', true),
+               'activation_key' => $key,
+               'meta' => $meta
+       ) );
+
+       wpmu_signup_user_notification($user, $user_email, $key, $meta);
+}
+
+// Notify user of signup success.
+function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') {
+       global $current_site;
+
+       if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
+               return false;
+
+       // Send email with activation link.
+       if ( !is_subdomain_install() || $current_site->id != 1 )
+               $activate_url = network_site_url("wp-activate.php?key=$key");
+       else
+               $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
+
+       $activate_url = esc_url($activate_url);
+       $admin_email = get_site_option( 'admin_email' );
+       if ( $admin_email == '' )
+               $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+       $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
+       $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
+       $message = sprintf( apply_filters( 'wpmu_signup_blog_notification_email', __( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s" ) ), $activate_url, esc_url( "http://{$domain}{$path}" ), $key );
+       // TODO: Don't hard code activation link.
+       $subject = sprintf( apply_filters( 'wpmu_signup_blog_notification_subject', __( '[%1s] Activate %2s' ) ), $from_name, esc_url( 'http://' . $domain . $path ) );
+       wp_mail($user_email, $subject, $message, $message_headers);
+       return true;
+}
+
+function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
+       if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
+               return false;
+
+       // Send email with activation link.
+       $admin_email = get_site_option( 'admin_email' );
+       if ( $admin_email == '' )
+               $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+       $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
+       $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
+       $message = sprintf( apply_filters( 'wpmu_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n" ) ), site_url( "wp-activate.php?key=$key" ), $key );
+       // TODO: Don't hard code activation link.
+       $subject = sprintf( __( apply_filters( 'wpmu_signup_user_notification_subject', '[%1s] Activate %2s' ) ), $from_name, $user);
+       wp_mail($user_email, $subject, $message, $message_headers);
+       return true;
+}
+
+function wpmu_activate_signup($key) {
+       global $wpdb, $current_site;
+
+       $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
+
+       if ( empty($signup) )
+               return new WP_Error('invalid_key', __('Invalid activation key.'));
+
+       if ( $signup->active )
+               return new WP_Error('already_active', __('The site is already active.'), $signup);
+
+       $meta = unserialize($signup->meta);
+       $user_login = $wpdb->escape($signup->user_login);
+       $user_email = $wpdb->escape($signup->user_email);
+       $password = wp_generate_password();
+
+       $user_id = username_exists($user_login);
+
+       if ( ! $user_id )
+               $user_id = wpmu_create_user($user_login, $password, $user_email);
+       else
+               $user_already_exists = true;
+
+       if ( ! $user_id )
+               return new WP_Error('create_user', __('Could not create user'), $signup);
+
+       $now = current_time('mysql', true);
+
+       if ( empty($signup->domain) ) {
+               $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
+
+               if ( isset( $user_already_exists ) )
+                       return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
+
+               wpmu_welcome_user_notification($user_id, $password, $meta);
+               $user_site = get_site_option( 'dashboard_blog', $current_site->blog_id );
+
+               if ( $user_site == false )
+                       add_user_to_blog( '1', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
+               else
+                       add_user_to_blog( $user_site, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
+
+               add_new_user_to_blog( $user_id, $user_email, $meta );
+               do_action('wpmu_activate_user', $user_id, $password, $meta);
+               return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
+       }
+
+       $blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
+
+       // TODO: What to do if we create a user but cannot create a blog?
+       if ( is_wp_error($blog_id) ) {
+               // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
+               // setting the activation flag.  Let's just set the active flag and instruct the user to reset their password.
+               if ( 'blog_taken' == $blog_id->get_error_code() ) {
+                       $blog_id->add_data( $signup );
+                       $wpdb->update( $wpdb->signups, array( 'active' => 1, 'activated' => $now ), array( 'activation_key' => $key ) );
+               }
+               return $blog_id;
+       }
+
+       $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
+       wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
+       do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta);
+
+       return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
+}
+
+function wpmu_create_user( $user_name, $password, $email) {
+       $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
+
+       $user_id = wp_create_user( $user_name, $password, $email );
+       if ( is_wp_error($user_id) )
+               return false;
+
+       // Newly created users have no roles or caps until they are added to a blog.
+       delete_user_option( $user_id, 'capabilities' );
+       delete_user_option( $user_id, 'user_level' );
+
+       do_action( 'wpmu_new_user', $user_id );
+
+       return $user_id;
+}
+
+function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) {
+       $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
+
+       if ( is_subdomain_install() )
+               $domain = str_replace( '@', '', $domain );
+
+       $title = strip_tags( $title );
+       $user_id = (int) $user_id;
+
+       if ( empty($path) )
+               $path = '/';
+
+       // Check if the domain has been used already. We should return an error message.
+       if ( domain_exists($domain, $path, $site_id) )
+               return new WP_Error('blog_taken', __('Site already exists.'));
+
+       if ( !defined('WP_INSTALLING') )
+               define( 'WP_INSTALLING', true );
+
+       if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
+               return new WP_Error('insert_blog', __('Could not create site.'));
+
+       switch_to_blog($blog_id);
+       install_blog($blog_id, $title);
+       wp_install_defaults($user_id);
+
+       add_user_to_blog($blog_id, $user_id, 'administrator');
+
+       if ( is_array($meta) ) foreach ($meta as $key => $value) {
+               if ( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' )
+                       update_blog_status( $blog_id, $key, $value );
+               else
+                       update_option( $key, $value );
+       }
+
+       add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
+       update_option( 'blog_public', (int)$meta['public'] );
+
+       if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog', true ) == get_site_option( 'dashboard_blog', 1 ) )
+               update_user_meta( $user_id, 'primary_blog', $blog_id );
+
+       restore_current_blog();
+       do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta );
+
+       return $blog_id;
+}
+
+function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
+       if ( get_site_option( 'registrationnotification' ) != 'yes' )
+               return false;
+
+       $email = get_site_option( 'admin_email' );
+       if ( is_email($email) == false )
+               return false;
+
+       $options_site_url = esc_url(network_admin_url('ms-options.php'));
+
+       switch_to_blog( $blog_id );
+       $blogname = get_option( 'blogname' );
+       $siteurl = site_url();
+       restore_current_blog();
+
+       $msg = sprintf( __( 'New Site: %1s
+URL: %2s
+Remote IP: %3s
+
+Disable these notifications: %4s' ), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url);
+       $msg = apply_filters( 'newblog_notify_siteadmin', $msg );
+
+       wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg );
+       return true;
+}
+
+function newuser_notify_siteadmin( $user_id ) {
+       if ( get_site_option( 'registrationnotification' ) != 'yes' )
+               return false;
+
+       $email = get_site_option( 'admin_email' );
+
+       if ( is_email($email) == false )
+               return false;
+
+       $user = new WP_User($user_id);
+
+       $options_site_url = esc_url(network_admin_url('ms-options.php'));
+       $msg = sprintf(__('New User: %1s
+Remote IP: %2s
+
+Disable these notifications: %3s'), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url);
+
+       $msg = apply_filters( 'newuser_notify_siteadmin', $msg );
+       wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg );
+       return true;
+}
+
+function domain_exists($domain, $path, $site_id = 1) {
+       global $wpdb;
+       return $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
+}
+
+function insert_blog($domain, $path, $site_id) {
+       global $wpdb;
+
+       $path = trailingslashit($path);
+       $site_id = (int) $site_id;
+
+       $result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
+       if ( ! $result )
+               return false;
+
+       refresh_blog_details($wpdb->insert_id);
+       return $wpdb->insert_id;
+}
+
+// Install an empty blog.  wpdb should already be switched.
+function install_blog($blog_id, $blog_title = '') {
+       global $wpdb, $table_prefix, $wp_roles;
+       $wpdb->suppress_errors();
+
+       // Cast for security
+       $blog_id = (int) $blog_id;
+
+       require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+       if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
+               die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
+
+       $wpdb->suppress_errors(false);
+
+       $url = get_blogaddress_by_id($blog_id);
+
+       // Set everything up
+       make_db_current_silent();
+       populate_options();
+       populate_roles();
+       $wp_roles->_init();
+
+       // fix url.
+       update_option('siteurl', $url);
+       update_option('home', $url);
+       update_option('fileupload_url', $url . "files" );
+       update_option('upload_path', "wp-content/blogs.dir/" . $blog_id . "/files");
+       update_option('blogname', stripslashes( $blog_title ) );
+       update_option('admin_email', '');
+       $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );
+
+       // remove all perms
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'user_level') );
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'capabilities') );
+
+       $wpdb->suppress_errors( false );
+}
+
+// Deprecated, use wp_install_defaults()
+// should be switched already as $blog_id is ignored.
+function install_blog_defaults($blog_id, $user_id) {
+       global $wpdb;
+
+       require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+       $wpdb->suppress_errors();
+
+       wp_install_defaults($user_id);
+
+       $wpdb->suppress_errors( false );
+}
+
+function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') {
+       global $current_site;
+
+       if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
+               return false;
+
+       $welcome_email = stripslashes( get_site_option( 'welcome_email' ) );
+       if ( $welcome_email == false )
+               $welcome_email = stripslashes( __( 'Dear User,
+
+Your new SITE_NAME site has been successfully set up at:
+BLOG_URL
+
+You can log in to the administrator account with the following information:
+Username: USERNAME
+Password: PASSWORD
+Login Here: BLOG_URLwp-login.php
+
+We hope you enjoy your new site.
+Thanks!
+
+--The Team @ SITE_NAME' ) );
+
+       $url = get_blogaddress_by_id($blog_id);
+       $user = new WP_User($user_id);
+
+       $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
+       $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
+       $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
+       $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
+       $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
+
+       $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta);
+       $admin_email = get_site_option( 'admin_email' );
+
+       if ( $admin_email == '' )
+               $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+
+       $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
+       $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
+       $message = $welcome_email;
+
+       if ( empty( $current_site->site_name ) )
+               $current_site->site_name = 'WordPress MU';
+
+       $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, stripslashes( $title ) ) );
+       wp_mail($user->user_email, $subject, $message, $message_headers);
+       return true;
+}
+
+function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
+       global $current_site;
+
+       if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
+               return false;
+
+       $welcome_email = get_site_option( 'welcome_user_email' );
+
+       $user = new WP_User($user_id);
+
+       $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
+       $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
+       $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
+       $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
+       $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
+
+       $admin_email = get_site_option( 'admin_email' );
+
+       if ( $admin_email == '' )
+               $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+
+       $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
+       $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
+       $message = $welcome_email;
+
+       if ( empty( $current_site->site_name ) )
+               $current_site->site_name = 'WordPress MU';
+
+       $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login) );
+       wp_mail($user->user_email, $subject, $message, $message_headers);
+       return true;
+}
+
+function get_current_site() {
+       global $current_site;
+       return $current_site;
+}
+
+function get_user_id_from_string( $string ) {
+       $user_id = 0;
+       if ( is_email( $string ) ) {
+               $user = get_user_by('email', $string);
+               if ( $user )
+                       $user_id = $user->ID;
+       } elseif ( is_numeric( $string ) ) {
+               $user_id = $string;
+       } else {
+               $user = get_user_by('login', $string);
+               if ( $user )
+                       $user_id = $user->ID;
+       }
+
+       return $user_id;
+}
+
+function get_most_recent_post_of_user( $user_id ) {
+       global $wpdb;
+
+       $user_blogs = get_blogs_of_user( (int) $user_id );
+       $most_recent_post = array();
+
+       // Walk through each blog and get the most recent post
+       // published by $user_id
+       foreach ( (array) $user_blogs as $blog ) {
+               $recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$wpdb->base_prefix}{$blog->userblog_id}_posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A);
+
+               // Make sure we found a post
+               if ( isset($recent_post['ID']) ) {
+                       $post_gmt_ts = strtotime($recent_post['post_date_gmt']);
+
+                       // If this is the first post checked or if this post is
+                       // newer than the current recent post, make it the new
+                       // most recent post.
+                       if ( !isset($most_recent_post['post_gmt_ts']) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
+                               $most_recent_post = array(
+                                       'blog_id'               => $blog->userblog_id,
+                                       'post_id'               => $recent_post['ID'],
+                                       'post_date_gmt' => $recent_post['post_date_gmt'],
+                                       'post_gmt_ts'   => $post_gmt_ts
+                               );
+                       }
+               }
+       }
+
+       return $most_recent_post;
+}
+
+/* Misc functions */
+function get_dirsize( $directory ) {
+       $dirsize = get_transient( 'dirsize_cache' );
+       if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
+               return $dirsize[ $directory ][ 'size' ];
+
+       if ( false == is_array( $dirsize ) )
+               $dirsize = array();
+
+       $dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
+
+       set_transient( 'dirsize_cache', $dirsize, 3600 );
+       return $dirsize[ $directory ][ 'size' ];
+}
+
+function recurse_dirsize( $directory ) {
+       $size = 0;
+
+       if ( substr( $directory, -1 ) == '/' )
+               $directory = substr($directory,0,-1);
+
+       if ( !file_exists($directory) || !is_dir( $directory ) || !is_readable( $directory ) )
+               return false;
+
+       if ($handle = opendir($directory)) {
+               while(($file = readdir($handle)) !== false) {
+                       $path = $directory.'/'.$file;
+                       if ($file != '.' && $file != '..') {
+                               if (is_file($path)) {
+                                       $size += filesize($path);
+                               } elseif (is_dir($path)) {
+                                       $handlesize = recurse_dirsize($path);
+                                       if ($handlesize > 0)
+                                               $size += $handlesize;
+                               }
+                       }
+               }
+               closedir($handle);
+       }
+       return $size;
+}
+
+function upload_is_user_over_quota( $echo = true ) {
+       if ( get_site_option( 'upload_space_check_disabled' ) )
+               return true;
+
+       $spaceAllowed = get_space_allowed();
+       if ( empty( $spaceAllowed ) || !is_numeric( $spaceAllowed ) )
+               $spaceAllowed = 10;     // Default space allowed is 10 MB
+
+       $dirName = BLOGUPLOADDIR;
+       $size = get_dirsize($dirName) / 1024 / 1024;
+
+       if ( ($spaceAllowed-$size) < 0 ) {
+               if ( $echo )
+                       _e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' ); // No space left
+               return true;
+       } else {
+               return false;
+       }
+}
+
+function check_upload_mimes( $mimes ) {
+       $site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );
+       foreach ( $site_exts as $ext ) {
+               foreach ( $mimes as $ext_pattern => $mime ) {
+                       if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
+                               $site_mimes[$ext_pattern] = $mime;
+               }
+       }
+       return $site_mimes;
+}
+
+function update_posts_count( $deprecated = '' ) {
+       global $wpdb;
+       update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
+}
+
+function wpmu_log_new_registrations( $blog_id, $user_id ) {
+       global $wpdb;
+       $user = new WP_User( (int) $user_id );
+       $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
+}
+
+function fix_import_form_size( $size ) {
+       if ( upload_is_user_over_quota( false ) == true )
+               return 0;
+
+       $spaceAllowed = 1024 * 1024 * get_space_allowed();
+       $dirName = BLOGUPLOADDIR;
+       $dirsize = get_dirsize($dirName) ;
+       if ( $size > $spaceAllowed - $dirsize )
+               return $spaceAllowed - $dirsize; // remaining space
+       else
+               return $size; // default
+}
+
+/**
+ * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
+ *
+ * @since 3.0.0
+ *
+ * @see term_id_filter
+ *
+ * @param int $term_id An ID for a term on the current blog.
+ * @return int An ID from the global terms table mapped from $term_id.
+ */
+function global_terms( $term_id, $deprecated = '' ) {
+       global $wpdb;
+       static $global_terms_recurse = null;
+
+       if ( !global_terms_enabled() )
+               return $term_id;
+
+       // prevent a race condition
+       $recurse_start = false;
+       if ( $global_terms_recurse === null ) {
+               $recurse_start = true;
+               $global_terms_recurse = 1;
+       } elseif ( 10 < $global_terms_recurse++ ) {
+               return $term_id;
+       }
+
+       $term_id = intval( $term_id );
+       $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
+
+       $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
+       if ( $global_id == null ) {
+               $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
+               if ( null == $used_global_id ) {
+                       $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
+                       $global_id = $wpdb->insert_id;
+                       if ( empty( $global_id ) )
+                               return $term_id;
+               } else {
+                       $max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
+                       $max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
+                       $new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );
+                       $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
+                       $global_id = $wpdb->insert_id;
+               }
+       } elseif ( $global_id != $term_id ) {
+               $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
+               if ( null != $local_id )
+                       $local_id = global_terms( $local_id );
+                       if ( 10 < $global_terms_recurse )
+                               $global_id = $term_id;
+       }
+
+       if ( $global_id != $term_id ) {
+               if ( get_option( 'default_category' ) == $term_id )
+                       update_option( 'default_category', $global_id );
+
+               $wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
+               $wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
+               $wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );
+
+               clean_term_cache($term_id);
+       }
+       if( $recurse_start )
+               $global_terms_recurse = null;
+
+       return $global_id;
+}
+
+function redirect_this_site( $deprecated = '' ) {
+       global $current_site;
+       return array( $current_site->domain );
+}
+
+function upload_is_file_too_big( $upload ) {
+       if ( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) )
+               return $upload;
+
+       if ( strlen( $upload['bits'] )  > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
+               return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));
+
+       return $upload;
+}
+
+function wordpressmu_wp_mail_from( $email ) {
+       if ( strpos( $email, 'wordpress@' ) !== false )
+               $email = get_option( 'admin_email' );
+       return $email;
+}
+
+function signup_nonce_fields() {
+       $id = mt_rand();
+       echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
+       wp_nonce_field('signup_form_' . $id, '_signup_form', false);
+}
+
+function signup_nonce_check( $result ) {
+       if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
+               return $result;
+
+       if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
+               wp_die( __('Please try again!') );
+
+       return $result;
+}
+
+function maybe_redirect_404() {
+       global $current_site;
+       if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
+               if ( $destination == '%siteurl%' )
+                       $destination = network_home_url();
+               wp_redirect( $destination );
+               exit();
+       }
+}
+
+function maybe_add_existing_user_to_blog() {
+       if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
+               return false;
+
+       $parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
+       $key = array_pop( $parts );
+
+       if ( $key == '' )
+               $key = array_pop( $parts );
+
+       $details = get_option( 'new_user_' . $key );
+       if ( !empty( $details ) )
+               delete_option( 'new_user_' . $key );
+
+       if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
+               wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), site_url() ) );
+
+       wp_die( sprintf(__('You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">login</a> using your username and password.'), site_url(), admin_url() ), __('Success') );
+}
+
+function add_existing_user_to_blog( $details = false ) {
+       if ( is_array( $details ) ) {
+               $result = add_user_to_blog( '', $details[ 'user_id' ], $details[ 'role' ] );
+               do_action( 'added_existing_user', $details[ 'user_id' ], $result );
+       }
+       return $result;
+}
+
+function add_new_user_to_blog( $user_id, $email, $meta ) {
+       global $current_site;
+       if ( $meta[ 'add_to_blog' ] ) {
+               $blog_id = $meta[ 'add_to_blog' ];
+               $role = $meta[ 'new_role' ];
+               remove_user_from_blog($user_id, $current_site->blogid); // remove user from main blog.
+               add_user_to_blog( $blog_id, $user_id, $role );
+               update_user_meta( $user_id, 'primary_blog', $blog_id );
+       }
+}
+
+function fix_phpmailer_messageid( $phpmailer ) {
+       global $current_site;
+       $phpmailer->Hostname = $current_site->domain;
+}
+
+function is_user_spammy( $username = 0 ) {
+       if ( $username == 0 ) {
+               global $current_user;
+               $user_id = $current_user->ID;
+       } else {
+               $user_id = get_user_id_from_string( $username );
+       }
+       $u = new WP_User( $user_id );
+
+       if ( $u->spam == 1 )
+               return true;
+
+       return false;
+}
+
+function update_blog_public( $old_value, $value ) {
+       global $wpdb;
+       do_action('update_blog_public');
+       update_blog_status( $wpdb->blogid, 'public', (int) $value );
+}
+add_action('update_option_blog_public', 'update_blog_public', 10, 2);
+
+/* Redirect all hits to "dashboard" blog to wp-admin/ Dashboard. */
+function redirect_mu_dashboard() {
+       global $current_site, $current_blog;
+
+       $dashboard_blog = get_dashboard_blog();
+       if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
+               $protocol = ( is_ssl() ? 'https://' : 'http://' );
+               wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' );
+               die();
+       }
+}
+add_action( 'template_redirect', 'redirect_mu_dashboard' );
+
+function get_dashboard_blog() {
+       if ( $blog = get_site_option( 'dashboard_blog' ) )
+               return get_blog_details( $blog );
+
+       return get_blog_details( $GLOBALS['current_site']->blog_id );
+}
+
+function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
+       global $current_user, $wpdb;
+
+       if ( $user_id == 0 )
+               $user_id = $current_user->ID;
+       if ( $blog_id == 0 )
+               $blog_id = $wpdb->blogid;
+
+       $local_key = $wpdb->base_prefix . $blog_id . '_' . $key;
+
+       if ( isset( $current_user->$local_key ) )
+               return true;
+
+       return false;
+}
+
+function users_can_register_signup_filter() {
+       $registration = get_site_option('registration');
+       if ( $registration == 'all' || $registration == 'user' )
+               return true;
+
+       return false;
+}
+add_filter('option_users_can_register', 'users_can_register_signup_filter');
+
+function welcome_user_msg_filter( $text ) {
+       if ( !$text ) {
+               return __( 'Dear User,
+
+Your new account is set up.
+
+You can log in with the following information:
+Username: USERNAME
+Password: PASSWORD
+LOGINLINK
+
+Thanks!
+
+--The Team @ SITE_NAME' );
+       }
+       return $text;
+}
+add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
+
+/**
+ * Whether to force SSL on content.
+ *
+ * @since 2.8.5
+ *
+ * @param string|bool $force
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_content( $force = '' ) {
+       static $forced_content;
+
+       if ( '' != $force ) {
+               $old_forced = $forced_content;
+               $forced_content = $force;
+               return $old_forced;
+       }
+
+       return $forced_content;
+}
+
+/**
+ * Formats an String URL to use HTTPS if HTTP is found.
+ * Useful as a filter.
+ *
+ * @since 2.8.5
+ **/
+function filter_SSL( $url ) {
+       if ( !is_string( $url ) )
+               return get_bloginfo( 'url' ); //return home blog url with proper scheme
+
+       $arrURL = parse_url( $url );
+
+       if ( force_ssl_content() && is_ssl() ) {
+               if ( 'http' === $arrURL['scheme'] && 'https' !== $arrURL['scheme'] )
+                       $url = str_replace( $arrURL['scheme'], 'https', $url );
+       }
+
+       return $url;
+}
+
+?>
diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php
new file mode 100644 (file)
index 0000000..bcb075c
--- /dev/null
@@ -0,0 +1,228 @@
+<?php
+/**
+ * These functions are needed to load Multisite.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ */
+
+/**
+ * Whether a subdomain configuration is enabled.
+ *
+ * @since 3.0.0
+ *
+ * @return bool True if subdomain configuration is enabled, false otherwise.
+ */
+function is_subdomain_install() {
+       if ( defined('SUBDOMAIN_INSTALL') )
+               return SUBDOMAIN_INSTALL;
+
+       if ( defined('VHOST') && VHOST == 'yes' )
+               return true;
+
+       return false;
+}
+
+/**
+ * Checks status of current blog.
+ *
+ * Checks if the blog is deleted, inactive, archived, or spammed.
+ *
+ * Dies with a default message if the blog does not pass the check.
+ *
+ * To change the default message when a blog does not pass the check,
+ * use the wp-content/blog-deleted.php, blog-inactive.php and
+ * blog-suspended.php drop-ins.
+ *
+ * @return bool|string Returns true on success, or drop-in file to include.
+ */
+function ms_site_check() {
+       global $wpdb, $current_blog;
+
+       // Allow short-circuiting
+       $check = apply_filters('ms_site_check', null);
+       if ( null !== $check )
+               return true;
+
+       // Allow super admins to see blocked sites
+       if ( is_super_admin() )
+               return true;
+
+       if ( '1' == $current_blog->deleted ) {
+               if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
+                       return WP_CONTENT_DIR . '/blog-deleted.php';
+               } else {
+                       header( 'HTTP/1.1 410 Gone' );
+                       wp_die( /*WP_I18N_USER_DELETED_BLOG*/'This user has elected to delete their account and the content is no longer available.'/*/WP_I18N_USER_DELETED_BLOG*/ );
+               }
+       }
+
+       if ( '2' == $current_blog->deleted ) {
+               if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
+                       return WP_CONTENT_DIR . '/blog-inactive.php';
+               else
+                       wp_die( sprintf( /*WP_I18N_BLOG_NOT_ACTIVATED*/'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.'/*/WP_I18N_BLOG_NOT_ACTIVATED*/, str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
+       }
+
+       if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
+               if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
+                       return WP_CONTENT_DIR . '/blog-suspended.php';
+               } else {
+                       header( 'HTTP/1.1 410 Gone' );
+                       wp_die( /*WP_I18N_ARCHIVED*/'This site has been archived or suspended.'/*/WP_I18N_ARCHIVED*/ );
+               }
+       }
+
+       return true;
+}
+
+/**
+ * Sets current site name.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return object $current_site object with site_name
+ */
+function get_current_site_name( $current_site ) {
+       global $wpdb;
+       $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', 'site-options' );
+       if ( ! $current_site->site_name ) {
+               $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' );
+               if ( ! $current_site->site_name ) {
+                       $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
+                       if ( ! $current_site->site_name )
+                               $current_site->site_name = ucfirst( $current_site->domain );
+               }
+               wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );
+       }
+       return $current_site;
+}
+
+/**
+ * Sets current_site object.
+ *
+ * @access private
+ * @since 3.0.0
+ * @return object $current_site object
+ */
+function wpmu_current_site() {
+       global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
+       if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
+               $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
+               $current_site->domain = DOMAIN_CURRENT_SITE;
+               $current_site->path   = $path = PATH_CURRENT_SITE;
+               if ( defined( 'BLOG_ID_CURRENT_SITE' ) )
+                       $current_site->blog_id = BLOG_ID_CURRENT_SITE;
+               elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated.
+                       $current_site->blog_id = BLOGID_CURRENT_SITE;
+               if ( DOMAIN_CURRENT_SITE == $domain )
+                       $current_site->cookie_domain = $cookie_domain;
+               elseif ( substr( $current_site->domain, 0, 4 ) == 'www.' )
+                       $current_site->cookie_domain = substr( $current_site->domain, 4 );
+               else
+                       $current_site->cookie_domain = $current_site->domain;
+
+               wp_load_core_site_options( $current_site->id );
+
+               return $current_site;
+       }
+
+       $current_site = wp_cache_get( 'current_site', 'site-options' );
+       if ( $current_site )
+               return $current_site;
+
+       $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
+       if ( 1 == count( $sites ) ) {
+               $current_site = $sites[0];
+               wp_load_core_site_options( $current_site->id );
+               $path = $current_site->path;
+               $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );
+               $current_site = get_current_site_name( $current_site );
+               if ( substr( $current_site->domain, 0, 4 ) == 'www.' )
+                       $current_site->cookie_domain = substr( $current_site->domain, 4 );
+               wp_cache_set( 'current_site', $current_site, 'site-options' );
+               return $current_site;
+       }
+       $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
+
+       if ( $domain == $cookie_domain )
+               $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
+       else
+               $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) );
+
+       if ( ! $current_site ) {
+               if ( $domain == $cookie_domain )
+                       $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) );
+               else
+                       $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = '/' ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) );
+       }
+
+       if ( $current_site ) {
+               $path = $current_site->path;
+               $current_site->cookie_domain = $cookie_domain;
+               return $current_site;
+       }
+
+       if ( is_subdomain_install() ) {
+               $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
+               $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
+               if ( $current_site ) {
+                       $current_site->cookie_domain = $current_site->domain;
+                       return $current_site;
+               }
+
+               $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
+       }
+
+       if ( $current_site || defined( 'WP_INSTALLING' ) ) {
+               $path = '/';
+               return $current_site;
+       }
+
+       // Still no dice.
+       // @todo Update or remove WPMU codex link.
+       if ( 1 == count( $sites ) )
+               wp_die( sprintf( /*WP_I18N_BLOG_DOESNT_EXIST*/'That site does not exist. Please try <a href="%s">%s</a>.'/*/WP_I18N_BLOG_DOESNT_EXIST*/, $sites[0]->domain . $sites[0]->path ) );
+       else
+               wp_die( /*WP_I18N_NO_SITE_DEFINED*/'No site defined on this host. If you are the owner of this site, please check <a href="http://codex.wordpress.org/Debugging_WPMU">Debugging WPMU</a> for help.'/*/WP_I18N_NO_SITE_DEFINED*/ );
+}
+
+/**
+ * Displays a failure message.
+ *
+ * Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well.
+ *
+ * @todo update Codex link for 3.0.0
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function ms_not_installed() {
+       global $wpdb, $domain, $path;
+
+       $title = /*WP_I18N_FATAL_ERROR*/'Error establishing database connection'/*/WP_I18N_FATAL_ERROR*/;
+       $msg  = '<h1>' . $title . '</h1>';
+       if ( ! is_admin() )
+               die( $msg );
+       $msg .= '<p>' . /*WP_I18N_CONTACT_OWNER*/'If your site does not display, please contact the owner of this network.'/*/WP_I18N_CONTACT_OWNER*/ . '';
+       $msg .= ' ' . /*WP_I18N_CHECK_MYSQL*/'If you are the owner of this network please check that MySQL is running properly and all tables are error free.'/*/WP_I18N_CHECK_MYSQL*/ . '</p>';
+       if ( false && !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
+               $msg .= '<p>' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really should look at your database now.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '</p>';
+       else
+               $msg .= '<p>' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'<strong>Could not find site <code>%1$s</code>.</strong> Searched for table <code>%2$s</code> in database <code>%3$s</code>. Is that right?'/*/WP_I18N_NO_SITE_FOUND*/, rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '</p>';
+       $msg .= '<p><strong>' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*WP_I18N_WHAT_DO_I_DO*/ . '</strong> ';
+       $msg .= /*WP_I18N_RTFM*/'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'/*/WP_I18N_RTFM*/;
+       $msg .= ' ' . /*WP_I18N_STUCK*/'If you&#8217;re still stuck with this message, then check that your database contains the following tables:'/*/WP_I18N_STUCK*/ . '</p><ul>';
+       foreach ( $wpdb->tables('global') as $t => $table ) {
+               if ( 'sitecategories' == $t )
+                       continue;
+               $msg .= '<li>' . $table . '</li>';
+       }
+       $msg .= '</ul>';
+
+       wp_die( $msg, $title );
+}
+
+?>
\ No newline at end of file
diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php
new file mode 100644 (file)
index 0000000..14862f9
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Used to set up and fix common variables and include
+ * the Multisite procedural and class library.
+ *
+ * Allows for some configuration in wp-config.php (see ms-default-constants.php)
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+// $base sanity check.
+if ( 'BASE' == $base )
+       die( /*WP_I18N_BASE_ERROR*/'Configuration error in <code>wp-config.php</code>. <code>$base</code> is set to <code>BASE</code> when it should be like <code>/</code> or <code>/blogs/</code>.'/*/WP_I18N_BASE_ERROR*/ );
+
+/** Include Multisite initialization functions */
+require( ABSPATH . WPINC . '/ms-load.php' );
+require( ABSPATH . WPINC . '/ms-default-constants.php' );
+
+if ( defined( 'SUNRISE' ) )
+       include_once( WP_CONTENT_DIR . '/sunrise.php' );
+
+/** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */
+ms_subdomain_constants();
+
+if ( !isset( $current_site ) || !isset( $current_blog ) ) {
+
+       $domain = addslashes( $_SERVER['HTTP_HOST'] );
+       if ( false !== strpos( $domain, ':' ) ) {
+               if ( substr( $domain, -3 ) == ':80' ) {
+                       $domain = substr( $domain, 0, -3 );
+                       $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
+               } elseif ( substr( $domain, -4 ) == ':443' ) {
+                       $domain = substr( $domain, 0, -4 );
+                       $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
+               } else {
+                       wp_die( /*WP_I18N_NO_PORT_NUMBER*/'Multisite only works without the port number in the URL.'/*/WP_I18N_NO_PORT_NUMBER*/ );
+               }
+       }
+
+       $domain = rtrim( $domain, '.' );
+       $cookie_domain = $domain;
+       if ( substr( $cookie_domain, 0, 4 ) == 'www.' )
+               $cookie_domain = substr( $cookie_domain, 4 );
+
+       $path = preg_replace( '|([a-z0-9-]+.php.*)|', '', $_SERVER['REQUEST_URI'] );
+       $path = str_replace ( '/wp-admin/', '/', $path );
+       $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
+
+       $current_site = wpmu_current_site();
+       if ( ! isset( $current_site->blog_id ) )
+               $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );
+
+       if ( is_subdomain_install() ) {
+               $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' );
+               if ( !$current_blog ) {
+                       $current_blog = get_blog_details( array( 'domain' => $domain ), false );
+                       if ( $current_blog )
+                               wp_cache_set( 'current_blog_' . $domain, $current_blog, 'site-options' );
+               }
+               if ( $current_blog && $current_blog->site_id != $current_site->id )
+                       $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id ) );
+               else
+                       $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
+       } else {
+               $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );
+               if ( false !== strpos( $blogname, '/' ) )
+                       $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
+               if ( false !== strpos( $blogname, '?' ) )
+                       $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) );
+               $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );
+               if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) )
+                       $path .= $blogname . '/';
+               $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' );
+               if ( ! $current_blog ) {
+                       $current_blog = get_blog_details( array( 'domain' => $domain, 'path' => $path ), false );
+                       if ( $current_blog )
+                               wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' );
+               }
+       }
+
+       if ( ! defined( 'WP_INSTALLING' ) && is_subdomain_install() && ! is_object( $current_blog ) ) {
+               if ( defined( 'NOBLOGREDIRECT' ) ) {
+                       $destination = NOBLOGREDIRECT;
+                       if ( '%siteurl%' == $destination )
+                               $destination = "http://" . $current_site->domain . $current_site->path;
+               } else {
+                       $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
+               }
+               header( 'Location: ' . $destination );
+               die();
+       }
+
+       if ( ! defined( 'WP_INSTALLING' ) ) {
+               if ( $current_site && ! $current_blog ) {
+                       if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {
+                               header( 'Location: http://' . $current_site->domain . $current_site->path );
+                               exit;
+                       }
+                       $current_blog = get_blog_details( array( 'domain' => $current_site->domain, 'path' => $current_site->path ), false );
+               }
+               if ( ! $current_blog || ! $current_site )
+                       ms_not_installed();
+       }
+
+       $blog_id = $current_blog->blog_id;
+       $public  = $current_blog->public;
+
+       if ( empty( $current_blog->site_id ) )
+               $current_blog->site_id = 1;
+       $site_id = $current_blog->site_id;
+
+       $current_site = get_current_site_name( $current_site );
+
+       if ( ! $blog_id ) {
+               if ( defined( 'WP_INSTALLING' ) ) {
+                       $current_blog->blog_id = $blog_id = 1;
+               } else {
+                       $msg = ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ? ' ' . /*WP_I18N_TABLES_MISSING*/'Database tables are missing.'/*/WP_I18N_TABLES_MISSING*/ : '';
+                       wp_die( /*WP_I18N_NO_BLOG*/'No site by that name on this system.'/*/WP_I18N_NO_BLOG*/ . $msg );
+               }
+       }
+}
+$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php
+$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
+$table_prefix = $wpdb->get_blog_prefix();
+
+// need to init cache again after blog_id is set
+wp_start_object_cache();
+
+// Define upload directory constants
+ms_upload_constants();
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
new file mode 100644 (file)
index 0000000..d2fb493
--- /dev/null
@@ -0,0 +1,446 @@
+<?php
+/**
+ * Navigation Menu template functions
+ *
+ * @package WordPress
+ * @subpackage Nav_Menus
+ * @since 3.0.0
+ */
+
+/**
+ * Create HTML list of nav menu items.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ * @uses Walker
+ */
+class Walker_Nav_Menu extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since 3.0.0
+        * @var string
+        */
+       var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
+
+       /**
+        * @see Walker::$db_fields
+        * @since 3.0.0
+        * @todo Decouple this.
+        * @var array
+        */
+       var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
+
+       /**
+        * @see Walker::start_lvl()
+        * @since 3.0.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 class=\"sub-menu\">\n";
+       }
+
+       /**
+        * @see Walker::end_lvl()
+        * @since 3.0.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";
+       }
+
+       /**
+        * @see Walker::start_el()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $item Menu item data object.
+        * @param int $depth Depth of menu item. Used for padding.
+        * @param int $current_page Menu item ID.
+        * @param object $args
+        */
+       function start_el(&$output, $item, $depth, $args) {
+               global $wp_query;
+               $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
+
+               $class_names = $value = '';
+
+               $classes = empty( $item->classes ) ? array() : (array) $item->classes;
+
+               $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
+               $class_names = ' class="' . esc_attr( $class_names ) . '"';
+
+               $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
+
+               $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
+               $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
+               $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
+               $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
+
+               $item_output = $args->before;
+               $item_output .= '<a'. $attributes .'>';
+               $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
+               $item_output .= '</a>';
+               $item_output .= $args->after;
+
+               $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
+       }
+
+       /**
+        * @see Walker::end_el()
+        * @since 3.0.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $item Page data object. Not used.
+        * @param int $depth Depth of page. Not Used.
+        */
+       function end_el(&$output, $item, $depth) {
+               $output .= "</li>\n";
+       }
+}
+
+/**
+ * Displays a navigation menu.
+ *
+ * Optional $args contents:
+ *
+ * menu - The menu that is desired.  Accepts (matching in order) id, slug, name. Defaults to blank.
+ * menu_class - CSS class to use for the ul element which forms the menu. Defaults to 'menu'.
+ * menu_id - The ID that is applied to the ul element which forms the menu. Defaults to the menu slug, incremented.
+ * container - Whether to wrap the ul, and what to wrap it with. Defaults to 'div'.
+ * container_class - the class that is applied to the container. Defaults to 'menu-{menu slug}-container'.
+ * container_id - The ID that is applied to the container. Defaults to blank.
+ * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'.
+ * before - Text before the link text.
+ * after - Text after the link text.
+ * link_before - Text before the link.
+ * link_after - Text after the link.
+ * echo - Whether to echo the menu or return it. Defaults to echo.
+ * depth - how many levels of the hierarchy are to be included.  0 means all.  Defaults to 0.
+ * walker - allows a custom walker to be specified.
+ * theme_location - the location in the theme to be used.  Must be registered with register_nav_menu() in order to be selectable by the user.
+ *
+ * @since 3.0.0
+ *
+ * @param array $args Arguments
+ */
+function wp_nav_menu( $args = array() ) {
+       static $menu_id_slugs = array();
+
+       $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
+       'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
+       'depth' => 0, 'walker' => '', 'theme_location' => '' );
+
+       $args = wp_parse_args( $args, $defaults );
+       $args = apply_filters( 'wp_nav_menu_args', $args );
+       $args = (object) $args;
+
+       // Get the nav menu based on the requested menu
+       $menu = wp_get_nav_menu_object( $args->menu );
+
+       // Get the nav menu based on the theme_location
+       if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) )
+               $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );
+
+       // get the first menu that has items if we still can't find a menu
+       if ( ! $menu && !$args->theme_location ) {
+               $menus = wp_get_nav_menus();
+               foreach ( $menus as $menu_maybe ) {
+                       if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) {
+                               $menu = $menu_maybe;
+                               break;
+                       }
+               }
+       }
+
+       // If the menu exists, get its items.
+       if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
+               $menu_items = wp_get_nav_menu_items( $menu->term_id );
+
+       // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
+       if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) )
+               && ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) )
+                       return call_user_func( $args->fallback_cb, (array) $args );
+
+       // If no fallback function was specified and the menu doesn't exists, bail.
+       if ( !$menu || is_wp_error($menu) )
+               return false;
+
+       $nav_menu = $items = '';
+
+       $show_container = false;
+       if ( $args->container ) {
+               $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) );
+               if ( in_array( $args->container, $allowed_tags ) ) {
+                       $show_container = true;
+                       $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"';
+                       $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : '';
+                       $nav_menu .= '<'. $args->container . $id . $class . '>';
+               }
+       }
+
+       // Set up the $menu_item variables
+       _wp_menu_item_classes_by_context( $menu_items );
+
+       $sorted_menu_items = array();
+       foreach ( (array) $menu_items as $key => $menu_item )
+               $sorted_menu_items[$menu_item->menu_order] = $menu_item;
+
+       unset($menu_items);
+
+       $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );
+       unset($sorted_menu_items);
+
+       // Attributes
+       if ( ! empty( $args->menu_id ) ) {
+               $slug = $args->menu_id;
+       } else {
+               $slug = 'menu-' . $menu->slug;
+               while ( in_array( $slug, $menu_id_slugs ) ) {
+                       if ( preg_match( '#-(\d+)$#', $slug, $matches ) )
+                               $slug = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $slug);
+                       else
+                               $slug = $slug . '-1';
+               }
+       }
+       $menu_id_slugs[] = $slug;
+       $attributes = ' id="' . $slug . '"';
+       $attributes .= $args->menu_class ? ' class="'. $args->menu_class .'"' : '';
+
+       $nav_menu .= '<ul'. $attributes .'>';
+
+       // Allow plugins to hook into the menu to add their own <li>'s
+       $items = apply_filters( 'wp_nav_menu_items', $items, $args );
+       $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
+       $nav_menu .= $items;
+       unset($items);
+
+       $nav_menu .= '</ul>';
+
+       if ( $show_container )
+               $nav_menu .= '</' . $args->container . '>';
+
+       $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );
+
+       if ( $args->echo )
+               echo $nav_menu;
+       else
+               return $nav_menu;
+}
+
+/**
+ * Add the class property classes for the current context, if applicable.
+ *
+ * @access private
+ * @since 3.0
+ *
+ * @param array $menu_items The current menu item objects to which to add the class property information.
+ */
+function _wp_menu_item_classes_by_context( &$menu_items ) {
+       global $wp_query;
+
+       $queried_object = $wp_query->get_queried_object();
+       $queried_object_id = (int) $wp_query->queried_object_id;
+
+       $active_object = '';
+       $active_ancestor_item_ids = array();
+       $active_parent_item_ids = array();
+       $active_parent_object_ids = array();
+       $possible_taxonomy_ancestors = array();
+       $possible_object_parents = array();
+       $home_page_id = (int) get_option( 'page_for_posts' );
+
+       if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) {
+               foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) {
+                       if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+                               $term_hierarchy = _get_term_hierarchy( $taxonomy );
+                               $terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) );
+                               if ( is_array( $terms ) ) {
+                                       $possible_object_parents = array_merge( $possible_object_parents, $terms );
+                                       $term_to_ancestor = array();
+                                       foreach ( (array) $term_hierarchy as $anc => $descs ) {
+                                               foreach ( (array) $descs as $desc )
+                                                       $term_to_ancestor[ $desc ] = $anc;
+                                       }
+
+                                       foreach ( $terms as $desc ) {
+                                               do {
+                                                       $possible_taxonomy_ancestors[ $taxonomy ][] = $desc;
+                                                       if ( isset( $term_to_ancestor[ $desc ] ) ) {
+                                                               $_desc = $term_to_ancestor[ $desc ];
+                                                               unset( $term_to_ancestor[ $desc ] );
+                                                               $desc = $_desc;
+                                                       } else {
+                                                               $desc = 0;
+                                                       }
+                                               } while ( ! empty( $desc ) );
+                                       }
+                               }
+                       }
+               }
+       } elseif ( ! empty( $queried_object->post_type ) && is_post_type_hierarchical( $queried_object->post_type ) ) {
+               _get_post_ancestors( $queried_object );
+       } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) {
+               $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy );
+               $term_to_ancestor = array();
+               foreach ( (array) $term_hierarchy as $anc => $descs ) {
+                       foreach ( (array) $descs as $desc )
+                               $term_to_ancestor[ $desc ] = $anc;
+               }
+               $desc = $queried_object->term_id;
+               do {
+                       $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc;
+                       if ( isset( $term_to_ancestor[ $desc ] ) ) {
+                               $_desc = $term_to_ancestor[ $desc ];
+                               unset( $term_to_ancestor[ $desc ] );
+                               $desc = $_desc;
+                       } else {
+                               $desc = 0;
+                       }
+               } while ( ! empty( $desc ) );
+       }
+
+       $possible_object_parents = array_filter( $possible_object_parents );
+
+       foreach ( (array) $menu_items as $key => $menu_item ) {
+               $classes = (array) $menu_item->classes;
+               $classes[] = 'menu-item';
+               $classes[] = 'menu-item-type-' . $menu_item->type;
+
+               // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object
+               if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) {
+                       $active_parent_object_ids[] = (int) $menu_item->object_id;
+                       $active_parent_item_ids[] = (int) $menu_item->db_id;
+                       $active_object = $queried_object->post_type;
+
+               // if the menu item corresponds to the currently-queried post or taxonomy object
+               } elseif (
+                       $menu_item->object_id == $queried_object_id &&
+                       (
+                               ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) ||
+                               ( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
+                               ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) )
+                       )
+               ) {
+                       $classes[] = 'current-menu-item';
+                       $_anc_id = (int) $menu_item->db_id;
+
+                       while(
+                               ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) &&
+                               ! in_array( $_anc_id, $active_ancestor_item_ids )
+                       ) {
+                               $active_ancestor_item_ids[] = $_anc_id;
+                       }
+
+                       if ( 'post_type' == $menu_item->type && 'page' == $menu_item->object ) {
+                               // Back compat classes for pages to match wp_page_menu()
+                               $classes[] = 'page_item';
+                               $classes[] = 'page-item-' . $menu_item->object_id;
+                               $classes[] = 'current_page_item';
+                       }
+                       $active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
+                       $active_parent_object_ids[] = (int) $menu_item->post_parent;
+                       $active_object = $menu_item->object;
+
+               // if the menu item corresponds to the currently-requested URL
+               } elseif ( 'custom' == $menu_item->object ) {
+                       $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+                       $item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
+                       if ( $item_url == $current_url ) {
+                               $classes[] = 'current-menu-item';
+                               $_anc_id = (int) $menu_item->db_id;
+
+                               while(
+                                       ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) &&
+                                       ! in_array( $_anc_id, $active_ancestor_item_ids )
+                               ) {
+                                       $active_ancestor_item_ids[] = $_anc_id;
+                               }
+
+                               if ( untrailingslashit($current_url) == home_url() ) {
+                                       $classes[] = 'menu-item-home';
+                                       // Back compat for home limk to match wp_page_menu()
+                                       $classes[] = 'current_page_item';
+                               }
+                               $active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
+                               $active_parent_object_ids[] = (int) $menu_item->post_parent;
+                               $active_object = $menu_item->object;
+                       }
+               }
+
+               // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query
+               if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id )
+                       $classes[] = 'current_page_parent';
+
+               $menu_items[$key]->classes = array_unique( $classes );
+       }
+       $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) );
+       $active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) );
+       $active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) );
+
+       // set parent's class
+       foreach ( (array) $menu_items as $key => $parent_item ) {
+               $classes = (array) $parent_item->classes;
+
+               if (
+                       isset( $parent_item->type ) &&
+                       (
+                               // ancestral post object
+                               (
+                                       'post_type' == $parent_item->type &&
+                                       ! empty( $queried_object->post_type ) &&
+                                       is_post_type_hierarchical( $queried_object->post_type ) &&
+                                       in_array( $parent_item->object_id, $queried_object->ancestors )
+                               ) ||
+
+                               // ancestral term
+                               (
+                                       'taxonomy' == $parent_item->type &&
+                                       isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) &&
+                                       in_array( $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ] )
+                               )
+                       )
+               ) {
+                       $classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor';
+               }
+
+               if ( in_array(  intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) {
+                       $classes[] = 'current-menu-ancestor';
+               }
+               if ( in_array( $parent_item->db_id, $active_parent_item_ids ) )
+                       $classes[] = 'current-menu-parent';
+               if ( in_array( $parent_item->object_id, $active_parent_object_ids ) )
+                       $classes[] = 'current-' . $active_object . '-parent';
+
+               if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) {
+                       // Back compat classes for pages to match wp_page_menu()
+                       if ( in_array('current-menu-parent', $classes) )
+                               $classes[] = 'current_page_parent';
+                       if ( in_array('current-menu-ancestor', $classes) )
+                               $classes[] = 'current_page_ancestor';
+               }
+
+               $menu_items[$key]->classes = array_unique( $classes );
+       }
+}
+
+/**
+ * Retrieve the HTML list content for nav menu items.
+ *
+ * @uses Walker_Nav_Menu to create HTML list content.
+ * @since 2.1.0
+ * @see Walker::walk() for parameters and return description.
+ */
+function walk_nav_menu_tree( $items, $depth, $r ) {
+       $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
+       $args = array( $items, $depth, $r );
+
+       return call_user_func_array( array(&$walker, 'walk'), $args );
+}
+
+?>
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
new file mode 100644 (file)
index 0000000..0d6dd32
--- /dev/null
@@ -0,0 +1,734 @@
+<?php
+/**
+ * Navigation Menu functions
+ *
+ * @package WordPress
+ * @subpackage Nav_Menus
+ * @since 3.0.0
+ */
+
+/**
+ * Returns a navigation menu object.
+ *
+ * @since 3.0.0
+ *
+ * @uses get_term
+ * @uses get_term_by
+ *
+ * @param string $menu Menu id, slug or name
+ * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successful.
+ */
+function wp_get_nav_menu_object( $menu ) {
+       if ( ! $menu )
+               return false;
+
+       $menu_obj = get_term( $menu, 'nav_menu' );
+
+       if ( ! $menu_obj )
+               $menu_obj = get_term_by( 'slug', $menu, 'nav_menu' );
+
+       if ( ! $menu_obj )
+               $menu_obj = get_term_by( 'name', $menu, 'nav_menu' );
+
+       if ( ! $menu_obj )
+               $menu_obj = false;
+
+       return $menu_obj;
+}
+
+/**
+ * Check if the given ID is a navigation menu.
+ *
+ * Returns true if it is; false otherwise.
+ *
+ * @since 3.0.0
+ *
+ * @param int|string $menu The menu to check (id, slug, or name)
+ * @return bool Whether the menu exists.
+ */
+function is_nav_menu( $menu ) {
+       if ( ! $menu )
+               return false;
+
+       $menu_obj = wp_get_nav_menu_object( $menu );
+
+       if (
+               $menu_obj &&
+               ! is_wp_error( $menu_obj ) &&
+               ! empty( $menu_obj->taxonomy ) &&
+               'nav_menu' == $menu_obj->taxonomy
+       )
+               return true;
+
+       return false;
+}
+
+/**
+ * Register navigation menus for a theme.
+ *
+ * @since 3.0.0
+ *
+ * @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text.
+ */
+function register_nav_menus( $locations = array() ) {
+       global $_wp_registered_nav_menus;
+
+       add_theme_support( 'menus' );
+
+       $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
+}
+
+/**
+ * Register a navigation menu for a theme.
+ *
+ * @since 3.0.0
+ *
+ * @param string $location Menu location identifier, like a slug.
+ * @param string $description Menu location descriptive text.
+ */
+function register_nav_menu( $location, $description ) {
+       register_nav_menus( array( $location => $description ) );
+}
+/**
+ * Returns an array of all registered navigation menus in a theme
+ *
+ * @since 3.0.0
+ * @return array
+ */
+function get_registered_nav_menus() {
+       global $_wp_registered_nav_menus;
+       if ( isset( $_wp_registered_nav_menus ) )
+               return $_wp_registered_nav_menus;
+       return array();
+}
+
+/**
+ * Returns an array with the registered navigation menu locations and the menu assigned to it
+ *
+ * @since 3.0.0
+ * @return array
+ */
+
+function get_nav_menu_locations() {
+       return get_theme_mod( 'nav_menu_locations' );
+}
+
+/**
+ * Whether a registered nav menu location has a menu assigned to it.
+ *
+ * @since 3.0.0
+ * @param string $location Menu location identifier.
+ * @return bool Whether location has a menu.
+ */
+function has_nav_menu( $location ) {
+       $locations = get_nav_menu_locations();
+       return ( ! empty( $locations[ $location ] ) );
+}
+
+/**
+ * Determine whether the given ID is a nav menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param int $menu_item_id The ID of the potential nav menu item.
+ * @return bool Whether the given ID is that of a nav menu item.
+ */
+function is_nav_menu_item( $menu_item_id = 0 ) {
+       return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' == get_post_type( $menu_item_id ) ) );
+}
+
+/**
+ * Create a Navigation Menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu_name Menu Name
+ * @return mixed Menu object on success|WP_Error on failure
+ */
+function wp_create_nav_menu( $menu_name ) {
+       return wp_update_nav_menu_object( 0, array( 'menu-name' => $menu_name ) );
+}
+
+/**
+ * Delete a Navigation Menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu name|id|slug
+ * @return mixed Menu object on success|WP_Error on failure
+ */
+function wp_delete_nav_menu( $menu ) {
+       $menu = wp_get_nav_menu_object( $menu );
+       if ( ! $menu )
+               return false;
+
+       $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' );
+       if ( ! empty( $menu_objects ) ) {
+               foreach ( $menu_objects as $item ) {
+                       wp_delete_post( $item );
+               }
+       }
+
+       $result = wp_delete_term( $menu->term_id, 'nav_menu' );
+
+       if ( $result && !is_wp_error($result) )
+               do_action( 'wp_delete_nav_menu', $menu->term_id );
+
+       return $result;
+}
+
+/**
+ * Save the properties of a menu or create a new menu with those properties.
+ *
+ * @since 3.0.0
+ *
+ * @param int $menu_id The ID of the menu or "0" to create a new menu.
+ * @param array $menu_data The array of menu data.
+ * @return int|error object The menu's ID or WP_Error object.
+ */
+function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) {
+       $menu_id = (int) $menu_id;
+
+       $_menu = wp_get_nav_menu_object( $menu_id );
+
+       $args = array(
+               'description' => ( isset( $menu_data['description'] ) ? $menu_data['description']  : '' ),
+               'name'        => ( isset( $menu_data['menu-name']   ) ? $menu_data['menu-name']    : '' ),
+               'parent'      => ( isset( $menu_data['parent']      ) ? (int) $menu_data['parent'] : 0  ),
+               'slug'        => null,
+       );
+
+       // double-check that we're not going to have one menu take the name of another
+       $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
+       if (
+               $_possible_existing &&
+               ! is_wp_error( $_possible_existing ) &&
+               isset( $_possible_existing->term_id ) &&
+               $_possible_existing->term_id != $menu_id
+       )
+               return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
+
+       // menu doesn't already exist, so create a new menu
+       if ( ! $_menu || is_wp_error( $_menu ) ) {
+               $menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
+
+               if ( $menu_exists )
+                       return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
+
+               $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args );
+
+               if ( is_wp_error( $_menu ) )
+                       return $_menu;
+
+               do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
+
+               return (int) $_menu['term_id'];
+       }
+
+       if ( ! $_menu || ! isset( $_menu->term_id ) )
+               return 0;
+
+       $menu_id = (int) $_menu->term_id;
+
+       $update_response = wp_update_term( $menu_id, 'nav_menu', $args );
+
+       if ( is_wp_error( $update_response ) )
+               return $update_response;
+
+       do_action( 'wp_update_nav_menu', $menu_id, $menu_data );
+       return $menu_id;
+}
+
+/**
+ * Save the properties of a menu item or create a new one.
+ *
+ * @since 3.0.0
+ *
+ * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan.
+ * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item.
+ * @param array $menu_item_data The menu item's data.
+ * @return int The menu item's database ID or WP_Error object on failure.
+ */
+function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() ) {
+       $menu_id = (int) $menu_id;
+       $menu_item_db_id = (int) $menu_item_db_id;
+
+       // make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects
+       if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) )
+               return new WP_Error('update_nav_menu_item_failed', __('The given object ID is not that of a menu item.'));
+
+       $menu = wp_get_nav_menu_object( $menu_id );
+
+       if ( ( ! $menu && 0 !== $menu_id ) || is_wp_error( $menu ) )
+               return $menu;
+
+       $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) );
+
+       $count = count( $menu_items );
+
+       $defaults = array(
+               'menu-item-db-id' => $menu_item_db_id,
+               'menu-item-object-id' => 0,
+               'menu-item-object' => '',
+               'menu-item-parent-id' => 0,
+               'menu-item-position' => 0,
+               'menu-item-type' => 'custom',
+               'menu-item-title' => '',
+               'menu-item-url' => '',
+               'menu-item-description' => '',
+               'menu-item-attr-title' => '',
+               'menu-item-target' => '',
+               'menu-item-classes' => '',
+               'menu-item-xfn' => '',
+               'menu-item-status' => '',
+       );
+
+       $args = wp_parse_args( $menu_item_data, $defaults );
+
+       if ( 0 == $menu_id ) {
+               $args['menu-item-position'] = 1;
+       } elseif ( 0 == (int) $args['menu-item-position'] ) {
+               $last_item = array_pop( $menu_items );
+               $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : $count;
+       }
+
+       $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0;
+
+       if ( 'custom' != $args['menu-item-type'] ) {
+               /* if non-custom menu item, then:
+                       * use original object's URL
+                       * blank default title to sync with original object's
+               */
+
+               $args['menu-item-url'] = '';
+
+               $original_title = '';
+               if ( 'taxonomy' == $args['menu-item-type'] ) {
+                       $original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' );
+                       $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' );
+               } elseif ( 'post_type' == $args['menu-item-type'] ) {
+
+                       $original_object = get_post( $args['menu-item-object-id'] );
+                       $original_parent = (int) $original_object->post_parent;
+                       $original_title = $original_object->post_title;
+               }
+
+               if ( empty( $args['menu-item-title'] ) || $args['menu-item-title'] == $original_title ) {
+                       $args['menu-item-title'] = '';
+
+                       // hack to get wp to create a post object when too many properties are empty
+                       if ( empty( $args['menu-item-description'] ) )
+                               $args['menu-item-description'] = ' ';
+               }
+       }
+
+       // Populate the menu item object
+       $post = array(
+               'menu_order' => $args['menu-item-position'],
+               'ping_status' => 0,
+               'post_content' => $args['menu-item-description'],
+               'post_excerpt' => $args['menu-item-attr-title'],
+               'post_parent' => $original_parent,
+               'post_title' => $args['menu-item-title'],
+               'post_type' => 'nav_menu_item',
+       );
+
+       if ( 0 != $menu_id )
+               $post['tax_input'] = array( 'nav_menu' => array( intval( $menu->term_id ) ) );
+
+       // New menu item. Default is draft status
+       if ( 0 == $menu_item_db_id ) {
+               $post['ID'] = 0;
+               $post['post_status'] = 'publish' == $args['menu-item-status'] ? 'publish' : 'draft';
+               $menu_item_db_id = wp_insert_post( $post );
+
+       // Update existing menu item. Default is publish status
+       } else {
+               $post['ID'] = $menu_item_db_id;
+               $post['post_status'] = 'draft' == $args['menu-item-status'] ? 'draft' : 'publish';
+               wp_update_post( $post );
+       }
+
+       if ( 'custom' == $args['menu-item-type'] ) {
+               $args['menu-item-object-id'] = $menu_item_db_id;
+               $args['menu-item-object'] = 'custom';
+       }
+
+       if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) )
+               return $menu_item_db_id;
+
+       $menu_item_db_id = (int) $menu_item_db_id;
+
+       update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) );
+       update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (int) $args['menu-item-parent-id'] );
+       update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] );
+       update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) );
+       update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) );
+
+       $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) );
+       $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) );
+       update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
+       update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
+       update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) );
+
+       if ( 0 == $menu_id )
+               update_post_meta( $menu_item_db_id, '_menu_item_orphaned', time() );
+       else
+               delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' );
+
+       do_action('wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args );
+
+       return $menu_item_db_id;
+}
+
+/**
+ * Returns all navigation menu objects.
+ *
+ * @since 3.0.0
+ *
+ * @param $args array Array of arguments passed on to get_terms().
+ * @return array menu objects
+ */
+function wp_get_nav_menus( $args = array() ) {
+       $defaults = array( 'hide_empty' => false, 'orderby' => 'none' );
+       $args = wp_parse_args( $args, $defaults );
+       return apply_filters( 'wp_get_nav_menus', get_terms( 'nav_menu',  $args), $args );
+}
+
+/**
+ * Sort menu items by the desired key.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param object $a The first object to compare
+ * @param object $b The second object to compare
+ * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b.
+ */
+function _sort_nav_menu_items( $a, $b ) {
+       global $_menu_item_sort_prop;
+
+       if ( empty( $_menu_item_sort_prop ) )
+               return 0;
+
+       if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
+               return 0;
+
+       $_a = (int) $a->$_menu_item_sort_prop;
+       $_b = (int) $b->$_menu_item_sort_prop;
+
+       if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
+               return 0;
+       elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
+               return $_a < $_b ? -1 : 1;
+       else
+               return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
+}
+
+/**
+ * Returns all menu items of a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu menu name, id, or slug
+ * @param string $args
+ * @return mixed $items array of menu items, else false.
+ */
+function wp_get_nav_menu_items( $menu, $args = array() ) {
+       global $_wp_using_ext_object_cache;
+
+       $menu = wp_get_nav_menu_object( $menu );
+
+       if ( ! $menu )
+               return false;
+
+       static $fetched = array();
+
+       $items = get_objects_in_term( $menu->term_id, 'nav_menu' );
+
+       if ( empty( $items ) )
+               return $items;
+
+       $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item',
+               'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true,
+               'update_post_term_cache' => false );
+       $args = wp_parse_args( $args, $defaults );
+       if ( count( $items ) > 1 )
+               $args['include'] = implode( ',', $items );
+       else
+               $args['include'] = $items[0];
+
+       $items = get_posts( $args );
+
+       if ( is_wp_error( $items ) || ! is_array( $items ) )
+               return false;
+
+       // Get all posts and terms at once to prime the caches
+       if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache ) {
+               $fetched[$menu->term_id] = true;
+               $posts = array();
+               $terms = array();
+               foreach ( $items as $item ) {
+                       $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
+                       $object    = get_post_meta( $item->ID, '_menu_item_object',    true );
+                       $type      = get_post_meta( $item->ID, '_menu_item_type',      true );
+
+                       if ( 'post_type' == $type )
+                               $posts[$object][] = $object_id;
+                       elseif ( 'taxonomy' == $type)
+                               $terms[$object][] = $object_id;
+               }
+
+               if ( ! empty( $posts ) ) {
+                       foreach ( array_keys($posts) as $post_type ) {
+                               get_posts( array('post__in' => $posts[$post_type], 'post_type' => $post_type, 'nopaging' => true, 'update_post_term_cache' => false) );
+                       }
+               }
+               unset($posts);
+
+               if ( ! empty( $terms ) ) {
+                       foreach ( array_keys($terms) as $taxonomy ) {
+                               get_terms($taxonomy, array('include' => $terms[$taxonomy]) );
+                       }
+               }
+               unset($terms);
+       }
+
+       $items = array_map( 'wp_setup_nav_menu_item', $items );
+
+       if ( ARRAY_A == $args['output'] ) {
+               $GLOBALS['_menu_item_sort_prop'] = $args['output_key'];
+               usort($items, '_sort_nav_menu_items');
+               $i = 1;
+               foreach( $items as $k => $item ) {
+                       $items[$k]->$args['output_key'] = $i++;
+               }
+       }
+
+       return apply_filters( 'wp_get_nav_menu_items',  $items, $menu, $args );
+}
+
+/**
+ * Decorates a menu item object with the shared navigation menu item properties.
+ *
+ * Properties:
+ * - db_id:            The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist).
+ * - object_id:                The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories.
+ * - type:             The family of objects originally represented, such as "post_type" or "taxonomy."
+ * - object:           The type of object originally represented, such as "category," "post", or "attachment."
+ * - type_label:       The singular label used to describe this type of menu item.
+ * - post_parent:      The DB ID of the original object's parent object, if any (0 otherwise).
+ * - menu_item_parent:         The DB ID of the nav_menu_item that is this item's menu parent, if any.  0 otherwise.
+ * - url:              The URL to which this menu item points.
+ * - title:            The title of this menu item.
+ * - target:           The target attribute of the link element for this menu item.
+ * - attr_title:       The title attribute of the link element for this menu item.
+ * - classes:          The array of class attribute values for the link element of this menu item.
+ * - xfn:              The XFN relationship expressed in the link of this menu item.
+ * - description:      The description of this menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param object $menu_item The menu item to modify.
+ * @return object $menu_item The menu item with standard menu item properties.
+ */
+function wp_setup_nav_menu_item( $menu_item ) {
+       if ( isset( $menu_item->post_type ) ) {
+               if ( 'nav_menu_item' == $menu_item->post_type ) {
+                       $menu_item->db_id = (int) $menu_item->ID;
+                       $menu_item->menu_item_parent = empty( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent;
+                       $menu_item->object_id = empty( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id;
+                       $menu_item->object = empty( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object;
+                       $menu_item->type = empty( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type;
+
+                       if ( 'post_type' == $menu_item->type ) {
+                               $object = get_post_type_object( $menu_item->object );
+                               $menu_item->type_label = $object->labels->singular_name;
+                               $menu_item->url = get_permalink( $menu_item->object_id );
+
+                               $original_object = get_post( $menu_item->object_id );
+                               $original_title = $original_object->post_title;
+                               $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
+
+                       } elseif ( 'taxonomy' == $menu_item->type ) {
+                               $object = get_taxonomy( $menu_item->object );
+                               $menu_item->type_label = $object->labels->singular_name;
+                               $term_url = get_term_link( (int) $menu_item->object_id, $menu_item->object );
+                               $menu_item->url = !is_wp_error( $term_url ) ? $term_url : '';
+
+                               $original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' );
+                               $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
+
+                       } else {
+                               $menu_item->type_label = __('Custom');
+                               $menu_item->title = $menu_item->post_title;
+                               $menu_item->url = empty( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url;
+                       }
+
+                       $menu_item->target = empty( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target;
+
+                       $menu_item->attr_title = empty( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title;
+                       $menu_item->description = empty( $menu_item->description ) ? apply_filters( 'nav_menu_description', $menu_item->post_content ) : $menu_item->description;
+
+                       $menu_item->classes = empty( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes;
+                       $menu_item->xfn = empty( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn;
+               } else {
+                       $menu_item->db_id = 0;
+                       $menu_item->menu_item_parent = 0;
+                       $menu_item->object_id = (int) $menu_item->ID;
+                       $menu_item->type = 'post_type';
+
+                       $object = get_post_type_object( $menu_item->post_type );
+                       $menu_item->object = $object->name;
+                       $menu_item->type_label = $object->labels->singular_name;
+
+                       $menu_item->title = $menu_item->post_title;
+                       $menu_item->url = get_permalink( $menu_item->ID );
+                       $menu_item->target = '';
+
+                       $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt );
+                       $menu_item->description = apply_filters( 'nav_menu_description', $menu_item->post_content );
+                       $menu_item->classes = array();
+                       $menu_item->xfn = '';
+               }
+       } elseif ( isset( $menu_item->taxonomy ) ) {
+               $menu_item->ID = $menu_item->term_id;
+               $menu_item->db_id = 0;
+               $menu_item->menu_item_parent = 0;
+               $menu_item->object_id = (int) $menu_item->term_id;
+               $menu_item->post_parent = (int) $menu_item->parent;
+               $menu_item->type = 'taxonomy';
+
+               $object = get_taxonomy( $menu_item->taxonomy );
+               $menu_item->object = $object->name;
+               $menu_item->type_label = $object->labels->singular_name;
+
+               $menu_item->title = $menu_item->name;
+               $menu_item->url = get_term_link( $menu_item, $menu_item->taxonomy );
+               $menu_item->target = '';
+               $menu_item->attr_title = '';
+               $menu_item->description = get_term_field( 'description', $menu_item->term_id, $menu_item->taxonomy );
+               $menu_item->classes = array();
+               $menu_item->xfn = '';
+
+       }
+
+       return apply_filters( 'wp_setup_nav_menu_item', $menu_item );
+}
+
+/**
+ * Get the menu items associated with a particular object.
+ *
+ * @since 3.0.0
+ *
+ * @param int $object_id The ID of the original object.
+ * @param string $object_type The type of object, such as "taxonomy" or "post_type."
+ * @return array The array of menu item IDs; empty array if none;
+ */
+function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type' ) {
+       $object_id = (int) $object_id;
+       $menu_item_ids = array();
+
+       $query = new WP_Query;
+       $menu_items = $query->query(
+               array(
+                       'meta_key' => '_menu_item_object_id',
+                       'meta_value' => $object_id,
+                       'post_status' => 'any',
+                       'post_type' => 'nav_menu_item',
+                       'showposts' => -1,
+               )
+       );
+       foreach( (array) $menu_items as $menu_item ) {
+               if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) {
+                       if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type )
+                               continue;
+
+                       $menu_item_ids[] = (int) $menu_item->ID;
+               }
+       }
+
+       return array_unique( $menu_item_ids );
+}
+
+/**
+ * Callback for handling a menu item when its original object is deleted.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param int $object_id The ID of the original object being trashed.
+ *
+ */
+function _wp_delete_post_menu_item( $object_id = 0 ) {
+       $object_id = (int) $object_id;
+
+       $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' );
+
+       foreach( (array) $menu_item_ids as $menu_item_id ) {
+               wp_delete_post( $menu_item_id, true );
+       }
+}
+
+/**
+ * Callback for handling a menu item when its original object is deleted.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param int $object_id The ID of the original object being trashed.
+ *
+ */
+function _wp_delete_tax_menu_item( $object_id = 0 ) {
+       $object_id = (int) $object_id;
+
+       $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy' );
+
+       foreach( (array) $menu_item_ids as $menu_item_id ) {
+               wp_delete_post( $menu_item_id, true );
+       }
+}
+
+/**
+ * Automatically add newly published page objects to menus with that as an option.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param string $new_status The new status of the post object.
+ * @param string $old_status The old status of the post object.
+ * @param object $post The post object being transitioned from one status to another.
+ * @return void
+ */
+function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) {
+       if ( 'publish' != $new_status || 'publish' == $old_status || 'page' != $post->post_type )
+               return;
+       if ( ! empty( $post->post_parent ) )
+               return;
+       $auto_add = get_option( 'nav_menu_options' );
+       if ( empty( $auto_add ) || ! is_array( $auto_add ) || ! isset( $auto_add['auto_add'] ) )
+               return;
+       $auto_add = $auto_add['auto_add'];
+       if ( empty( $auto_add ) || ! is_array( $auto_add ) )
+               return;
+
+       $args = array(
+               'menu-item-object-id' => $post->ID,
+               'menu-item-object' => $post->post_type,
+               'menu-item-type' => 'post_type',
+               'menu-item-status' => 'publish',
+       );
+
+       foreach ( $auto_add as $menu_id ) {
+               $items = wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) );
+               if ( ! is_array( $items ) )
+                       continue;
+               foreach ( $items as $item ) {
+                       if ( $post->ID == $item->object_id )
+                               continue 2;
+               }
+               wp_update_nav_menu_item( $menu_id, 0, $args );
+       }
+}
+
+?>
diff --git a/wp-includes/pluggable-deprecated.php b/wp-includes/pluggable-deprecated.php
new file mode 100644 (file)
index 0000000..bb0e4f0
--- /dev/null
@@ -0,0 +1,136 @@
+<?php
+/**
+ * Deprecated pluggable functions from past WordPress versions. You shouldn't use these
+ * functions and look for the alternatives instead. The functions will be removed in a
+ * later version.
+ *
+ * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @see pluggable.php
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+if ( !function_exists('set_current_user') ) :
+/**
+ * Changes the current user by ID or name.
+ *
+ * Set $id to null and specify a name if you do not know a user's ID.
+ *
+ * @since 2.0.1
+ * @see wp_set_current_user() An alias of wp_set_current_user()
+ * @deprecated 3.0.0
+ * @deprecated Use wp_set_current_user()
+ *
+ * @param int|null $id User ID.
+ * @param string $name Optional. The user's username
+ * @return object returns wp_set_current_user()
+ */
+function set_current_user($id, $name = '') {
+       _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
+       return wp_set_current_user($id, $name);
+}
+endif;
+
+if ( !function_exists('wp_setcookie') ) :
+/**
+ * Sets a cookie for a user who just logged in. This function is deprecated.
+ *
+ * @since 1.5
+ * @deprecated 2.5
+ * @deprecated Use wp_set_auth_cookie()
+ * @see wp_set_auth_cookie()
+ *
+ * @param string $username The user's username
+ * @param string $password Optional. The user's password
+ * @param bool $already_md5 Optional. Whether the password has already been through MD5
+ * @param string $home Optional. Will be used instead of COOKIEPATH if set
+ * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
+ * @param bool $remember Optional. Remember that the user is logged in
+ */
+function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
+       $user = get_userdatabylogin($username);
+       wp_set_auth_cookie($user->ID, $remember);
+}
+else :
+       _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
+endif;
+
+if ( !function_exists('wp_clearcookie') ) :
+/**
+ * Clears the authentication cookie, logging the user out. This function is deprecated.
+ *
+ * @since 1.5
+ * @deprecated 2.5
+ * @deprecated Use wp_clear_auth_cookie()
+ * @see wp_clear_auth_cookie()
+ */
+function wp_clearcookie() {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
+       wp_clear_auth_cookie();
+}
+else :
+       _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
+endif;
+
+if ( !function_exists('wp_get_cookie_login') ):
+/**
+ * Gets the user cookie login. This function is deprecated.
+ *
+ * This function is deprecated and should no longer be extended as it won't be
+ * used anywhere in WordPress. Also, plugins shouldn't use it either.
+ *
+ * @since 2.0.3
+ * @deprecated 2.5
+ * @deprecated No alternative
+ *
+ * @return bool Always returns false
+ */
+function wp_get_cookie_login() {
+       _deprecated_function( __FUNCTION__, '2.5' );
+       return false;
+}
+else :
+       _deprecated_function( 'wp_get_cookie_login', '2.5' );
+endif;
+
+if ( !function_exists('wp_login') ) :
+/**
+ * Checks a users login information and logs them in if it checks out. This function is deprecated.
+ *
+ * Use the global $error to get the reason why the login failed. If the username
+ * is blank, no error will be set, so assume blank username on that case.
+ *
+ * Plugins extending this function should also provide the global $error and set
+ * what the error is, so that those checking the global for why there was a
+ * failure can utilize it later.
+ *
+ * @since 1.2.2
+ * @deprecated Use wp_signon()
+ * @global string $error Error when false is returned
+ *
+ * @param string $username User's username
+ * @param string $password User's password
+ * @param bool $deprecated Not used
+ * @return bool False on login failure, true on successful check
+ */
+function wp_login($username, $password, $deprecated = '') {
+       _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
+       global $error;
+
+       $user = wp_authenticate($username, $password);
+
+       if ( ! is_wp_error($user) )
+               return true;
+
+       $error = $user->get_error_message();
+       return false;
+}
+else :
+       _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
+endif;
\ No newline at end of file
index 0946f8f23857ec29cfc9433357c67fff8ddde921..b519832303d522b0954a68d957d8053693d00124 100644 (file)
@@ -6,24 +6,6 @@
  * @package WordPress
  */
 
-if ( !function_exists('set_current_user') ) :
-/**
- * Changes the current user by ID or name.
- *
- * Set $id to null and specify a name if you do not know a user's ID.
- *
- * @since 2.0.1
- * @see wp_set_current_user() An alias of wp_set_current_user()
- *
- * @param int|null $id User ID.
- * @param string $name Optional. The user's username
- * @return object returns wp_set_current_user()
- */
-function set_current_user($id, $name = '') {
-       return wp_set_current_user($id, $name);
-}
-endif;
-
 if ( !function_exists('wp_set_current_user') ) :
 /**
  * Changes the current user by ID or name.
@@ -121,24 +103,59 @@ if ( !function_exists('get_userdata') ) :
 function get_userdata( $user_id ) {
        global $wpdb;
 
-       $user_id = absint($user_id);
-       if ( $user_id == 0 )
+       if ( ! is_numeric( $user_id ) )
                return false;
 
-       $user = wp_cache_get($user_id, 'users');
+       $user_id = absint( $user_id );
+       if ( ! $user_id )
+               return false;
+
+       $user = wp_cache_get( $user_id, 'users' );
 
        if ( $user )
                return $user;
 
-       if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id)) )
+       if ( ! $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) )
                return false;
 
-       _fill_user($user);
+       _fill_user( $user );
 
        return $user;
 }
 endif;
 
+if ( !function_exists('cache_users') ) :
+/**
+ * Retrieve info for user lists to prevent multiple queries by get_userdata()
+ *
+ * @since 3.0.0
+ *
+ * @param array $users User ID numbers list
+ */
+function cache_users( $users ) {
+       global $wpdb;
+
+       $clean = array();
+       foreach($users as $id) {
+               $id = (int) $id;
+               if (wp_cache_get($id, 'users')) {
+                       // seems to be cached already
+               } else {
+                       $clean[] = $id;
+               }
+       }
+
+       if ( 0 == count($clean) )
+               return;
+
+       $list = implode(',', $clean);
+
+       $results = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($list)");
+
+       _fill_many_users($results);
+}
+endif;
+
 if ( !function_exists('get_user_by') ) :
 /**
  * Retrieve user info by a given field
@@ -244,7 +261,7 @@ if ( !function_exists( 'wp_mail' ) ) :
  * @uses PHPMailer
  * @
  *
- * @param string $to Email address to send message
+ * @param string|array $to Array or comma-separated list of email addresses to send message.
  * @param string $subject Email subject
  * @param string $message Message contents
  * @param string|array $headers Optional. Additional headers.
@@ -256,7 +273,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
        extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
 
        if ( !is_array($attachments) )
-               $attachments = explode( "\n", $attachments );
+               $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
 
        global $phpmailer;
 
@@ -274,7 +291,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                if ( !is_array( $headers ) ) {
                        // Explode the headers out, so this function can take both
                        // string headers and an array of headers.
-                       $tempheaders = (array) explode( "\n", $headers );
+                       $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
                } else {
                        $tempheaders = $headers;
                }
@@ -295,43 +312,49 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                                list( $name, $content ) = explode( ':', trim( $header ), 2 );
 
                                // Cleanup crew
-                               $name = trim( $name );
+                               $name    = trim( $name    );
                                $content = trim( $content );
 
-                               // Mainly for legacy -- process a From: header if it's there
-                               if ( 'from' == strtolower($name) ) {
-                                       if ( strpos($content, '<' ) !== false ) {
-                                               // So... making my life hard again?
-                                               $from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
-                                               $from_name = str_replace( '"', '', $from_name );
-                                               $from_name = trim( $from_name );
-
-                                               $from_email = substr( $content, strpos( $content, '<' ) + 1 );
-                                               $from_email = str_replace( '>', '', $from_email );
-                                               $from_email = trim( $from_email );
-                                       } else {
-                                               $from_email = trim( $content );
-                                       }
-                               } elseif ( 'content-type' == strtolower($name) ) {
-                                       if ( strpos( $content,';' ) !== false ) {
-                                               list( $type, $charset ) = explode( ';', $content );
-                                               $content_type = trim( $type );
-                                               if ( false !== stripos( $charset, 'charset=' ) ) {
-                                                       $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) );
-                                               } elseif ( false !== stripos( $charset, 'boundary=' ) ) {
-                                                       $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) );
-                                                       $charset = '';
+                               switch ( strtolower( $name ) ) {
+                                       // Mainly for legacy -- process a From: header if it's there
+                                       case 'from':
+                                               if ( strpos($content, '<' ) !== false ) {
+                                                       // So... making my life hard again?
+                                                       $from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
+                                                       $from_name = str_replace( '"', '', $from_name );
+                                                       $from_name = trim( $from_name );
+
+                                                       $from_email = substr( $content, strpos( $content, '<' ) + 1 );
+                                                       $from_email = str_replace( '>', '', $from_email );
+                                                       $from_email = trim( $from_email );
+                                               } else {
+                                                       $from_email = trim( $content );
                                                }
-                                       } else {
-                                               $content_type = trim( $content );
-                                       }
-                               } elseif ( 'cc' == strtolower($name) ) {
-                                       $cc = explode(",", $content);
-                               } elseif ( 'bcc' == strtolower($name) ) {
-                                       $bcc = explode(",", $content);
-                               } else {
-                                       // Add it to our grand headers array
-                                       $headers[trim( $name )] = trim( $content );
+                                               break;
+                                       case 'content-type':
+                                               if ( strpos( $content, ';' ) !== false ) {
+                                                       list( $type, $charset ) = explode( ';', $content );
+                                                       $content_type = trim( $type );
+                                                       if ( false !== stripos( $charset, 'charset=' ) ) {
+                                                               $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) );
+                                                       } elseif ( false !== stripos( $charset, 'boundary=' ) ) {
+                                                               $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) );
+                                                               $charset = '';
+                                                       }
+                                               } else {
+                                                       $content_type = trim( $content );
+                                               }
+                                               break;
+                                       case 'cc':
+                                               $cc = array_merge( (array) $cc, explode( ',', $content ) );
+                                               break;
+                                       case 'bcc':
+                                               $bcc = array_merge( (array) $bcc, explode( ',', $content ) );
+                                               break;
+                                       default:
+                                               // Add it to our grand headers array
+                                               $headers[trim( $name )] = trim( $content );
+                                               break;
                                }
                        }
                }
@@ -348,9 +371,8 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
 
        // From email and name
        // If we don't have a name from the input headers
-       if ( !isset( $from_name ) ) {
+       if ( !isset( $from_name ) )
                $from_name = 'WordPress';
-       }
 
        /* If we don't have an email from the input headers default to wordpress@$sitename
         * Some hosts will block outgoing mail from this address if it doesn't exist but
@@ -370,23 +392,29 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
        }
 
        // Plugin authors can override the potentially troublesome default
-       $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
-       $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
+       $phpmailer->From     = apply_filters( 'wp_mail_from'     , $from_email );
+       $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name  );
+
+       // Set destination addresses
+       if ( !is_array( $to ) )
+               $to = explode( ',', $to );
 
-       // Set destination address
-       $phpmailer->AddAddress( $to );
+       foreach ( (array) $to as $recipient ) {
+               $phpmailer->AddAddress( trim( $recipient ) );
+       }
 
        // Set mail's subject and body
        $phpmailer->Subject = $subject;
-       $phpmailer->Body = $message;
+       $phpmailer->Body    = $message;
 
        // Add any CC and BCC recipients
-       if ( !empty($cc) ) {
+       if ( !empty( $cc ) ) {
                foreach ( (array) $cc as $recipient ) {
                        $phpmailer->AddCc( trim($recipient) );
                }
        }
-       if ( !empty($bcc) ) {
+
+       if ( !empty( $bcc ) ) {
                foreach ( (array) $bcc as $recipient) {
                        $phpmailer->AddBcc( trim($recipient) );
                }
@@ -397,23 +425,20 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
 
        // Set Content-Type and charset
        // If we don't have a content-type from the input headers
-       if ( !isset( $content_type ) ) {
+       if ( !isset( $content_type ) )
                $content_type = 'text/plain';
-       }
 
        $content_type = apply_filters( 'wp_mail_content_type', $content_type );
 
        $phpmailer->ContentType = $content_type;
 
-       // Set whether it's plaintext or not, depending on $content_type
-       if ( $content_type == 'text/html' ) {
+       // Set whether it's plaintext, depending on $content_type
+       if ( 'text/html' == $content_type )
                $phpmailer->IsHTML( true );
-       }
 
        // If we don't have a charset from the input headers
-       if ( !isset( $charset ) ) {
+       if ( !isset( $charset ) )
                $charset = get_bloginfo( 'charset' );
-       }
 
        // Set the content-type and charset
        $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
@@ -423,9 +448,9 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                foreach( (array) $headers as $name => $content ) {
                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
                }
-               if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) {
+
+               if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
                        $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
-               }
        }
 
        if ( !empty( $attachments ) ) {
@@ -633,7 +658,7 @@ if ( !function_exists('wp_set_auth_cookie') ) :
  * @since 2.5
  *
  * @param int $user_id User ID
- * @param bool $remember Whether to remember the user or not
+ * @param bool $remember Whether to remember the user
  */
 function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        if ( $remember ) {
@@ -644,7 +669,7 @@ function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        }
 
        if ( '' === $secure )
-               $secure = is_ssl() ? true : false;
+               $secure = is_ssl();
 
        if ( $secure ) {
                $auth_cookie_name = SECURE_AUTH_COOKIE;
@@ -737,10 +762,7 @@ if ( !function_exists('auth_redirect') ) :
 function auth_redirect() {
        // Checks if a user is logged in, if not redirects them to the login page
 
-       if ( is_ssl() || force_ssl_admin() )
-               $secure = true;
-       else
-               $secure = false;
+       $secure = ( is_ssl() || force_ssl_admin() );
 
        // If https is required and request is http, redirect
        if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
@@ -780,7 +802,7 @@ function auth_redirect() {
 
        $redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
-       $login_url = wp_login_url($redirect);
+       $login_url = wp_login_url($redirect, true);
 
        wp_redirect($login_url);
        exit();
@@ -944,7 +966,20 @@ function wp_validate_redirect($location, $default = '') {
        $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
 
        $lp  = parse_url($test);
-       $wpp = parse_url(get_option('home'));
+
+       // Give up if malformed URL
+       if ( false === $lp )
+               return $default;
+
+       // Allow only http and https schemes. No data:, etc.
+       if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
+               return $default;
+
+       // Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
+       if ( isset($lp['scheme'])  && !isset($lp['host']) )
+               return $default;
+
+       $wpp = parse_url(home_url());
 
        $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
 
@@ -969,14 +1004,13 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
        $comment = get_comment($comment_id);
        $post    = get_post($comment->comment_post_ID);
        $user    = get_userdata( $post->post_author );
-       $current_user = wp_get_current_user();
 
        if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post
 
        if ('' == $user->user_email) return false; // If there's no email to send the comment to
 
        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
-       
+
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
@@ -984,8 +1018,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
        if ( empty( $comment_type ) ) $comment_type = 'comment';
 
        if ('comment' == $comment_type) {
-               /* translators: 1: post id, 2: post title */
-               $notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
                /* translators: 1: comment author, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
@@ -996,8 +1029,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
                /* translators: 1: blog name, 2: post title */
                $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
        } elseif ('trackback' == $comment_type) {
-               /* translators: 1: post id, 2: post title */
-               $notify_message  = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               $notify_message  = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
                /* translators: 1: website name, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
@@ -1006,8 +1038,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
                /* translators: 1: blog name, 2: post title */
                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
        } elseif ('pingback' == $comment_type) {
-               /* translators: 1: post id, 2: post title */
-               $notify_message  = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               $notify_message  = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
                /* translators: 1: comment author, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
@@ -1072,29 +1103,29 @@ function wp_notify_moderator($comment_id) {
 
        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
        $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
-       
+
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
-       
+
        switch ($comment->comment_type)
        {
                case 'trackback':
-                       $notify_message  = sprintf( __('A new trackback on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
+                       $notify_message  = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
                        $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
                        $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                        $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                        $notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                        break;
                case 'pingback':
-                       $notify_message  = sprintf( __('A new pingback on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
+                       $notify_message  = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
                        $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
                        $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                        $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                        $notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                        break;
                default: //Comments
-                       $notify_message  = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
+                       $notify_message  = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
                        $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
                        $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                        $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
@@ -1164,12 +1195,12 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
 
        $user_login = stripslashes($user->user_login);
        $user_email = stripslashes($user->user_email);
-       
+
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
-       $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
+       $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
 
@@ -1289,7 +1320,8 @@ if ( !function_exists('wp_salt') ) :
  * @since 2.5
  * @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
+ * @param string $scheme Authentication scheme
+ * @return string Salt value
  */
 function wp_salt($scheme = 'auth') {
        global $wp_default_secret_key;
@@ -1301,54 +1333,54 @@ function wp_salt($scheme = 'auth') {
                if ( defined('AUTH_KEY') && ('' != AUTH_KEY) && ( $wp_default_secret_key != AUTH_KEY) )
                        $secret_key = AUTH_KEY;
 
-               if ( defined('AUTH_SALT') ) {
+               if ( defined('AUTH_SALT') && ('' != AUTH_SALT) && ( $wp_default_secret_key != AUTH_SALT) ) {
                        $salt = AUTH_SALT;
-               } elseif ( defined('SECRET_SALT') ) {
+               } elseif ( defined('SECRET_SALT') && ('' != SECRET_SALT) && ( $wp_default_secret_key != SECRET_SALT) ) {
                        $salt = SECRET_SALT;
                } else {
-                       $salt = get_option('auth_salt');
+                       $salt = get_site_option('auth_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password(64);
-                               update_option('auth_salt', $salt);
+                               $salt = wp_generate_password( 64, true, true );
+                               update_site_option('auth_salt', $salt);
                        }
                }
        } elseif ( 'secure_auth' == $scheme ) {
                if ( defined('SECURE_AUTH_KEY') && ('' != SECURE_AUTH_KEY) && ( $wp_default_secret_key != SECURE_AUTH_KEY) )
                        $secret_key = SECURE_AUTH_KEY;
 
-               if ( defined('SECURE_AUTH_SALT') ) {
+               if ( defined('SECURE_AUTH_SALT') && ('' != SECURE_AUTH_SALT) && ( $wp_default_secret_key != SECURE_AUTH_SALT) ) {
                        $salt = SECURE_AUTH_SALT;
                } else {
-                       $salt = get_option('secure_auth_salt');
+                       $salt = get_site_option('secure_auth_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password(64);
-                               update_option('secure_auth_salt', $salt);
+                               $salt = wp_generate_password( 64, true, true );
+                               update_site_option('secure_auth_salt', $salt);
                        }
                }
        } elseif ( 'logged_in' == $scheme ) {
                if ( defined('LOGGED_IN_KEY') && ('' != LOGGED_IN_KEY) && ( $wp_default_secret_key != LOGGED_IN_KEY) )
                        $secret_key = LOGGED_IN_KEY;
 
-               if ( defined('LOGGED_IN_SALT') ) {
+               if ( defined('LOGGED_IN_SALT') && ('' != LOGGED_IN_SALT) && ( $wp_default_secret_key != LOGGED_IN_SALT) ) {
                        $salt = LOGGED_IN_SALT;
                } else {
-                       $salt = get_option('logged_in_salt');
+                       $salt = get_site_option('logged_in_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password(64);
-                               update_option('logged_in_salt', $salt);
+                               $salt = wp_generate_password( 64, true, true );
+                               update_site_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') ) {
+               if ( defined('NONCE_SALT') && ('' != NONCE_SALT) && ( $wp_default_secret_key != NONCE_SALT) ) {
                        $salt = NONCE_SALT;
                } else {
-                       $salt = get_option('nonce_salt');
+                       $salt = get_site_option('nonce_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password(64);
-                               update_option('nonce_salt', $salt);
+                               $salt = wp_generate_password( 64, true, true );
+                               update_site_option('nonce_salt', $salt);
                        }
                }
        } else {
@@ -1461,18 +1493,25 @@ if ( !function_exists('wp_generate_password') ) :
  * @since 2.5
  *
  * @param int $length The length of password to generate
- * @param bool $special_chars Whether to include standard special characters
+ * @param bool $special_chars Whether to include standard special characters. Default true.
+ * @param bool $extra_special_chars Whether to include other special characters. Used when
+ *   generating secret keys and salts. Default false.
  * @return string The random password
  **/
-function wp_generate_password($length = 12, $special_chars = true) {
+function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
        $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
        if ( $special_chars )
                $chars .= '!@#$%^&*()';
+       if ( $extra_special_chars )
+               $chars .= '-_ []{}<>~`+=,.;:/?|';
 
        $password = '';
-       for ( $i = 0; $i < $length; $i++ )
+       for ( $i = 0; $i < $length; $i++ ) {
                $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
-       return $password;
+       }
+
+       // random_password filter was previously in random_password function which was deprecated
+       return apply_filters('random_password', $password);
 }
 endif;
 
@@ -1489,16 +1528,19 @@ if ( !function_exists('wp_rand') ) :
 function wp_rand( $min = 0, $max = 0 ) {
        global $rnd_value;
 
-       $seed = get_transient('random_seed');
-
        // Reset $rnd_value after 14 uses
        // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
        if ( strlen($rnd_value) < 8 ) {
+               if ( defined( 'WP_SETUP_CONFIG' ) )
+                       static $seed = '';
+               else
+                       $seed = get_transient('random_seed');
                $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
                $rnd_value .= sha1($rnd_value);
                $rnd_value .= sha1($rnd_value . $seed);
                $seed = md5($seed . $rnd_value);
-               set_transient('random_seed', $seed);
+               if ( ! defined( 'WP_SETUP_CONFIG' ) )
+                       set_transient('random_seed', $seed);
        }
 
        // Take the first 8 digits for our value
@@ -1572,8 +1614,10 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
                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
+               // No avatar for pingbacks or trackbacks
+               $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
+               if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) )
+                       return false;
 
                if ( !empty($id_or_email->user_id) ) {
                        $id = (int) $id_or_email->user_id;
@@ -1595,10 +1639,17 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
                        $default = $avatar_default;
        }
 
-       if ( is_ssl() )
+       if ( !empty($email) )
+               $email_hash = md5( strtolower( $email ) );
+
+       if ( is_ssl() ) {
                $host = 'https://secure.gravatar.com';
-       else
-               $host = 'http://www.gravatar.com';
+       } else {
+               if ( !empty($email) )
+                       $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash{0} ) % 2 ) );
+               else
+                       $host = 'http://0.gravatar.com';
+       }
 
        if ( 'mystery' == $default )
                $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
@@ -1615,7 +1666,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
 
        if ( !empty($email) ) {
                $out = "$host/avatar/";
-               $out .= md5( strtolower( $email ) );
+               $out .= $email_hash;
                $out .= '?s='.$size;
                $out .= '&amp;d=' . urlencode( $default );
 
@@ -1632,93 +1683,6 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
 }
 endif;
 
-if ( !function_exists('wp_setcookie') ) :
-/**
- * Sets a cookie for a user who just logged in.
- *
- * @since 1.5
- * @deprecated Use wp_set_auth_cookie()
- * @see wp_set_auth_cookie()
- *
- * @param string  $username The user's username
- * @param string  $password Optional. The user's password
- * @param bool $already_md5 Optional. Whether the password has already been through MD5
- * @param string $home Optional. Will be used instead of COOKIEPATH if set
- * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
- * @param bool $remember Optional. Remember that the user is logged in
- */
-function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
-       _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
-       $user = get_userdatabylogin($username);
-       wp_set_auth_cookie($user->ID, $remember);
-}
-endif;
-
-if ( !function_exists('wp_clearcookie') ) :
-/**
- * Clears the authentication cookie, logging the user out.
- *
- * @since 1.5
- * @deprecated Use wp_clear_auth_cookie()
- * @see wp_clear_auth_cookie()
- */
-function wp_clearcookie() {
-       _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
-       wp_clear_auth_cookie();
-}
-endif;
-
-if ( !function_exists('wp_get_cookie_login') ):
-/**
- * Gets the user cookie login.
- *
- * This function is deprecated and should no longer be extended as it won't be
- * used anywhere in WordPress. Also, plugins shouldn't use it either.
- *
- * @since 2.0.3
- * @deprecated No alternative
- *
- * @return bool Always returns false
- */
-function wp_get_cookie_login() {
-       _deprecated_function( __FUNCTION__, '2.5', '' );
-       return false;
-}
-endif;
-
-if ( !function_exists('wp_login') ) :
-/**
- * Checks a users login information and logs them in if it checks out.
- *
- * Use the global $error to get the reason why the login failed. If the username
- * is blank, no error will be set, so assume blank username on that case.
- *
- * Plugins extending this function should also provide the global $error and set
- * what the error is, so that those checking the global for why there was a
- * failure can utilize it later.
- *
- * @since 1.2.2
- * @deprecated Use wp_signon()
- * @global string $error Error when false is returned
- *
- * @param string $username User's username
- * @param string $password User's password
- * @param bool $deprecated Not used
- * @return bool False on login failure, true on successful check
- */
-function wp_login($username, $password, $deprecated = '') {
-       global $error;
-
-       $user = wp_authenticate($username, $password);
-
-       if ( ! is_wp_error($user) )
-               return true;
-
-       $error = $user->get_error_message();
-       return false;
-}
-endif;
-
 if ( !function_exists( 'wp_text_diff' ) ) :
 /**
  * Displays a human readable HTML representation of the difference between two strings.
@@ -1788,4 +1752,3 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
        return $r;
 }
 endif;
-
index 29134ac47d6e680d6ad22191e7f6a4d3b7da0ffe..c87e4172262969c250bee55865de7294948c96af 100644 (file)
@@ -173,6 +173,59 @@ function apply_filters($tag, $value) {
        return $value;
 }
 
+/**
+ * Execute functions hooked on a specific filter hook, specifying arguments in an array.
+ *
+ * @see apply_filters() 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
+ * @since 3.0.0
+ * @global array $wp_filter Stores all of the filters
+ * @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.
+ * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
+ * @return mixed The filtered value after all hooked functions are applied to it.
+ */
+function apply_filters_ref_array($tag, $args) {
+       global $wp_filter, $merged_filters, $wp_current_filter;
+
+       $wp_current_filter[] = $tag;
+
+       // Do 'all' actions first
+       if ( isset($wp_filter['all']) ) {
+               $all_args = func_get_args();
+               _wp_call_all_hook($all_args);
+       }
+
+       if ( !isset($wp_filter[$tag]) ) {
+               array_pop($wp_current_filter);
+               return $args[0];
+       }
+
+       // Sort
+       if ( !isset( $merged_filters[ $tag ] ) ) {
+               ksort($wp_filter[$tag]);
+               $merged_filters[ $tag ] = true;
+       }
+
+       reset( $wp_filter[ $tag ] );
+
+       do {
+               foreach( (array) current($wp_filter[$tag]) as $the_ )
+                       if ( !is_null($the_['function']) )
+                               $args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+
+       } while ( next($wp_filter[$tag]) !== false );
+
+       array_pop( $wp_current_filter );
+
+       return $args[0];
+}
+
 /**
  * Removes a function from a specified filter hook.
  *
@@ -222,7 +275,7 @@ 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]) )
+               if( false !== $priority && isset($wp_filter[$tag][$priority]) )
                        unset($wp_filter[$tag][$priority]);
                else
                        unset($wp_filter[$tag]);
@@ -299,10 +352,13 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
 function do_action($tag, $arg = '') {
        global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
 
-       if ( is_array($wp_actions) )
-               $wp_actions[] = $tag;
+       if ( ! isset($wp_actions) )
+               $wp_actions = array();
+
+       if ( ! isset($wp_actions[$tag]) )
+               $wp_actions[$tag] = 1;
        else
-               $wp_actions = array($tag);
+               ++$wp_actions[$tag];
 
        $wp_current_filter[] = $tag;
 
@@ -318,7 +374,7 @@ function do_action($tag, $arg = '') {
        }
 
        $args = array();
-       if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this)
+       if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
                $args[] =& $arg[0];
        else
                $args[] = $arg;
@@ -357,10 +413,10 @@ function do_action($tag, $arg = '') {
 function did_action($tag) {
        global $wp_actions;
 
-       if ( empty($wp_actions) )
+       if ( ! isset( $wp_actions ) || ! isset( $wp_actions[$tag] ) )
                return 0;
 
-       return count(array_keys($wp_actions, $tag));
+       return $wp_actions[$tag];
 }
 
 /**
@@ -382,10 +438,13 @@ function did_action($tag) {
 function do_action_ref_array($tag, $args) {
        global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
 
-       if ( !is_array($wp_actions) )
-               $wp_actions = array($tag);
+       if ( ! isset($wp_actions) )
+               $wp_actions = array();
+
+       if ( ! isset($wp_actions[$tag]) )
+               $wp_actions[$tag] = 1;
        else
-               $wp_actions[] = $tag;
+               ++$wp_actions[$tag];
 
        $wp_current_filter[] = $tag;
 
@@ -675,9 +734,17 @@ function _wp_filter_build_unique_id($tag, $function, $priority) {
        global $wp_filter;
        static $filter_id_count = 0;
 
-       if ( is_string($function) ) {
+       if ( is_string($function) )
                return $function;
-       } else if (is_object($function[0]) ) {
+
+       if ( is_object($function) ) {
+               // Closures are currently implemented as objects
+               $function = array( $function, '' );
+       } else {
+               $function = (array) $function;
+       }
+
+       if (is_object($function[0]) ) {
                // Object Class Calling
                if ( function_exists('spl_object_hash') ) {
                        return spl_object_hash($function[0]) . $function[1];
@@ -692,7 +759,7 @@ function _wp_filter_build_unique_id($tag, $function, $priority) {
                        } else {
                                $obj_idx .= $function[0]->wp_filter_id;
                        }
-       
+
                        return $obj_idx;
                }
        } else if ( is_string($function[0]) ) {
index eb58f89dba0cbe11385c22efc75dc13c61c92556..07ddfd4d11022e315a10d61d8f3610b0d5c15fd8 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Contains Translation_Entry class
  *
- * @version $Id: entry.php 222 2009-09-07 21:14:23Z nbachiyski $
+ * @version $Id: entry.php 406 2010-02-07 11:10:24Z nbachiyski $
  * @package pomo
  * @subpackage entry
  */
@@ -46,7 +46,6 @@ class Translation_Entry {
                        return;
                }
                // get member variable values from args hash
-               $object_varnames = array_keys(get_object_vars($this));
                foreach ($args as $varname => $value) {
                        $this->$varname = $value;
                }
index 9b2ac1d0aaae3a15a7231a6be4e98c6e83d04275..72e0e7bf22bb7ae1ce1ece449f238ded3db4df94 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for working with MO files
  *
- * @version $Id: mo.php 293 2009-11-12 15:43:50Z nbachiyski $
+ * @version $Id: mo.php 406 2010-02-07 11:10:24Z nbachiyski $
  * @package pomo
  * @subpackage mo
  */
@@ -26,7 +26,7 @@ class MO extends Gettext_Translations {
                        return false;
                return $this->import_from_reader($reader);
        }
-       
+
        function export_to_file($filename) {
                $fh = fopen($filename, 'wb');
                if ( !$fh ) return false;
@@ -43,7 +43,7 @@ class MO extends Gettext_Translations {
                fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr,
                        $translations_lenghts_addr, $size_of_hash, $hash_addr));
                fseek($fh, $originals_lenghts_addr);
-               
+
                // headers' msgid is an empty string
                fwrite($fh, pack('VV', 0, $current_addr));
                $current_addr++;
@@ -55,24 +55,24 @@ class MO extends Gettext_Translations {
                        fwrite($fh, pack('VV', $length, $current_addr));
                        $current_addr += $length + 1; // account for the NULL byte after
                }
-               
+
                $exported_headers = $this->export_headers();
                fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));
                $current_addr += strlen($exported_headers) + 1;
                $translations_table = $exported_headers . chr(0);
-               
+
                foreach($entries as $entry) {
                        $translations_table .= $this->export_translations($entry) . chr(0);
                        $length = strlen($this->export_translations($entry));
                        fwrite($fh, pack('VV', $length, $current_addr));
                        $current_addr += $length + 1;
                }
-               
+
                fwrite($fh, $originals_table);
                fwrite($fh, $translations_table);
                fclose($fh);
        }
-       
+
        function export_original($entry) {
                //TODO: warnings for control characters
                $exported = $entry->singular;
@@ -80,12 +80,12 @@ class MO extends Gettext_Translations {
                if (!is_null($entry->context)) $exported = $entry->context . chr(4) . $exported;
                return $exported;
        }
-       
+
        function export_translations($entry) {
                //TODO: warnings for control characters
                return implode(chr(0), $entry->translations);
        }
-       
+
        function export_headers() {
                $exported = '';
                foreach($this->headers as $header => $value) {
@@ -193,7 +193,7 @@ class MO extends Gettext_Translations {
        /**
         * Build a Translation_Entry from original string and translation strings,
         * found in a MO file
-        * 
+        *
         * @static
         * @param string $original original string to translate from MO file. Might contain
         *      0x04 as context separator or 0x00 as singular/plural separator
@@ -201,7 +201,7 @@ class MO extends Gettext_Translations {
         *      0x00 as a plural translations separator
         */
        function &make_entry($original, $translation) {
-               $entry = new Translation_Entry();
+               $entry = new Translation_Entry();
                // look for context
                $parts = explode(chr(4), $original);
                if (isset($parts[1])) {
index fb0d8e408c6fce3bc73b9fd145455b6d128f1dff..8e3eb611512bdea6af9a28cf1fe3df36f172ac2b 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for working with PO files
  *
- * @version $Id: po.php 283 2009-09-23 16:21:51Z nbachiyski $
+ * @version $Id: po.php 406 2010-02-07 11:10:24Z nbachiyski $
  * @package pomo
  * @subpackage po
  */
@@ -18,7 +18,7 @@ ini_set('auto_detect_line_endings', 1);
  */
 if ( !class_exists( 'PO' ) ):
 class PO extends Gettext_Translations {
-       
+
 
        /**
         * Exports headers to a PO entry
@@ -106,10 +106,10 @@ class PO extends Gettext_Translations {
                $po = str_replace("$newline$quote$quote", '', $po);
                return $po;
        }
-       
+
        /**
         * Gives back the original string from a PO-formatted string
-        * 
+        *
         * @static
         * @param string $string PO-formatted string
         * @return string enascaped string
@@ -139,7 +139,7 @@ class PO extends Gettext_Translations {
        }
 
        /**
-        * Inserts $with in the beginning of every new line of $string and 
+        * Inserts $with in the beginning of every new line of $string and
         * returns the modified string
         *
         * @static
@@ -217,7 +217,7 @@ class PO extends Gettext_Translations {
                PO::read_line($f, 'clear');
                return $res !== false;
        }
-       
+
        function read_entry($f, $lineno = 0) {
                $entry = new Translation_Entry();
                // where were we in the last step
@@ -254,7 +254,7 @@ class PO extends Gettext_Translations {
                                        return false;
                                }
                                // add comment
-                               $this->add_comment_to_entry($entry, $line);;
+                               $this->add_comment_to_entry($entry, $line);
                        } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) {
                                if ($is_final($context)) {
                                        PO::read_line($f, 'put-back');
@@ -322,7 +322,7 @@ class PO extends Gettext_Translations {
                }
                return array('entry' => $entry, 'lineno' => $lineno);
        }
-       
+
        function read_line($f, $action = 'read') {
                static $last_line = '';
                static $use_last_line = false;
@@ -339,7 +339,7 @@ class PO extends Gettext_Translations {
                $use_last_line = false;
                return $line;
        }
-       
+
        function add_comment_to_entry(&$entry, $po_comment_line) {
                $first_two = substr($po_comment_line, 0, 2);
                $comment = trim(substr($po_comment_line, 2));
@@ -353,11 +353,11 @@ class PO extends Gettext_Translations {
                        $entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
                }
        }
-       
+
        function trim_quotes($s) {
                if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
                if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
                return $s;
        }
 }
-endif;
\ No newline at end of file
+endif;
index 341fee45405a9ac9044538c3f434a8afcc747cc7..8ac94c35d6184b3c3b62dffbd6ecbc99eee155d7 100644 (file)
@@ -3,22 +3,22 @@
  * Classes, which help reading streams of data from files.
  * Based on the classes from Danilo Segan <danilo@kvota.net>
  *
- * @version $Id: streams.php 293 2009-11-12 15:43:50Z nbachiyski $
+ * @version $Id: streams.php 406 2010-02-07 11:10:24Z nbachiyski $
  * @package pomo
  * @subpackage streams
  */
 
 if ( !class_exists( 'POMO_Reader' ) ):
 class POMO_Reader {
-       
+
        var $endian = 'little';
        var $_post = '';
-       
+
        function POMO_Reader() {
                $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
                $this->_pos = 0;
        }
-       
+
        /**
         * Sets the endianness of the file.
         *
@@ -57,8 +57,8 @@ class POMO_Reader {
                $endian_letter = ('big' == $this->endian)? 'N' : 'V';
                return unpack($endian_letter.$count, $bytes);
        }
-       
-       
+
+
        function substr($string, $start, $length) {
                if ($this->is_overloaded) {
                        return mb_substr($string, $start, $length, 'ascii');
@@ -66,7 +66,7 @@ class POMO_Reader {
                        return substr($string, $start, $length);
                }
        }
-       
+
        function strlen($string) {
                if ($this->is_overloaded) {
                        return mb_strlen($string, 'ascii');
@@ -74,7 +74,7 @@ class POMO_Reader {
                        return strlen($string);
                }
        }
-       
+
        function str_split($string, $chunk_size) {
                if (!function_exists('str_split')) {
                        $length = $this->strlen($string);
@@ -86,8 +86,8 @@ class POMO_Reader {
                        return str_split( $string, $chunk_size );
                }
        }
-       
-               
+
+
        function pos() {
                return $this->_pos;
        }
@@ -95,7 +95,7 @@ class POMO_Reader {
        function is_resource() {
                return true;
        }
-       
+
        function close() {
                return true;
        }
@@ -108,11 +108,11 @@ class POMO_FileReader extends POMO_Reader {
                parent::POMO_Reader();
                $this->_f = fopen($filename, 'r');
        }
-       
+
        function read($bytes) {
                return fread($this->_f, $bytes);
        }
-       
+
        function seekto($pos) {
                if ( -1 == fseek($this->_f, $pos, SEEK_SET)) {
                        return false;
@@ -120,19 +120,19 @@ class POMO_FileReader extends POMO_Reader {
                $this->_pos = $pos;
                return true;
        }
-       
+
        function is_resource() {
                return is_resource($this->_f);
        }
-       
+
        function feof() {
                return feof($this->_f);
        }
-       
+
        function close() {
                return fclose($this->_f);
        }
-       
+
        function read_all() {
                $all = '';
                while ( !$this->feof() )
@@ -148,9 +148,9 @@ if ( !class_exists( 'POMO_StringReader' ) ):
  * of a physical file.
  */
 class POMO_StringReader extends POMO_Reader {
-       
+
        var $_str = '';
-       
+
        function POMO_StringReader($str = '') {
                parent::POMO_Reader();
                $this->_str = $str;
@@ -178,7 +178,7 @@ class POMO_StringReader extends POMO_Reader {
        function read_all() {
                return $this->substr($this->_str, $this->_pos, $this->strlen($this->_str));
        }
-       
+
 }
 endif;
 
index 11f9b8459ff2e36542b563f7e14e71086b64e62d..01be8df42d20d5a6378ee927cd73c6138d7b2b46 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for a set of entries for translation and their associated headers
  *
- * @version $Id: translations.php 291 2009-10-21 05:46:08Z nbachiyski $
+ * @version $Id: translations.php 406 2010-02-07 11:10:24Z nbachiyski $
  * @package pomo
  * @subpackage translations
  */
@@ -104,7 +104,9 @@ class Translations {
         * @return void
         **/
        function merge_with(&$other) {
-               $this->entries = array_merge($this->entries, $other->entries);
+               foreach( $other->entries as $entry ) {
+                       $this->entries[$entry->key()] = $entry;
+               }
        }
 }
 
@@ -124,7 +126,7 @@ class Gettext_Translations extends Translations {
                }
                return call_user_func($this->_gettext_select_plural_form, $count);
        }
-       
+
        function nplurals_and_expression_from_header($header) {
                if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) {
                        $nplurals = (int)$matches[1];
@@ -150,7 +152,7 @@ class Gettext_Translations extends Translations {
        /**
         * Adds parantheses to the inner parts of ternary operators in
         * plural expressions, because PHP evaluates ternary oerators from left to right
-        * 
+        *
         * @param string $expression the expression without parentheses
         * @return string the expression with parentheses added
         */
@@ -178,7 +180,7 @@ class Gettext_Translations extends Translations {
                }
                return rtrim($res, ';');
        }
-       
+
        function make_headers($translation) {
                $headers = array();
                // sometimes \ns are used instead of real new lines
@@ -191,7 +193,7 @@ class Gettext_Translations extends Translations {
                }
                return $headers;
        }
-       
+
        function set_header($header, $value) {
                parent::set_header($header, $value);
                if ('Plural-Forms' == $header) {
@@ -210,7 +212,7 @@ if ( !class_exists( 'NOOP_Translations' ) ):
 class NOOP_Translations {
        var $entries = array();
        var $headers = array();
-       
+
        function add_entry($entry) {
                return true;
        }
index 9b6efcdac3e8ee1bd37fc04b6649eab689fca9b6..e86071662bbc719b1a280f5ca34ebc87bb3c9a52 100644 (file)
@@ -106,7 +106,8 @@ function the_title_attribute( $args = '' ) {
 function get_the_title( $id = 0 ) {
        $post = &get_post($id);
 
-       $title = $post->post_title;
+       $title = isset($post->post_title) ? $post->post_title : '';
+       $id = isset($post->ID) ? $post->ID : (int) $id;
 
        if ( !is_admin() ) {
                if ( !empty($post->post_password) ) {
@@ -117,7 +118,7 @@ function get_the_title( $id = 0 ) {
                        $title = sprintf($private_title_format, $title);
                }
        }
-       return apply_filters( 'the_title', $title, $post->ID );
+       return apply_filters( 'the_title', $title, $id );
 }
 
 /**
@@ -127,12 +128,14 @@ function get_the_title( $id = 0 ) {
  * post. The reason you should not use it as a link, is because of moving the
  * blog across domains.
  *
+ * Url is escaped to make it xml safe
+ *
  * @since 1.5.0
  *
  * @param int $id Optional. Post ID.
  */
 function the_guid( $id = 0 ) {
-       echo get_the_guid($id);
+       echo esc_url( get_the_guid( $id ) );
 }
 
 /**
@@ -178,7 +181,7 @@ function the_content($more_link_text = null, $stripteaser = 0) {
  * @return string
  */
 function get_the_content($more_link_text = null, $stripteaser = 0) {
-       global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
+       global $id, $post, $more, $page, $pages, $multipage, $preview;
 
        if ( null === $more_link_text )
                $more_link_text = __( '(more...)' );
@@ -245,7 +248,10 @@ function the_excerpt() {
  * @param mixed $deprecated Not used.
  * @return string
  */
-function get_the_excerpt($deprecated = '') {
+function get_the_excerpt( $deprecated = '' ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.3' );
+
        global $post;
        $output = $post->post_excerpt;
        if ( post_password_required($post) ) {
@@ -309,9 +315,10 @@ function get_post_class( $class = '', $post_id = null ) {
 
        $classes[] = 'post-' . $post->ID;
        $classes[] = $post->post_type;
+       $classes[] = 'type-' . $post->post_type;
 
        // sticky for Sticky Posts
-       if ( is_sticky($post->ID) && is_home())
+       if ( is_sticky($post->ID) && is_home() && !is_paged() )
                $classes[] = 'sticky';
 
        // hentry for hAtom compliace
@@ -339,7 +346,7 @@ function get_post_class( $class = '', $post_id = null ) {
 
        $classes = array_map('esc_attr', $classes);
 
-       return apply_filters('post_class', $classes, $class, $post_id);
+       return apply_filters('post_class', $classes, $class, $post->ID);
 }
 
 /**
@@ -363,11 +370,11 @@ function body_class( $class = '' ) {
  * @return array Array of classes.
  */
 function get_body_class( $class = '' ) {
-       global $wp_query, $wpdb, $current_user;
+       global $wp_query, $wpdb;
 
        $classes = array();
 
-       if ( 'rtl' == get_bloginfo('text_direction') )
+       if ( is_rtl() )
                $classes[] = 'rtl';
 
        if ( is_front_page() )
@@ -388,55 +395,55 @@ function get_body_class( $class = '' ) {
                $classes[] = 'error404';
 
        if ( is_single() ) {
-               $wp_query->post = $wp_query->posts[0];
-               setup_postdata($wp_query->post);
+               $post_id = $wp_query->get_queried_object_id();
+               $post = $wp_query->get_queried_object();
 
-               $postID = $wp_query->post->ID;
-               $classes[] = 'single postid-' . $postID;
+               $classes[] = 'single';
+               $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
+               $classes[] = 'postid-' . $post_id;
 
                if ( is_attachment() ) {
-                       $mime_type = get_post_mime_type();
+                       $mime_type = get_post_mime_type($post_id);
                        $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
-                       $classes[] = 'attachmentid-' . $postID;
-                       $classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type);
+                       $classes[] = 'attachmentid-' . $post_id;
+                       $classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
                }
        } elseif ( is_archive() ) {
                if ( is_author() ) {
                        $author = $wp_query->get_queried_object();
                        $classes[] = 'author';
-                       $classes[] = 'author-' . sanitize_html_class($author->user_nicename , $author->ID);
+                       $classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID );
                } elseif ( is_category() ) {
                        $cat = $wp_query->get_queried_object();
                        $classes[] = 'category';
-                       $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
+                       $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->cat_ID );
                } elseif ( is_tag() ) {
                        $tags = $wp_query->get_queried_object();
                        $classes[] = 'tag';
-                       $classes[] = 'tag-' . sanitize_html_class($tags->slug, $tags->term_id);
+                       $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
                }
        } elseif ( is_page() ) {
                $classes[] = 'page';
 
-               $wp_query->post = $wp_query->posts[0];
-               setup_postdata($wp_query->post);
+               $page_id = $wp_query->get_queried_object_id();
 
-               $pageID = $wp_query->post->ID;
+               $post = get_page($page_id);
 
-               $classes[] = 'page-id-' . $pageID;
+               $classes[] = 'page-id-' . $page_id;
 
-               if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
+               if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $page_id) ) )
                        $classes[] = 'page-parent';
 
-               if ( $wp_query->post->post_parent ) {
+               if ( $post->post_parent ) {
                        $classes[] = 'page-child';
-                       $classes[] = 'parent-pageid-' . $wp_query->post->post_parent;
+                       $classes[] = 'parent-pageid-' . $post->post_parent;
                }
                if ( is_page_template() ) {
                        $classes[] = 'page-template';
-                       $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
+                       $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_post_meta( $page_id, '_wp_page_template', true ) ), '' );
                }
        } elseif ( is_search() ) {
-               if ( !empty($wp_query->posts) )
+               if ( !empty( $wp_query->posts ) )
                        $classes[] = 'search-results';
                else
                        $classes[] = 'search-no-results';
@@ -445,10 +452,10 @@ function get_body_class( $class = '' ) {
        if ( is_user_logged_in() )
                $classes[] = 'logged-in';
 
-       $page = $wp_query->get('page');
+       $page = $wp_query->get( 'page' );
 
        if ( !$page || $page < 2)
-               $page = $wp_query->get('paged');
+               $page = $wp_query->get( 'paged' );
 
        if ( $page && $page > 1 ) {
                $classes[] = 'paged-' . $page;
@@ -469,15 +476,15 @@ function get_body_class( $class = '' ) {
                        $classes[] = 'search-paged-' . $page;
        }
 
-       if ( !empty($class) ) {
+       if ( !empty( $class ) ) {
                if ( !is_array( $class ) )
-                       $class = preg_split('#\s+#', $class);
-               $classes = array_merge($classes, $class);
+                       $class = preg_split( '#\s+#', $class );
+               $classes = array_merge( $classes, $class );
        }
 
-       $classes = array_map('esc_attr', $classes);
+       $classes = array_map( 'esc_attr', $classes );
 
-       return apply_filters('body_class', $classes, $class);
+       return apply_filters( 'body_class', $classes, $class );
 }
 
 /**
@@ -545,9 +552,11 @@ function sticky_class( $post_id = null ) {
  * 'after' - Default is '</p>' (string). The html or text to append to each
  *      bookmarks.
  * 'link_before' - Default is '' (string). The html or text to prepend to each
- *      Pages link inside the <a> tag.
+ *      Pages link inside the <a> tag. Also prepended to the current item, which
+ *      is not linked.
  * 'link_after' - Default is '' (string). The html or text to append to each
- *      Pages link inside the <a> tag.
+ *      Pages link inside the <a> tag. Also appended to the current item, which
+ *      is not linked.
  *
  * @since 1.2.0
  * @access private
@@ -565,6 +574,7 @@ function wp_link_pages($args = '') {
        );
 
        $r = wp_parse_args( $args, $defaults );
+       $r = apply_filters( 'wp_link_pages_args', $r );
        extract( $r, EXTR_SKIP );
 
        global $post, $page, $numpages, $multipage, $more, $pagenow;
@@ -574,14 +584,16 @@ function wp_link_pages($args = '') {
                if ( 'number' == $next_or_number ) {
                        $output .= $before;
                        for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
-                               $j = str_replace('%',"$i",$pagelink);
+                               $j = str_replace('%',$i,$pagelink);
                                $output .= ' ';
                                if ( ($i != $page) || ((!$more) && ($page==1)) ) {
                                        if ( 1 == $i ) {
                                                $output .= '<a href="' . get_permalink() . '">';
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
+                                                       $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+                                               elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
                                                else
                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
                                        }
@@ -600,24 +612,30 @@ function wp_link_pages($args = '') {
                                $i = $page - 1;
                                if ( $i && $more ) {
                                        if ( 1 == $i ) {
-                                               $output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
+                                               $output .= '<a href="' . get_permalink() . '">';
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
+                                                       $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+                                               elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
                                                else
-                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
                                        }
+                                       $output .= $link_before. $previouspagelink . $link_after . '</a>';
                                }
                                $i = $page + 1;
                                if ( $i <= $numpages && $more ) {
                                        if ( 1 == $i ) {
-                                               $output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
+                                               $output .= '<a href="' . get_permalink() . '">';
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
+                                                       $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+                                               elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
                                                else
-                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
                                        }
+                                       $output .= $link_before. $nextpagelink . $link_after . '</a>';
                                }
                                $output .= $after;
                        }
@@ -641,12 +659,14 @@ function wp_link_pages($args = '') {
  * @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.
+ * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
  */
 function post_custom( $key = '' ) {
        $custom = get_post_custom();
 
-       if ( 1 == count($custom[$key]) )
+       if ( !isset( $custom[$key] ) )
+               return false;
+       elseif ( 1 == count($custom[$key]) )
                return $custom[$key][0];
        else
                return $custom[$key];
@@ -690,7 +710,8 @@ function wp_dropdown_pages($args = '') {
        $defaults = array(
                'depth' => 0, 'child_of' => 0,
                'selected' => 0, 'echo' => 1,
-               'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
+               'name' => 'page_id', 'id' => '',
+               'show_option_none' => '', 'show_option_no_change' => '',
                'option_none_value' => ''
        );
 
@@ -700,9 +721,12 @@ function wp_dropdown_pages($args = '') {
        $pages = get_pages($r);
        $output = '';
        $name = esc_attr($name);
+       // Back-compat with old system where both id and name were based on $name argument
+       if ( empty($id) )
+               $id = $name;
 
        if ( ! empty($pages) ) {
-               $output = "<select name=\"$name\" id=\"$name\">\n";
+               $output = "<select name=\"$name\" id=\"$id\">\n";
                if ( $show_option_no_change )
                        $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
                if ( $show_option_none )
@@ -810,7 +834,7 @@ function wp_page_menu( $args = array() ) {
        $list_args = $args;
 
        // Show Home in the menu
-       if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
+       if ( ! empty($args['show_home']) ) {
                if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
                        $text = __('Home');
                else
@@ -818,7 +842,7 @@ function wp_page_menu( $args = array() ) {
                $class = '';
                if ( is_front_page() && !is_paged() )
                        $class = 'class="current_page_item"';
-               $menu .= '<li ' . $class . '><a href="' . get_option('home') . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
+               $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '" title="' . esc_attr($text) . '">' . $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'] ) ) {
@@ -897,7 +921,10 @@ function walk_page_dropdown_tree() {
  * @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) {
+function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '2.5' );
+
        if ( $fullsize )
                echo wp_get_attachment_link($id, 'full', $permalink);
        else
@@ -933,6 +960,8 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
                $link_text = esc_attr($text);
        } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
                $link_text = wp_get_attachment_image($id, $size, $icon);
+       } else {
+               $link_text = '';
        }
 
        if( trim($link_text) == '' )
@@ -941,158 +970,6 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
        return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
 }
 
-/**
- * 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);
-
-       if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
-               return __('Missing Attachment');
-
-       if ( $permalink )
-               $url = get_attachment_link($_post->ID);
-
-       $post_title = esc_attr($_post->post_title);
-
-       $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
-       return "<a href='$url' title='$post_title'>$innerHTML</a>";
-}
-
-/**
- * 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) )
-               return false;
-
-       $file = get_attached_file( $post->ID );
-
-       if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
-               // We have a thumbnail desired, specified and existing
-
-               $src_file = basename($src);
-               $class = 'attachmentthumb';
-       } elseif ( wp_attachment_is_image( $post->ID ) ) {
-               // We have an image without a thumbnail
-
-               $src = wp_get_attachment_url( $post->ID );
-               $src_file = & $file;
-               $class = 'attachmentimage';
-       } elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
-               // No thumb, no image. We'll look for a mime-related icon instead.
-
-               $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
-               $src_file = $icon_dir . '/' . basename($src);
-       }
-
-       if ( !isset($src) || !$src )
-               return false;
-
-       return array($src, $src_file);
-}
-
-/**
- * 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;
-
-       if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
-               return false;
-
-       list($src, $src_file) = $src;
-
-       // Do we need to constrain the image?
-       if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
-
-               $imagesize = getimagesize($src_file);
-
-               if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
-                       $actual_aspect = $imagesize[0] / $imagesize[1];
-                       $desired_aspect = $max_dims[0] / $max_dims[1];
-
-                       if ( $actual_aspect >= $desired_aspect ) {
-                               $height = $actual_aspect * $max_dims[0];
-                               $constraint = "width='{$max_dims[0]}' ";
-                               $post->iconsize = array($max_dims[0], $height);
-                       } else {
-                               $width = $max_dims[1] / $actual_aspect;
-                               $constraint = "height='{$max_dims[1]}' ";
-                               $post->iconsize = array($width, $max_dims[1]);
-                       }
-               } else {
-                       $post->iconsize = array($imagesize[0], $imagesize[1]);
-                       $constraint = '';
-               }
-       } else {
-               $constraint = '';
-       }
-
-       $post_title = esc_attr($post->post_title);
-
-       $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
-
-       return apply_filters( 'attachment_icon', $icon, $post->ID );
-}
-
-/**
- * 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) )
-               return false;
-
-       if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
-               return $innerHTML;
-
-
-       $innerHTML = esc_attr($post->post_title);
-
-       return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
-}
-
 /**
  * Wrap attachment in <<p>> element before content.
  *
@@ -1143,8 +1020,8 @@ function get_the_password_form() {
 /**
  * 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
+ * This template tag allows you to determine if you are in a page template.
+ * You can optionally provide a template name and then the check will be
  * specific to that template.
  *
  * @since 2.5.0
@@ -1203,7 +1080,7 @@ function wp_post_revision_title( $revision, $link = true ) {
        /* translators: 1: date */
        $currentf  = __( '%1$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>";
 
@@ -1253,17 +1130,17 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
        extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
 
        switch ( $type ) {
-       case 'autosave' :
-               if ( !$autosave = wp_get_post_autosave( $post->ID ) )
-                       return;
-               $revisions = array( $autosave );
-               break;
-       case 'revision' : // just revisions - remove autosave later
-       case 'all' :
-       default :
-               if ( !$revisions = wp_get_post_revisions( $post->ID ) )
-                       return;
-               break;
+               case 'autosave' :
+                       if ( !$autosave = wp_get_post_autosave( $post->ID ) )
+                               return;
+                       $revisions = array( $autosave );
+                       break;
+               case 'revision' : // just revisions - remove autosave later
+               case 'all' :
+               default :
+                       if ( !$revisions = wp_get_post_revisions( $post->ID ) )
+                               return;
+                       break;
        }
 
        /* translators: post revision: 1: when, 2: author name */
@@ -1294,12 +1171,13 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
                        $class = $class ? '' : " class='alternate'";
 
                        if ( $post->ID != $revision->ID && $can_edit_post )
-                               $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'diff' => false, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';
+                               $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';
                        else
                                $actions = '';
 
                        $rows .= "<tr$class>\n";
-                       $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
+                       $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n";
+                       $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
                        $rows .= "\t<td>$date</td>\n";
                        $rows .= "\t<td>$name</td>\n";
                        $rows .= "\t<td class='action-links'>$actions</td>\n";
@@ -1318,20 +1196,23 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
        <div class="alignleft">
                <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />
                <input type="hidden" name="action" value="diff" />
+               <input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" />
        </div>
 </div>
 
 <br class="clear" />
 
-<table class="widefat post-revisions" cellspacing="0">
+<table class="widefat post-revisions" cellspacing="0" id="post-revisions">
+       <col />
        <col />
        <col style="width: 33%" />
        <col style="width: 33%" />
        <col style="width: 33%" />
 <thead>
 <tr>
-       <th scope="col"></th>
-       <th scope="col"><?php _e( 'Date Created' ); ?></th>
+       <th scope="col"><?php /* translators: column name in revisons */ _ex( 'Old', 'revisions column name' ); ?></th>
+       <th scope="col"><?php /* translators: column name in revisons */ _ex( 'New', 'revisions column name' ); ?></th>
+       <th scope="col"><?php /* translators: column name in revisons */ _ex( 'Date Created', 'revisions column name' ); ?></th>
        <th scope="col"><?php _e( 'Author' ); ?></th>
        <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
 </tr>
index 5f59040537d7d3a28ec044dc5499f88d204b9dfa..547d4e170730d61ff17c50ea543a935e5492b9de 100644 (file)
 
 /**
  * Check if post has an image attached.
- * 
+ *
  * @since 2.9.0
  *
  * @param int $post_id Optional. Post ID.
- * @return bool Whether post has an image attached (true) or not (false).
+ * @return bool Whether post has an image attached.
  */
 function has_post_thumbnail( $post_id = NULL ) {
        global $id;
@@ -25,7 +25,7 @@ function has_post_thumbnail( $post_id = NULL ) {
 
 /**
  * Retrieve Post Thumbnail ID.
- * 
+ *
  * @since 2.9.0
  *
  * @param int $post_id Optional. Post ID.
@@ -39,7 +39,7 @@ function get_post_thumbnail_id( $post_id = NULL ) {
 
 /**
  * Display Post Thumbnail.
- * 
+ *
  * @since 2.9.0
  *
  * @param int $size Optional. Image size.  Defaults to 'post-thumbnail', which theme sets using set_post_thumbnail_size( $width, $height, $crop_flag );.
@@ -51,7 +51,7 @@ function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
 
 /**
  * Retrieve Post Thumbnail.
- * 
+ *
  * @since 2.9.0
  *
  * @param int $post_id Optional. Post ID.
index 2e9807138076d568331cd17fbc7dd4de64b3a8bd..61743c21365241966cf41888faf3098827d4390a 100644 (file)
  * Creates the initial post types when 'init' action is fired.
  */
 function create_initial_post_types() {
-       register_post_type( 'post', array('exclude_from_search' => false) );
-       register_post_type( 'page', array('exclude_from_search' => false) );
-       register_post_type( 'attachment', array('exclude_from_search' => false) );
-       register_post_type( 'revision', array('exclude_from_search' => true) );
+       register_post_type( 'post', array(
+               'public'  => true,
+               '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
+               '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
+               'capability_type' => 'post',
+               'hierarchical' => false,
+               'rewrite' => false,
+               'query_var' => false,
+               'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions' ),
+       ) );
+
+       register_post_type( 'page', array(
+               'public' => true,
+               '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
+               '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
+               'capability_type' => 'page',
+               'hierarchical' => true,
+               'rewrite' => false,
+               'query_var' => false,
+               'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
+       ) );
+
+       register_post_type( 'attachment', array(
+               'labels' => array(
+                       'name' => __( 'Media' ),
+               ),
+               'public' => true,
+               'show_ui' => false,
+               '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
+               '_edit_link' => 'media.php?attachment_id=%d', /* internal use only. don't use this when registering your own post type. */
+               'capability_type' => 'post',
+               'hierarchical' => false,
+               'rewrite' => false,
+               'query_var' => false,
+               'can_export' => false,
+               'show_in_nav_menus' => false,
+       ) );
+
+       register_post_type( 'revision', array(
+               'labels' => array(
+                       'name' => __( 'Revisions' ),
+                       'singular_name' => __( 'Revision' ),
+               ),
+               'public' => false,
+               '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
+               '_edit_link' => 'revision.php?revision=%d', /* internal use only. don't use this when registering your own post type. */
+               'capability_type' => 'post',
+               'hierarchical' => false,
+               'rewrite' => false,
+               'query_var' => false,
+       ) );
+
+       register_post_type( 'nav_menu_item', array(
+               'labels' => array(
+                       'name' => __( 'Navigation Menu Items' ),
+                       'singular_name' => __( 'Navigation Menu Item' ),
+               ),
+               'public' => false,
+               '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
+               'capability_type' => 'post',
+               'hierarchical' => false,
+               'rewrite' => false,
+               'query_var' => false,
+       ) );
+
+       register_post_status( 'publish', array(
+               'label'       => _x( 'Published', 'post' ),
+               'public'      => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop( 'Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ),
+       ) );
+
+       register_post_status( 'future', array(
+               'label'       => _x( 'Scheduled', 'post' ),
+               'protected'   => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
+       ) );
+
+       register_post_status( 'draft', array(
+               'label'       => _x( 'Draft', 'post' ),
+               'protected'   => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ),
+       ) );
+
+       register_post_status( 'pending', array(
+               'label'       => _x( 'Pending', 'post' ),
+               'protected'   => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
+       ) );
+
+       register_post_status( 'private', array(
+               'label'       => _x( 'Private', 'post' ),
+               'private'     => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ),
+       ) );
+
+       register_post_status( 'trash', array(
+               'label'       => _x( 'Trash', 'post' ),
+               'internal'    => true,
+               '_builtin'    => true, /* internal use only. */
+               'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
+               'show_in_admin_status_list' => true,
+       ) );
+
+       register_post_status( 'auto-draft', array(
+               'label'    => 'auto-draft',
+               'internal' => true,
+               '_builtin' => true, /* internal use only. */
+       ) );
+
+       register_post_status( 'inherit', array(
+               'label'    => 'inherit',
+               'internal' => true,
+               '_builtin' => true, /* internal use only. */
+               'exclude_from_search' => false,
+       ) );
 }
 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
 
@@ -37,7 +153,7 @@ add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
  * @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 bool $unfiltered Whether to apply filters.
  * @return string The file path to the attached file.
  */
 function get_attached_file( $attachment_id, $unfiltered = false ) {
@@ -78,7 +194,7 @@ function update_attached_file( $attachment_id, $file ) {
  *
  * The path is relative to the current upload dir.
  *
- * @since 2.9
+ * @since 2.9.0
  * @uses apply_filters() Calls '_wp_relative_upload_path' on file path.
  *
  * @param string $path Full path to the file
@@ -253,10 +369,13 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
                wp_cache_add($post->ID, $_post, 'posts');
        } else {
                if ( is_object($post) )
-                       $post = $post->ID;
-               $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_id = $post->ID;
+               else
+                       $post_id = $post;
+
+               $post_id = (int) $post_id;
+               if ( ! $_post = wp_cache_get($post_id, 'posts') ) {
+                       $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id));
                        if ( ! $_post )
                                return $null;
                        _get_post_ancestors($_post);
@@ -365,14 +484,17 @@ function get_post_mime_type($ID = '') {
 function get_post_status($ID = '') {
        $post = get_post($ID);
 
-       if ( is_object($post) ) {
-               if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
-                       return get_post_status($post->post_parent);
-               else
-                       return $post->post_status;
-       }
+       if ( !is_object($post) )
+               return false;
 
-       return false;
+       // Unattached attachments are assumed to be published.
+       if ( ('attachment' == $post->post_type) && ('inherit' == $post->post_status) && ( 0 == $post->post_parent) )
+               return 'publish';
+
+       if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
+               return get_post_status($post->post_parent);
+
+       return $post->post_status;
 }
 
 /**
@@ -416,31 +538,207 @@ function get_page_statuses( ) {
        return $status;
 }
 
+/**
+ * Register a post type. Do not use before init.
+ *
+ * A simple function for creating or modifying a post status based on the
+ * parameters given. The function will accept an array (second optional
+ * parameter), along with a string for the post status name.
+ *
+ *
+ * Optional $args contents:
+ *
+ * label - A descriptive name for the post status marked for translation. Defaults to $post_status.
+ * public - Whether posts of this status should be shown in the admin UI. Defaults to true.
+ * exclude_from_search - Whether to exclude posts with this post status from search results. Defaults to true.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 3.0.0
+ * @uses $wp_post_statuses Inserts new post status object into the list
+ *
+ * @param string $post_status Name of the post status.
+ * @param array|string $args See above description.
+ */
+function register_post_status($post_status, $args = array()) {
+       global $wp_post_statuses;
+
+       if (!is_array($wp_post_statuses))
+               $wp_post_statuses = array();
+
+       // Args prefixed with an underscore are reserved for internal use.
+       $defaults = array('label' => false, 'label_count' => false, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => null, 'internal' => null, 'protected' => null, 'private' => null, 'show_in_admin_all' => null, 'publicly_queryable' => null, 'show_in_admin_status_list' => null, 'show_in_admin_all_list' => null, 'single_view_cap' => null);
+       $args = wp_parse_args($args, $defaults);
+       $args = (object) $args;
+
+       $post_status = sanitize_user($post_status, true);
+       $args->name = $post_status;
+
+       if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
+               $args->internal = true;
+
+       if ( null === $args->public  )
+               $args->public = false;
+
+       if ( null === $args->private  )
+               $args->private = false;
+
+       if ( null === $args->protected  )
+               $args->protected = false;
+
+       if ( null === $args->internal  )
+               $args->internal = false;
+
+       if ( null === $args->publicly_queryable )
+               $args->publicly_queryable = $args->public;
+
+       if ( null === $args->exclude_from_search )
+               $args->exclude_from_search = $args->internal;
+
+       if ( null === $args->show_in_admin_all_list )
+               $args->show_in_admin_all_list = !$args->internal;
+
+       if ( null === $args->show_in_admin_status_list )
+                       $args->show_in_admin_status_list = !$args->internal;
+
+       if ( null === $args->single_view_cap )
+               $args->single_view_cap = $args->public ? '' : 'edit';
+
+       if ( false === $args->label )
+               $args->label = $post_status;
+
+       if ( false === $args->label_count )
+               $args->label_count = array( $args->label, $args->label );
+
+       $wp_post_statuses[$post_status] = $args;
+
+       return $args;
+}
+
+/**
+ * Retrieve a post status object by name
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 3.0.0
+ * @uses $wp_post_statuses
+ * @see register_post_status
+ * @see get_post_statuses
+ *
+ * @param string $post_type The name of a registered post status
+ * @return object A post status object
+ */
+function get_post_status_object( $post_status ) {
+       global $wp_post_statuses;
+
+       if ( empty($wp_post_statuses[$post_status]) )
+               return null;
+
+       return $wp_post_statuses[$post_status];
+}
+
+/**
+ * Get a list of all registered post status objects.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 3.0.0
+ * @uses $wp_post_statuses
+ * @see register_post_status
+ * @see get_post_status_object
+ *
+ * @param array|string $args An array of key => value arguments to match against the post status objects.
+ * @param string $output The type of output to return, either post status 'names' or 'objects'. 'names' is the default.
+ * @param string $operator The logical operation to perform. 'or' means only one element
+ *  from the array needs to match; 'and' means all elements must match. The default is 'and'.
+ * @return array A list of post type names or objects
+ */
+function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
+       global $wp_post_statuses;
+
+       $field = ('names' == $output) ? 'name' : false;
+
+       return wp_filter_object_list($wp_post_statuses, $args, $operator, $field);
+}
+
+/**
+ * Whether the post type is hierarchical.
+ *
+ * A false return value might also mean that the post type does not exist.
+ *
+ * @since 3.0.0
+ * @see get_post_type_object
+ *
+ * @param string $post Post type name
+ * @return bool Whether post type is hierarchical.
+ */
+function is_post_type_hierarchical( $post_type ) {
+       if ( ! post_type_exists( $post_type ) )
+               return false;
+
+       $post_type = get_post_type_object( $post_type );
+       return $post_type->hierarchical;
+}
+
+/**
+ * Checks if a post type is registered.
+ *
+ * @since 3.0.0
+ * @uses get_post_type_object()
+ *
+ * @param string Post type name
+ * @return bool Whether post type is registered.
+ */
+function post_type_exists( $post_type ) {
+       return (bool) get_post_type_object( $post_type );
+}
+
 /**
  * Retrieve the post type of the current post or of a given post.
  *
  * @since 2.1.0
  *
- * @uses $wpdb
- * @uses $posts The Loop post global
+ * @uses $post The Loop current post global
  *
- * @param mixed $post Optional. Post object or post ID.
+ * @param mixed $the_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( $the_post = false ) {
+       global $post;
 
-       if ( false === $post )
-               $post = $posts[0];
-       elseif ( (int) $post )
-               $post = get_post($post, OBJECT);
+       if ( false === $the_post )
+               $the_post = $post;
+       elseif ( is_numeric($the_post) )
+               $the_post = get_post($the_post);
 
-       if ( is_object($post) )
-               return $post->post_type;
+       if ( is_object($the_post) )
+               return $the_post->post_type;
 
        return false;
 }
 
+/**
+ * Retrieve a post type object by name
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 3.0.0
+ * @uses $wp_post_types
+ * @see register_post_type
+ * @see get_post_types
+ *
+ * @param string $post_type The name of a registered post type
+ * @return object A post type object
+ */
+function get_post_type_object( $post_type ) {
+       global $wp_post_types;
+
+       if ( empty($wp_post_types[$post_type]) )
+               return null;
+
+       return $wp_post_types[$post_type];
+}
+
 /**
  * Get a list of all registered post type objects.
  *
@@ -449,36 +747,19 @@ function get_post_type($post = false) {
  * @since 2.9.0
  * @uses $wp_post_types
  * @see register_post_type
- * @see get_post_types
  *
- * @param array|string $args An array of key => value arguments to match against the post types.
- *  Only post types having attributes that match all arguments are returned.
+ * @param array|string $args An array of key => value arguments to match against the post type objects.
  * @param string $output The type of output to return, either post type 'names' or 'objects'. 'names' is the default.
+ * @param string $operator The logical operation to perform. 'or' means only one element
+ *  from the array needs to match; 'and' means all elements must match. The default is 'and'.
  * @return array A list of post type names or objects
  */
-function get_post_types( $args = array(), $output = 'names' ) {
+function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) {
        global $wp_post_types;
 
-       $do_names = false;
-       if ( 'names' == $output )
-               $do_names = true;
-
-       $post_types = array();
-       foreach ( (array) $wp_post_types as $post_type ) {
-               if ( empty($args) ) {
-                       if ( $do_names )
-                               $post_types[] = $post_type->name;
-                       else
-                               $post_types[] = $post_type;
-               } elseif ( array_intersect_assoc((array) $post_type, $args) ) {
-                       if ( $do_names )
-                               $post_types[] = $post_type->name;
-                       else
-                               $post_types[] = $post_type;
-               }
-       }
+       $field = ('names' == $output) ? 'name' : false;
 
-       return $post_types;
+       return wp_filter_object_list($wp_post_types, $args, $operator, $field);
 }
 
 /**
@@ -491,28 +772,277 @@ function get_post_types( $args = array(), $output = 'names' ) {
  *
  * Optional $args contents:
  *
- * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true.
+ * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used.
+ * - description - A short descriptive summary of what the post type is. Defaults to blank.
+ * - public - Whether posts of this type should be shown in the admin UI. Defaults to false.
+ * - exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public.
+ * - publicly_queryable - Whether post_type queries can be performed from the front page.  Defaults to whatever public is set as.
+ * - show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public.
+ * - menu_position - The position in the menu order the post type should appear. Defaults to the bottom.
+ * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon.
+ * - capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post".
+ * - capabilities - Array of capabilities for this post type. You can see accepted values in {@link get_post_type_capabilities()}. By default the capability_type is used to construct capabilities.
+ * - hierarchical - Whether the post type is hierarchical. Defaults to false.
+ * - supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none.
+ * - register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form.  Do remove_meta_box() and add_meta_box() calls in the callback.
+ * - taxonomies - An array of taxonomy identifiers that will be registered for the post type.  Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type().
+ * - labels - An array of labels for this post type. You can see accepted values in {@link get_post_type_labels()}. By default post labels are used for non-hierarchical types and page labels for hierarchical ones.
+ * - permalink_epmask - The default rewrite endpoint bitmasks.
+ * - rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize permastruct; default will use $post_type as slug.
+ * - query_var - false to prevent queries, or string to value of the query var to use for this post type
+ * - can_export - true allows this post type to be exported.
+ * - show_in_nav_menus - true makes this post type available for selection in navigation menus.
+ * - _builtin - true if this post type is a native or "built-in" post_type.  THIS IS FOR INTERNAL USE ONLY!
+ * - _edit_link - URL segement to use for edit link of this post type.  Set to 'post.php?post=%d'.  THIS IS FOR INTERNAL USE ONLY!
  *
- * @package WordPress
- * @subpackage Post
  * @since 2.9.0
  * @uses $wp_post_types Inserts new post type object into the list
  *
  * @param string $post_type Name of the post type.
  * @param array|string $args See above description.
+ * @return object the registered post type object
  */
 function register_post_type($post_type, $args = array()) {
-       global $wp_post_types;
+       global $wp_post_types, $wp_rewrite, $wp;
 
-       if (!is_array($wp_post_types))
+       if ( !is_array($wp_post_types) )
                $wp_post_types = array();
 
-       $defaults = array('exclude_from_search' => true);
+       // Args prefixed with an underscore are reserved for internal use.
+       $defaults = array(
+               'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null,
+               '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'capabilities' => array(), 'hierarchical' => false,
+               'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null,
+               'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
+               'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null
+       );
        $args = wp_parse_args($args, $defaults);
+       $args = (object) $args;
 
        $post_type = sanitize_user($post_type, true);
-       $args['name'] = $post_type;
-       $wp_post_types[$post_type] = (object) $args;
+       $args->name = $post_type;
+
+       // If not set, default to the setting for public.
+       if ( null === $args->publicly_queryable )
+               $args->publicly_queryable = $args->public;
+
+       // If not set, default to the setting for public.
+       if ( null === $args->show_ui )
+               $args->show_ui = $args->public;
+
+       // Whether to show this type in nav-menus.php.  Defaults to the setting for public.
+       if ( null === $args->show_in_nav_menus )
+               $args->show_in_nav_menus = $args->public;
+
+       // If not set, default to true if not public, false if public.
+       if ( null === $args->exclude_from_search )
+               $args->exclude_from_search = !$args->public;
+
+       if ( empty($args->capability_type) )
+               $args->capability_type = 'post';
+
+       $args->cap = get_post_type_capabilities( $args );
+       unset($args->capabilities);
+
+       if ( ! empty($args->supports) ) {
+               add_post_type_support($post_type, $args->supports);
+               unset($args->supports);
+       } else {
+               // Add default features
+               add_post_type_support($post_type, array('title', 'editor'));
+       }
+
+       if ( false !== $args->query_var && !empty($wp) ) {
+               if ( true === $args->query_var )
+                       $args->query_var = $post_type;
+               $args->query_var = sanitize_title_with_dashes($args->query_var);
+               $wp->add_query_var($args->query_var);
+       }
+
+       if ( false !== $args->rewrite && '' != get_option('permalink_structure') ) {
+               if ( !is_array($args->rewrite) )
+                       $args->rewrite = array();
+               if ( !isset($args->rewrite['slug']) )
+                       $args->rewrite['slug'] = $post_type;
+               if ( !isset($args->rewrite['with_front']) )
+                       $args->rewrite['with_front'] = true;
+               if ( $args->hierarchical )
+                       $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
+               else
+                       $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
+               $wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);
+       }
+
+       if ( $args->register_meta_box_cb )
+               add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
+
+       $args->labels = get_post_type_labels( $args );
+       $args->label = $args->labels->name;
+
+       $wp_post_types[$post_type] = $args;
+
+       add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 );
+
+       foreach ( $args->taxonomies as $taxonomy ) {
+               register_taxonomy_for_object_type( $taxonomy, $post_type );
+       }
+
+       return $args;
+}
+
+/**
+ * Builds an object with all post type capabilities out of a post type object
+ *
+ * Accepted keys of the capabilities array in the post type object:
+ * - edit_post - The meta capability that controls editing a particular object of this post type. Defaults to "edit_ . $capability_type" (edit_post).
+ * - edit_posts - The capability that controls editing objects of this post type as a class. Defaults to "edit_ . $capability_type . s" (edit_posts).
+ * - edit_others_posts - The capability that controls editing objects of this post type that are owned by other users. Defaults to "edit_others_ . $capability_type . s" (edit_others_posts).
+ * - publish_posts - The capability that controls publishing objects of this post type. Defaults to "publish_ . $capability_type . s" (publish_posts).
+ * - read_post - The meta capability that controls reading a particular object of this post type. Defaults to "read_ . $capability_type" (read_post).
+ * - read_private_posts - The capability that controls reading private posts. Defaults to "read_private . $capability_type . s" (read_private_posts).
+ * - delete_post - The meta capability that controls deleting a particular object of this post type. Defaults to "delete_ . $capability_type" (delete_post).
+ *
+ * @since 3.0.0
+ * @param object $args
+ * @return object object with all the capabilities as member variables
+ */
+function get_post_type_capabilities( $args ) {
+       $defaults = array(
+               'edit_post'          => 'edit_'         . $args->capability_type,
+               'edit_posts'         => 'edit_'         . $args->capability_type . 's',
+               'edit_others_posts'  => 'edit_others_'  . $args->capability_type . 's',
+               'publish_posts'      => 'publish_'      . $args->capability_type . 's',
+               'read_post'          => 'read_'         . $args->capability_type,
+               'read_private_posts' => 'read_private_' . $args->capability_type . 's',
+               'delete_post'        => 'delete_'       . $args->capability_type,
+       );
+       $labels = array_merge( $defaults, $args->capabilities );
+       return (object) $labels;
+}
+
+/**
+ * Builds an object with all post type labels out of a post type object
+ *
+ * Accepted keys of the label array in the post type object:
+ * - name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages
+ * - singular_name - name for one object of this post type. Default is Post/Page
+ * - add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example: <code>_x('Add New', 'product');</code>
+ * - add_new_item - Default is Add New Post/Add New Page
+ * - edit_item - Default is Edit Post/Edit Page
+ * - new_item - Default is New Post/New Page
+ * - view_item - Default is View Post/View Page
+ * - search_items - Default is Search Posts/Search Pages
+ * - not_found - Default is No posts found/No pages found
+ * - not_found_in_trash - Default is No posts found in Trash/No pages found in Trash
+ * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page:
+ *
+ * Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages.)
+ *
+ * @since 3.0.0
+ * @param object $post_type_object
+ * @return object object with all the labels as member variables
+ */
+function get_post_type_labels( $post_type_object ) {
+       $nohier_vs_hier_defaults = array(
+               'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ),
+               'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ),
+               'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ),
+               'add_new_item' => array( __('Add New Post'), __('Add New Page') ),
+               'edit_item' => array( __('Edit Post'), __('Edit Page') ),
+               'new_item' => array( __('New Post'), __('New Page') ),
+               'view_item' => array( __('View Post'), __('View Page') ),
+               'search_items' => array( __('Search Posts'), __('Search Pages') ),
+               'not_found' => array( __('No posts found'), __('No pages found') ),
+               'not_found_in_trash' => array( __('No posts found in Trash'), __('No pages found in Trash') ),
+               'parent_item_colon' => array( null, __('Parent Page:') )
+       );
+       return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
+}
+
+/**
+ * Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object
+ *
+ * @access private
+ */
+function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
+
+       if ( isset( $object->label ) && empty( $object->labels['name'] ) )
+               $object->labels['name'] = $object->label;
+
+       if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) )
+               $object->labels['singular_name'] = $object->labels['name'];
+
+       $defaults = array_map( create_function( '$x', $object->hierarchical? 'return $x[1];' : 'return $x[0];' ), $nohier_vs_hier_defaults );
+       $labels = array_merge( $defaults, $object->labels );
+       return (object)$labels;
+}
+
+/**
+ * Register support of certain features for a post type.
+ *
+ * All features are directly associated with a functional area of the edit screen, such as the
+ * editor or a meta box: 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author',
+ * 'excerpt', 'page-attributes', 'thumbnail', and 'custom-fields'.
+ *
+ * Additionally, the 'revisions' feature dictates whether the post type will store revisions,
+ * and the 'comments' feature dicates whether the comments count will show on the edit screen.
+ *
+ * @since 3.0.0
+ * @param string $post_type The post type for which to add the feature
+ * @param string|array $feature the feature being added, can be an array of feature strings or a single string
+ */
+function add_post_type_support( $post_type, $feature ) {
+       global $_wp_post_type_features;
+
+       $features = (array) $feature;
+       foreach ($features as $feature) {
+               if ( func_num_args() == 2 )
+                       $_wp_post_type_features[$post_type][$feature] = true;
+               else
+                       $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
+       }
+}
+
+/**
+ * Remove support for a feature from a post type.
+ *
+ * @since 3.0.0
+ * @param string $post_type The post type for which to remove the feature
+ * @param string $feature The feature being removed
+ */
+function remove_post_type_support( $post_type, $feature ) {
+       global $_wp_post_type_features;
+
+       if ( !isset($_wp_post_type_features[$post_type]) )
+               return;
+
+       if ( isset($_wp_post_type_features[$post_type][$feature]) )
+               unset($_wp_post_type_features[$post_type][$feature]);
+}
+
+/**
+ * Checks a post type's support for a given feature
+ *
+ * @since 3.0.0
+ * @param string $post_type The post type being checked
+ * @param string $feature the feature being checked
+ * @return boolean
+ */
+
+function post_type_supports( $post_type, $feature ) {
+       global $_wp_post_type_features;
+
+       if ( !isset( $_wp_post_type_features[$post_type][$feature] ) )
+               return false;
+
+       // If no args passed then no extra checks need be performed
+       if ( func_num_args() <= 2 )
+               return true;
+
+       // @todo Allow pluggable arg checking
+       //$args = array_slice( func_get_args(), 2 );
+
+       return true;
 }
 
 /**
@@ -572,8 +1102,8 @@ function get_posts($args = null) {
        $defaults = array(
                'numberposts' => 5, 'offset' => 0,
                'category' => 0, 'orderby' => 'post_date',
-               'order' => 'DESC', 'include' => '',
-               'exclude' => '', 'meta_key' => '',
+               'order' => 'DESC', 'include' => array(),
+               'exclude' => array(), 'meta_key' => '',
                'meta_value' =>'', 'post_type' => 'post',
                'suppress_filters' => true
        );
@@ -586,11 +1116,11 @@ function get_posts($args = null) {
        if ( ! empty($r['category']) )
                $r['cat'] = $r['category'];
        if ( ! empty($r['include']) ) {
-               $incposts = preg_split('/[\s,]+/',$r['include']);
+               $incposts = wp_parse_id_list( $r['include'] );
                $r['posts_per_page'] = count($incposts);  // only the number of posts included
                $r['post__in'] = $incposts;
        } elseif ( ! empty($r['exclude']) )
-               $r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);
+               $r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
 
        $r['caller_get_posts'] = true;
 
@@ -802,7 +1332,7 @@ function get_post_custom_values( $key = '', $post_id = 0 ) {
  * @since 2.7.0
  *
  * @param int $post_id Optional. Post ID.
- * @return bool Whether post is sticky (true) or not sticky (false).
+ * @return bool Whether post is sticky.
  */
 function is_sticky($post_id = null) {
        global $id;
@@ -855,7 +1385,6 @@ function sanitize_post($post, $context = 'display') {
                        $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
                $post['filter'] = $context;
        }
-
        return $post;
 }
 
@@ -891,6 +1420,13 @@ function sanitize_post_field($field, $value, $post_id, $context) {
        if ( in_array($field, $int_fields) )
                $value = (int) $value;
 
+       // Fields which contain arrays of ints.
+       $array_int_fields = array( 'ancestors' );
+       if ( in_array($field, $array_int_fields) ) {
+               $value = array_map( 'absint', $value);
+               return $value;
+       }
+
        if ( 'raw' == $context )
                return $value;
 
@@ -1018,7 +1554,8 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
 
        $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
        if ( 'readable' == $perm && is_user_logged_in() ) {
-               if ( !current_user_can("read_private_{$type}s") ) {
+               $post_type_object = get_post_type_object($type);
+               if ( !current_user_can( $post_type_object->cap->read_private_posts ) ) {
                        $cache_key .= '_' . $perm . '_' . $user->ID;
                        $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))";
                }
@@ -1031,10 +1568,12 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
 
        $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
 
-       $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'trash' => 0 );
-       foreach( (array) $count as $row_num => $row ) {
+       $stats = array();
+       foreach ( get_post_stati() as $state )
+               $stats[$state] = 0;
+
+       foreach ( (array) $count as $row )
                $stats[$row['post_status']] = $row['num_posts'];
-       }
 
        $stats = (object) $stats;
        wp_cache_set($cache_key, $stats, 'counts');
@@ -1115,9 +1654,10 @@ function wp_match_mime_types($wildcard_mime_types, $real_mime_types) {
  * @since 2.5.0
  *
  * @param string|array $mime_types List of mime types or comma separated string of mime types.
+ * @param string $table_alias Optional. Specify a table alias, if needed.
  * @return string The SQL AND clause for mime searching.
  */
-function wp_post_mime_type_where($post_mime_types) {
+function wp_post_mime_type_where($post_mime_types, $table_alias = '') {
        $where = '';
        $wildcards = array('', '%', '%/%');
        if ( is_string($post_mime_types) )
@@ -1145,9 +1685,9 @@ function wp_post_mime_type_where($post_mime_types) {
                        return '';
 
                if ( false !== strpos($mime_pattern, '%') )
-                       $wheres[] = "post_mime_type LIKE '$mime_pattern'";
+                       $wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";
                else
-                       $wheres[] = "post_mime_type = '$mime_pattern'";
+                       $wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";
        }
        if ( !empty($wheres) )
                $where = ' AND (' . join(' OR ', $wheres) . ') ';
@@ -1155,18 +1695,22 @@ function wp_post_mime_type_where($post_mime_types) {
 }
 
 /**
- * Removes a post, attachment, or page.
+ * Trashes or deletes a post or page.
  *
- * When the post and page goes, everything that is tied to it is deleted also.
+ * When the post and page is permanently deleted, everything that is tied to it is deleted also.
  * This includes comments, post meta fields, and terms associated with the post.
  *
+ * The post or page is moved to trash instead of permanently deleted unless trash is
+ * disabled, item is already in the trash, or $force_delete is true.
+ *
  * @since 1.0.0
  * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'.
  * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'.
  * @uses wp_delete_attachment() if post type is 'attachment'.
+ * @uses wp_trash_post() if item should be trashed.
  *
  * @param int $postid Post ID.
- * @param bool $force_delete Whether to bypass trash and force deletion
+ * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
  * @return mixed False on failure
  */
 function wp_delete_post( $postid = 0, $force_delete = false ) {
@@ -1175,7 +1719,7 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
        if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
                return $post;
 
-       if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS > 0 )
+       if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )
                        return wp_trash_post($postid);
 
        if ( $post->post_type == 'attachment' )
@@ -1223,8 +1767,8 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
        $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
        if ( ! empty($comment_ids) ) {
                do_action( 'delete_comment', $comment_ids );
-               $in_comment_ids = "'" . implode("', '", $comment_ids) . "'";
-               $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_ID IN($in_comment_ids)" );
+               foreach ( $comment_ids as $comment_id )
+                       wp_delete_comment( $comment_id, true );
                do_action( 'deleted_comment', $comment_ids );
        }
 
@@ -1251,7 +1795,7 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
                clean_post_cache($postid);
        }
 
-       wp_clear_scheduled_hook('publish_future_post', $postid);
+       wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
 
        do_action('deleted_post', $postid);
 
@@ -1261,16 +1805,19 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
 /**
  * Moves a post or page to the Trash
  *
+ * If trash is disabled, the post or page is permanently deleted.
+ *
  * @since 2.9.0
  * @uses do_action() on 'trash_post' before trashing
  * @uses do_action() on 'trashed_post' after trashing
+ * @uses wp_delete_post() if trash is disabled
  *
  * @param int $postid Post ID.
  * @return mixed False on failure
  */
 function wp_trash_post($post_id = 0) {
-       if ( EMPTY_TRASH_DAYS == 0 )
-               return wp_delete_post($post_id);
+       if ( !EMPTY_TRASH_DAYS )
+               return wp_delete_post($post_id, true);
 
        if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
                return $post;
@@ -1531,13 +2078,20 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
        $post = get_post($postid, $mode);
 
        // Set categories and tags
-       if($mode == OBJECT) {
-               $post->post_category = wp_get_post_categories($postid);
-               $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names'));
-       }
-       else {
-               $post['post_category'] = wp_get_post_categories($postid);
-               $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names'));
+       if ( $mode == OBJECT ) {
+               $post->post_category = array();
+               if ( is_object_in_taxonomy($post->post_type, 'category') )
+                       $post->post_category = wp_get_post_categories($postid);
+               $post->tags_input = array();
+               if ( is_object_in_taxonomy($post->post_type, 'post_tag') )
+                       $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names'));
+       } else {
+               $post['post_category'] = array();
+               if ( is_object_in_taxonomy($post['post_type'], 'category') )
+                       $post['post_category'] = wp_get_post_categories($postid);
+               $post['tags_input'] = array();
+               if ( is_object_in_taxonomy($post['post_type'], 'post_tag') )
+                       $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names'));
        }
 
        return $post;
@@ -1592,7 +2146,8 @@ 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' => '',
-               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0);
+               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0,
+               'post_content' => '', 'post_title' => '');
 
        $postarr = wp_parse_args($postarr, $defaults);
        $postarr = sanitize_post($postarr, 'db');
@@ -1616,30 +2171,34 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                        return 0;
        }
 
-       // Make sure we set a valid category
+       if ( empty($post_type) )
+               $post_type = 'post';
+
+       if ( empty($post_status) )
+               $post_status = 'draft';
+
+       if ( !empty($post_category) )
+               $post_category = array_filter($post_category); // Filter out empty terms
+
+       // Make sure we set a valid category.
        if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
-               $post_category = array(get_option('default_category'));
+               // 'post' requires at least one category.
+               if ( 'post' == $post_type && 'auto-draft' != $post_status )
+                       $post_category = array( get_option('default_category') );
+               else
+                       $post_category = array();
        }
 
-       //Set the default tag list
-       if ( !isset($tags_input) )
-               $tags_input = array();
-
        if ( empty($post_author) )
                $post_author = $user_ID;
 
-       if ( empty($post_status) )
-               $post_status = 'draft';
-
-       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 );
+               $post_before = get_post($post_ID);
        }
 
        // Don't allow contributors to set to set the post slug for pending review posts
@@ -1648,8 +2207,8 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        // Create a valid post name.  Drafts and pending posts are allowed to have an empty
        // post name.
-       if ( !isset($post_name) || empty($post_name) ) {
-               if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
+       if ( empty($post_name) ) {
+               if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
                        $post_name = sanitize_title($post_title);
                else
                        $post_name = '';
@@ -1662,7 +2221,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                $post_date = current_time('mysql');
 
        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', 'auto-draft' ) ) )
                        $post_date_gmt = get_gmt_from_date($post_date);
                else
                        $post_date_gmt = '0000-00-00 00:00:00';
@@ -1680,6 +2239,10 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                $now = gmdate('Y-m-d H:i:59');
                if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) )
                        $post_status = 'future';
+       } elseif( 'future' == $post_status ) {
+               $now = gmdate('Y-m-d H:i:59');
+               if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) )
+                       $post_status = 'publish';
        }
 
        if ( empty($comment_status) ) {
@@ -1711,7 +2274,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                } elseif ( !empty($post_parent) ) {
                        $parent_post = get_post($post_parent);
                        // Check for circular dependency
-                       if ( $parent_post->post_parent == $post_ID )
+                       if ( isset( $parent_post->post_parent ) && $parent_post->post_parent == $post_ID )
                                $post_parent = 0;
                }
        }
@@ -1732,7 +2295,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        $data = stripslashes_deep( $data );
        $where = array( 'ID' => $post_ID );
 
-       if ($update) {
+       if ( $update ) {
                do_action( 'pre_post_update', $post_ID );
                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
                        if ( $wp_error )
@@ -1762,19 +2325,25 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                $where = array( 'ID' => $post_ID );
        }
 
-       if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending' ) ) ) {
+       if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
                $data['post_name'] = sanitize_title($data['post_title'], $post_ID);
                $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
        }
 
-       wp_set_post_categories( $post_ID, $post_category );
-       // old-style tags_input
-       if ( !empty($tags_input) )
+       if ( is_object_in_taxonomy($post_type, 'category') )
+               wp_set_post_categories( $post_ID, $post_category );
+
+       if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )
                wp_set_post_tags( $post_ID, $tags_input );
-       // new-style support for all tag-like taxonomies
+
+       // new-style support for all custom taxonomies
        if ( !empty($tax_input) ) {
                foreach ( $tax_input as $taxonomy => $tags ) {
-                       wp_set_post_terms( $post_ID, $tags, $taxonomy );
+                       $taxonomy_obj = get_taxonomy($taxonomy);
+                       if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical.
+                               $tags = array_filter($tags);
+                       if ( current_user_can($taxonomy_obj->cap->assign_terms) )
+                               wp_set_post_terms( $post_ID, $tags, $taxonomy );
                }
        }
 
@@ -1805,8 +2374,11 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        wp_transition_post_status($data['post_status'], $previous_status, $post);
 
-       if ( $update)
+       if ( $update ) {
                do_action('edit_post', $post_ID, $post);
+               $post_after = get_post($post_ID);
+               do_action( 'post_updated', $post_ID, $post_after, $post_before);
+       }
 
        do_action('save_post', $post_ID, $post);
        do_action('wp_insert_post', $post_ID, $post);
@@ -1846,7 +2418,7 @@ 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
-       if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) &&
+       if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
                         ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
                $clear_date = true;
        else
@@ -1895,7 +2467,7 @@ function wp_publish_post($post_id) {
 
        // Update counts for the post's terms.
        foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
-               $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
+               $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids'));
                wp_update_term_count($tt_ids, $taxonomy);
        }
 
@@ -1928,7 +2500,7 @@ function check_and_publish_future_post($post_id) {
        $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_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system
                wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
                return;
        }
@@ -1938,10 +2510,10 @@ function check_and_publish_future_post($post_id) {
 
 
 /**
- * Given the desired slug and some post details computes a unique slug for the post.
+ * Computes a unique slug for the post, when given the desired slug and some post details.
  *
- * @global wpdb $wpdb 
- * @global WP_Rewrite $wp_rewrite 
+ * @global wpdb $wpdb
+ * @global WP_Rewrite $wp_rewrite
  * @param string $slug the desired slug (post_name)
  * @param integer $post_ID
  * @param string $post_status no uniqueness checks are made if the post is still draft or pending
@@ -1949,58 +2521,58 @@ function check_and_publish_future_post($post_id) {
  * @param integer $post_parent
  * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
  */
-function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
-       if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
+function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
+       if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
                return $slug;
 
        global $wpdb, $wp_rewrite;
 
        $feeds = $wp_rewrite->feeds;
-       if ( !is_array($feeds) )
+       if ( ! is_array( $feeds ) )
                $feeds = array();
 
-       $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
+       $hierarchical_post_types = apply_filters( 'hierarchical_post_types', array( 'page' ) );
        if ( 'attachment' == $post_type ) {
                // Attachment slugs must be unique across all types.
                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
-               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
+               $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
 
-               if ( $post_name_check || in_array($slug, $feeds) ) {
+               if ( $post_name_check || in_array( $slug, $feeds ) ) {
                        $suffix = 2;
                        do {
-                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
-                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID));
+                               $alt_post_name = substr ($slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
+                               $post_name_check = $wpdb->get_var( $wpdb->prepare($check_sql, $alt_post_name, $post_ID ) );
                                $suffix++;
-                       } while ($post_name_check);
+                       } while ( $post_name_check );
                        $slug = $alt_post_name;
                }
-       } elseif ( in_array($post_type, $hierarchical_post_types) ) {
-               // Page slugs must be unique within their own trees.  Pages are in a
-               // separate namespace than posts so page slugs are allowed to overlap post slugs.
-               $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", esc_sql($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
-               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
+       } elseif ( in_array( $post_type, $hierarchical_post_types ) ) {
+               // Page slugs must be unique within their own trees. Pages are in a separate
+               // namespace than posts so page slugs are allowed to overlap post slugs.
+               $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
+               $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
 
-               if ( $post_name_check || in_array($slug, $feeds) ) {
+               if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( '@^(page)?\d+$@', $slug ) ) {
                        $suffix = 2;
                        do {
-                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
-                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID, $post_parent));
+                               $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
+                               $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID, $post_parent ) );
                                $suffix++;
-                       } while ($post_name_check);
+                       } while ( $post_name_check );
                        $slug = $alt_post_name;
                }
        } else {
                // Post slugs must be unique across all posts.
                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
-               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
+               $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
 
-               if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
+               if ( $post_name_check || in_array( $slug, $feeds ) ) {
                        $suffix = 2;
                        do {
-                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
-                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID));
+                               $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
+                               $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
                                $suffix++;
-                       } while ($post_name_check);
+                       } while ( $post_name_check );
                        $slug = $alt_post_name;
                }
        }
@@ -2062,6 +2634,14 @@ function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $a
                $tags = array();
 
        $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
+
+       // Hierarchical taxonomies must always pass IDs rather than names so that children with the same
+       // names but different parents aren't confused.
+       if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+               $tags = array_map( 'intval', $tags );
+               $tags = array_unique( $tags );
+       }
+
        wp_set_object_terms($post_id, $tags, $taxonomy, $append);
 }
 
@@ -2079,14 +2659,22 @@ function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $a
  */
 function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
        $post_ID = (int) $post_ID;
+       $post_type = get_post_type( $post_ID );
+       $post_status = get_post_status( $post_ID );
        // If $post_categories isn't already an array, make it one:
-       if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories))
-               $post_categories = array(get_option('default_category'));
-       else if ( 1 == count($post_categories) && '' == $post_categories[0] )
+       if ( !is_array($post_categories) || empty($post_categories) ) {
+               if ( 'post' == $post_type && 'auto-draft' != $post_status )
+                       $post_categories = array( get_option('default_category') );
+               else
+                       $post_categories = array();
+       } else if ( 1 == count($post_categories) && '' == reset($post_categories) ) {
                return true;
+       }
 
-       $post_categories = array_map('intval', $post_categories);
-       $post_categories = array_unique($post_categories);
+       if ( !empty($post_categories) ) {
+               $post_categories = array_map('intval', $post_categories);
+               $post_categories = array_unique($post_categories);
+       }
 
        return wp_set_object_terms($post_ID, $post_categories, 'category');
 }
@@ -2278,17 +2866,8 @@ function get_all_page_ids() {
  * @return mixed Page data.
  */
 function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
-       if ( empty($page) ) {
-               if ( isset( $GLOBALS['post'] ) && isset( $GLOBALS['post']->ID ) ) {
-                       return get_post($GLOBALS['post'], $output, $filter);
-               } else {
-                       $page = null;
-                       return $page;
-               }
-       }
-
-       $the_page = get_post($page, $output, $filter);
-       return $the_page;
+       $p = get_post($page, $output, $filter);
+       return $p;
 }
 
 /**
@@ -2298,10 +2877,11 @@ function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
  * @uses $wpdb
  *
  * @param string $page_path Page path
- * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT.
+ * @param string $post_type Optional. Post type. Default page.
  * @return mixed Null when complete.
  */
-function get_page_by_path($page_path, $output = OBJECT) {
+function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
        global $wpdb;
        $page_path = rawurlencode(urldecode($page_path));
        $page_path = str_replace('%2F', '/', $page_path);
@@ -2310,24 +2890,24 @@ function get_page_by_path($page_path, $output = OBJECT) {
        $leaf_path  = sanitize_title(basename($page_paths));
        $page_paths = explode('/', $page_paths);
        $full_path = '';
-       foreach( (array) $page_paths as $pathdir)
-               $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
+       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 ));
+       $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type ));
 
        if ( empty($pages) )
                return null;
 
-       foreach ($pages as $page) {
+       foreach ( $pages as $page ) {
                $path = '/' . $leaf_path;
                $curpage = $page;
-               while ($curpage->post_parent != 0) {
-                       $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type='page'", $curpage->post_parent ));
+               while ( $curpage->post_parent != 0 ) {
+                       $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type = %s", $curpage->post_parent, $post_type ));
                        $path = '/' . $curpage->post_name . $path;
                }
 
                if ( $path == $full_path )
-                       return get_page($page->ID, $output);
+                       return get_page($page->ID, $output, $post_type);
        }
 
        return null;
@@ -2340,12 +2920,13 @@ function get_page_by_path($page_path, $output = OBJECT) {
  * @uses $wpdb
  *
  * @param string $page_title Page title
- * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT.
+ * @param string $post_type Optional. Post type. Default page.
  * @return mixed
  */
-function get_page_by_title($page_title, $output = OBJECT) {
+function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ) {
        global $wpdb;
-       $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='page'", $page_title ));
+       $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) );
        if ( $page )
                return get_page($page, $output);
 
@@ -2392,8 +2973,8 @@ function &get_page_children($page_id, $pages) {
 function &get_page_hierarchy( &$pages, $page_id = 0 ) {
 
        if ( empty( $pages ) ) {
-               $return = array();
-               return $return;
+               $result = array();
+               return $result;
        }
 
        $children = array();
@@ -2433,11 +3014,12 @@ function _page_traverse_name( $page_id, &$children, &$result ){
  *
  * @since 1.5.0
  *
- * @param int $page_id Page ID.
+ * @param mixed $page Page object or page ID.
  * @return string Page URI.
  */
-function get_page_uri($page_id) {
-       $page = get_page($page_id);
+function get_page_uri($page) {
+       if ( ! is_object($page) )
+               $page = get_page($page);
        $uri = $page->post_name;
 
        // A page cannot be it's own parent.
@@ -2471,10 +3053,11 @@ function &get_pages($args = '') {
        $defaults = array(
                'child_of' => 0, 'sort_order' => 'ASC',
                'sort_column' => 'post_title', 'hierarchical' => 1,
-               'exclude' => '', 'include' => '',
+               'exclude' => array(), 'include' => array(),
                'meta_key' => '', 'meta_value' => '',
                'authors' => '', 'parent' => -1, 'exclude_tree' => '',
-               'number' => '', 'offset' => 0
+               'number' => '', 'offset' => 0,
+               'post_type' => 'page', 'post_status' => 'publish',
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -2482,6 +3065,15 @@ function &get_pages($args = '') {
        $number = (int) $number;
        $offset = (int) $offset;
 
+       // Make sure the post type is hierarchical
+       $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
+       if ( !in_array( $post_type, $hierarchical_post_types ) )
+               return false;
+
+       // Make sure we have a valid post status
+       if ( !in_array($post_status, get_post_stati()) )
+               return false;
+
        $cache = array();
        $key = md5( serialize( compact(array_keys($defaults)) ) );
        if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
@@ -2502,8 +3094,8 @@ function &get_pages($args = '') {
                $meta_key = '';
                $meta_value = '';
                $hierarchical = false;
-               $incpages = preg_split('/[\s,]+/',$include);
-               if ( count($incpages) ) {
+               $incpages = wp_parse_id_list( $include );
+               if ( ! empty( $incpages ) ) {
                        foreach ( $incpages as $incpage ) {
                                if (empty($inclusions))
                                        $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage);
@@ -2517,8 +3109,8 @@ function &get_pages($args = '') {
 
        $exclusions = '';
        if ( !empty($exclude) ) {
-               $expages = preg_split('/[\s,]+/',$exclude);
-               if ( count($expages) ) {
+               $expages = wp_parse_id_list( $exclude );
+               if ( ! empty( $expages ) ) {
                        foreach ( $expages as $expage ) {
                                if (empty($exclusions))
                                        $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage);
@@ -2534,7 +3126,7 @@ function &get_pages($args = '') {
        if (!empty($authors)) {
                $post_authors = preg_split('/[\s,]+/',$authors);
 
-               if ( count($post_authors) ) {
+               if ( ! empty( $post_authors ) ) {
                        foreach ( $post_authors as $post_author ) {
                                //Do we have an author id or an author login?
                                if ( 0 == intval($post_author) ) {
@@ -2574,7 +3166,9 @@ function &get_pages($args = '') {
        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 ";
+       $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
+
+       $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
@@ -2635,9 +3229,9 @@ function &get_pages($args = '') {
  * @return bool True on success, false on failure.
  */
 function is_local_attachment($url) {
-       if (strpos($url, get_bloginfo('url')) === false)
+       if (strpos($url, home_url()) === false)
                return false;
-       if (strpos($url, get_bloginfo('url') . '/?attachment_id=') !== false)
+       if (strpos($url, home_url('/?attachment_id=')) !== false)
                return true;
        if ( $id = url_to_postid($url) ) {
                $post = & get_post($id);
@@ -2705,17 +3299,21 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
        // export array as variables
        extract($object, EXTR_SKIP);
 
-       // Make sure we set a valid category
-       if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
-               $post_category = array(get_option('default_category'));
-       }
-
        if ( empty($post_author) )
                $post_author = $user_ID;
 
        $post_type = 'attachment';
        $post_status = 'inherit';
 
+       // Make sure we set a valid category.
+       if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
+               // 'post' requires at least one category.
+               if ( 'post' == $post_type )
+                       $post_category = array( get_option('default_category') );
+               else
+                       $post_category = array();
+       }
+
        // Are we updating or creating?
        if ( !empty($ID) ) {
                $update = true;
@@ -2818,18 +3416,21 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
 }
 
 /**
- * Delete an attachment.
+ * Trashes or deletes an attachment.
+ *
+ * When an attachment is permanently deleted, the file will also be removed.
+ * Deletion removes all post meta fields, taxonomy, comments, etc. associated
+ * with the attachment (except the main post).
  *
- * 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).
+ * The attachment is moved to the trash instead of permanently deleted unless trash
+ * for media is disabled, item is already in the trash, or $force_delete is true.
  *
  * @since 2.0.0
  * @uses $wpdb
  * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
  *
  * @param int $postid Attachment ID.
- * @param bool $force_delete Whether to bypass trash and force deletion
+ * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
  * @return mixed False on failure. Post data on success.
  */
 function wp_delete_attachment( $post_id, $force_delete = false ) {
@@ -2851,6 +3452,9 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
        $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
        $file = get_attached_file( $post_id );
 
+       if ( is_multisite() )
+               delete_transient( 'dirsize_cache' );
+
        do_action('delete_attachment', $post_id);
 
        wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
@@ -2859,10 +3463,10 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id ));
 
        $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
-       if ( ! empty($comment_ids) ) {
+       if ( ! empty( $comment_ids ) ) {
                do_action( 'delete_comment', $comment_ids );
-               $in_comment_ids = "'" . implode("', '", $comment_ids) . "'";
-               $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_ID IN($in_comment_ids)" );
+               foreach ( $comment_ids as $comment_id )
+                       wp_delete_comment( $comment_id, true );
                do_action( 'deleted_comment', $comment_ids );
        }
 
@@ -2890,8 +3494,7 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
        }
 
        // remove intermediate and backup images if there are any
-       $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));
-       foreach ( $sizes as $size ) {
+       foreach ( get_intermediate_image_sizes() as $size ) {
                if ( $intermediate = image_get_intermediate_size($post_id, $size) ) {
                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
                        @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
@@ -2925,7 +3528,7 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
  * @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 ) {
+function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
        $post_id = (int) $post_id;
        if ( !$post =& get_post( $post_id ) )
                return false;
@@ -2975,10 +3578,10 @@ function wp_get_attachment_url( $post_id = 0 ) {
                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.
+            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.
                }
        }
 
@@ -3170,31 +3773,24 @@ function wp_mime_type_icon( $mime = 0 ) {
  * @param int $post_id Post ID.
  * @return int Same as $post_id
  */
-function wp_check_for_changed_slugs($post_id) {
-       if ( !isset($_POST['wp-old-slug']) || !strlen($_POST['wp-old-slug']) )
-               return $post_id;
-
-       $post = &get_post($post_id);
+function wp_check_for_changed_slugs($post_id, $post, $post_before) {
+       // dont bother if it hasnt changed
+       if ( $post->post_name == $post_before->post_name )
+               return;
 
        // we're only concerned with published posts
        if ( $post->post_status != 'publish' || $post->post_type != 'post' )
-               return $post_id;
-
-       // only bother if the slug has changed
-       if ( $post->post_name == $_POST['wp-old-slug'] )
-               return $post_id;
+               return;
 
        $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');
 
        // if we haven't added this old slug before, add it now
-       if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) )
-               add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']);
+       if ( !in_array($post_before->post_name, $old_slugs) )
+               add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);
 
        // if the new slug was used previously, delete it from the list
        if ( in_array($post->post_name, $old_slugs) )
                delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
-
-       return $post_id;
 }
 
 /**
@@ -3218,8 +3814,22 @@ function wp_check_for_changed_slugs($post_id) {
  * @return string SQL code that can be added to a where clause.
  */
 function get_private_posts_cap_sql($post_type) {
-       global $user_ID;
-       $cap = '';
+       return get_posts_by_author_sql($post_type, FALSE);
+}
+
+/**
+ * Retrieve the post SQL based on capability, author, and type.
+ *
+ * See above for full description.
+ *
+ * @since 3.0.0
+ * @param string $post_type currently only supports 'post' or 'page'.
+ * @param bool $full Optional.  Returns a full WHERE statement instead of just an 'andalso' term.
+ * @param int $post_author Optional.  Query posts having a single author ID.
+ * @return string SQL WHERE code that can be added to a query.
+ */
+function get_posts_by_author_sql($post_type, $full = TRUE, $post_author = NULL) {
+       global $user_ID, $wpdb;
 
        // Private posts
        if ($post_type == 'post') {
@@ -3229,24 +3839,40 @@ function get_private_posts_cap_sql($post_type) {
                $cap = 'read_private_pages';
        // Dunno what it is, maybe plugins have their own post type?
        } else {
+               $cap = '';
                $cap = apply_filters('pub_priv_sql_capability', $cap);
 
                if (empty($cap)) {
                        // We don't know what it is, filters don't change anything,
                        // so set the SQL up to return nothing.
-                       return '1 = 0';
+                       return ' 1 = 0 ';
+               }
+       }
+
+       if ($full) {
+               if (is_null($post_author)) {
+                       $sql = $wpdb->prepare('WHERE post_type = %s AND ', $post_type);
+               } else {
+                       $sql = $wpdb->prepare('WHERE post_author = %d AND post_type = %s AND ', $post_author, $post_type);
                }
+       } else {
+               $sql = '';
        }
 
-       $sql = '(post_status = \'publish\'';
+       $sql .= "(post_status = 'publish'";
 
        if (current_user_can($cap)) {
                // Does the user have the capability to view private posts? Guess so.
-               $sql .= ' OR post_status = \'private\'';
+               $sql .= " OR post_status = 'private'";
        } elseif (is_user_logged_in()) {
                // Users can view their own private posts.
-               $sql .= ' OR post_status = \'private\' AND post_author = \'' . $user_ID . '\'';
-       }
+               $id = (int) $user_ID;
+               if (is_null($post_author) || !$full) {
+                       $sql .= " OR post_status = 'private' AND post_author = $id";
+               } elseif ($id == (int)$post_author) {
+                       $sql .= " OR post_status = 'private'";
+               } // else none
+       } // else none
 
        $sql .= ')';
 
@@ -3254,7 +3880,7 @@ function get_private_posts_cap_sql($post_type) {
 }
 
 /**
- * Retrieve the date the the last post was published.
+ * Retrieve the date that the last post was published.
  *
  * 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
@@ -3306,34 +3932,38 @@ function get_lastpostdate($timezone = 'server') {
  * @uses $blog_id
  * @uses apply_filters() Calls 'get_lastpostmodified' filter
  *
- * @global mixed $cache_lastpostmodified Stores the date the last post was 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.
  */
 function get_lastpostmodified($timezone = 'server') {
-       global $cache_lastpostmodified, $wpdb, $blog_id;
+       global $wpdb;
+
        $add_seconds_server = date('Z');
-       if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
-               switch(strtolower($timezone)) {
-                       case 'gmt':
-                               $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
-                               break;
-                       case 'blog':
-                               $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
-                               break;
-                       case 'server':
-                               $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
-                               break;
-               }
-               $lastpostdate = get_lastpostdate($timezone);
-               if ( $lastpostdate > $lastpostmodified ) {
-                       $lastpostmodified = $lastpostdate;
-               }
-               $cache_lastpostmodified[$blog_id][$timezone] = $lastpostmodified;
-       } else {
-               $lastpostmodified = $cache_lastpostmodified[$blog_id][$timezone];
+       $timezone = strtolower( $timezone );
+
+       $lastpostmodified = wp_cache_get( "lastpostmodified:$timezone", 'timeinfo' );
+       if ( $lastpostmodified )
+               return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
+
+       switch ( strtolower($timezone) ) {
+               case 'gmt':
+                       $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+                       break;
+               case 'blog':
+                       $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+                       break;
+               case 'server':
+                       $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+                       break;
        }
+
+       $lastpostdate = get_lastpostdate($timezone);
+       if ( $lastpostdate > $lastpostmodified )
+               $lastpostmodified = $lastpostdate;
+
+       if ( $lastpostmodified )
+               wp_cache_set( "lastpostmodified:$timezone", $lastpostmodified, 'timeinfo' );
+
        return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
 }
 
@@ -3396,6 +4026,9 @@ function clean_post_cache($id) {
                foreach( $children as $cid )
                        clean_post_cache( $cid );
        }
+
+       if ( is_multisite() )
+               wp_cache_delete( $wpdb->blogid . '-' . $id, 'global-posts' );
 }
 
 /**
@@ -3449,8 +4082,11 @@ function clean_page_cache($id) {
  * @uses update_postmeta_cache()
  *
  * @param array $posts Array of Post objects
+ * @param string $post_type The post type of the posts in $posts. Default is 'post'.
+ * @param bool $update_term_cache Whether to update the term cache. Default is true.
+ * @param bool $update_meta_cache Whether to update the meta cache. Default is true.
  */
-function update_post_caches(&$posts) {
+function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) {
        // No point in doing all this work if we didn't match any posts.
        if ( !$posts )
                return;
@@ -3458,13 +4094,17 @@ function update_post_caches(&$posts) {
        update_post_cache($posts);
 
        $post_ids = array();
+       foreach ( $posts as $post )
+               $post_ids[] = $post->ID;
 
-       for ($i = 0; $i < count($posts); $i++)
-               $post_ids[] = $posts[$i]->ID;
+       if ( empty($post_type) )
+               $post_type = 'post';
 
-       update_object_term_cache($post_ids, 'post');
+       if ( !is_array($post_type) && 'any' != $post_type && $update_term_cache )
+               update_object_term_cache($post_ids, $post_type);
 
-       update_postmeta_cache($post_ids);
+       if ( $update_meta_cache )
+               update_postmeta_cache($post_ids);
 }
 
 /**
@@ -3487,6 +4127,41 @@ function update_postmeta_cache($post_ids) {
        return update_meta_cache('post', $post_ids);
 }
 
+/**
+ * Will clean the attachment in the cache.
+ *
+ * Cleaning means delete from the cache. Optionaly will clean the term
+ * object cache associated with the attachment ID.
+ *
+ * This function will not run if $_wp_suspend_cache_invalidation is not empty. See
+ * wp_suspend_cache_invalidation().
+ *
+ * @package WordPress
+ * @subpackage Cache
+ * @since 3.0.0
+ *
+ * @uses do_action() Calls 'clean_attachment_cache' on $id.
+ *
+ * @param int $id The attachment ID in the cache to clean
+ * @param bool $clean_terms optional. Whether to clean terms cache
+ */
+function clean_attachment_cache($id, $clean_terms = false) {
+       global $_wp_suspend_cache_invalidation;
+
+       if ( !empty($_wp_suspend_cache_invalidation) )
+               return;
+
+       $id = (int) $id;
+
+       wp_cache_delete($id, 'posts');
+       wp_cache_delete($id, 'post_meta');
+
+       if ( $clean_terms )
+               clean_object_term_cache($id, 'attachment');
+
+       do_action('clean_attachment_cache', $id);
+}
+
 //
 // Hooks
 //
@@ -3514,8 +4189,15 @@ function _transition_post_status($new_status, $old_status, $post) {
                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
        }
 
+       // If published posts changed clear the lastpostmodified cache
+       if ( 'publish' == $new_status || 'publish' == $old_status) {
+               wp_cache_delete( 'lastpostmodified:server', 'timeinfo' );
+               wp_cache_delete( 'lastpostmodified:gmt',    'timeinfo' );
+               wp_cache_delete( 'lastpostmodified:blog',   'timeinfo' );
+       }
+
        // Always clears the hook in case the post status bounced from future to draft.
-       wp_clear_scheduled_hook('publish_future_post', $post->ID);
+       wp_clear_scheduled_hook('publish_future_post', array( $post->ID ) );
 }
 
 /**
@@ -3526,12 +4208,14 @@ function _transition_post_status($new_status, $old_status, $post) {
  * @since 2.3.0
  * @access private
  *
- * @param int $deprecated Not Used. Can be set to null.
+ * @param int $deprecated Not used. Can be set to null. Never implemented.
+ *   Not marked as deprecated with _deprecated_argument() as it conflicts with
+ *   wp_transition_post_status() and the default filter for _future_post_hook().
  * @param object $post Object type containing the post information
  */
-function _future_post_hook($deprecated = '', $post) {
-       wp_clear_scheduled_hook( 'publish_future_post', $post->ID );
-       wp_schedule_single_event(strtotime($post->post_date_gmt. ' GMT'), 'publish_future_post', array($post->ID));
+function _future_post_hook( $deprecated = '', $post ) {
+       wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
+       wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT') , 'publish_future_post', array( $post->ID ) );
 }
 
 /**
@@ -3711,13 +4395,13 @@ function wp_save_post_revision( $post_id ) {
                return;
 
        // WP_POST_REVISIONS = 0, false
-       if ( !constant('WP_POST_REVISIONS') )
+       if ( ! WP_POST_REVISIONS )
                return;
 
        if ( !$post = get_post( $post_id, ARRAY_A ) )
                return;
 
-       if ( !in_array( $post['post_type'], array( 'post', 'page' ) ) )
+       if ( !post_type_supports($post['post_type'], 'revisions') )
                return;
 
        $return = _wp_put_post_revision( $post );
@@ -3729,7 +4413,7 @@ function wp_save_post_revision( $post_id ) {
        // all revisions and (possibly) one autosave
        $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
 
-       // WP_POST_REVISIONS = (int) (# of autasaves to save)
+       // WP_POST_REVISIONS = (int) (# of autosaves to save)
        $delete = count($revisions) - WP_POST_REVISIONS;
 
        if ( $delete < 1 )
@@ -3990,7 +4674,7 @@ function wp_delete_post_revision( $revision_id ) {
  * @return array empty if no revisions
  */
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
-       if ( !constant('WP_POST_REVISIONS') )
+       if ( ! WP_POST_REVISIONS )
                return array();
        if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) )
                return array();
index 92da5a4f03457d4abde5ee8e1318573484776308..cf3cc1e29b38bc447118e4983446227956831c39 100644 (file)
@@ -45,7 +45,7 @@ function set_query_var($var, $value) {
 }
 
 /**
- * Setup The Loop with query parameters.
+ * Set up 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.
@@ -63,11 +63,11 @@ function &query_posts($query) {
 }
 
 /**
- * Destroy the previous query and setup a new query.
+ * Destroy the previous query and set up 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.
+ * wp_query object is not destroyed properly before another is set up.
  *
  * @since 2.3.0
  * @uses $wp_query
@@ -75,6 +75,17 @@ function &query_posts($query) {
 function wp_reset_query() {
        unset($GLOBALS['wp_query']);
        $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
+       wp_reset_postdata();
+}
+
+/**
+ * After looping through a separate query, this function restores
+ * the $post global to the current post in the main query
+ *
+ * @since 3.0.0
+ * @uses $wp_query
+ */
+function wp_reset_postdata() {
        global $wp_query;
        if ( !empty($wp_query->post) ) {
                $GLOBALS['post'] = $wp_query->post;
@@ -94,7 +105,7 @@ function wp_reset_query() {
  *
  * @return bool True if page is archive.
  */
-function is_archive () {
+function is_archive() {
        global $wp_query;
 
        return $wp_query->is_archive;
@@ -108,7 +119,7 @@ function is_archive () {
  *
  * @return bool True if page is attachment.
  */
-function is_attachment () {
+function is_attachment() {
        global $wp_query;
 
        return $wp_query->is_attachment;
@@ -134,7 +145,7 @@ function is_attachment () {
  * @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 = '') {
+function is_author($author = '') {
        global $wp_query;
 
        if ( !$wp_query->is_author )
@@ -169,7 +180,7 @@ function is_author ($author = '') {
  * @param string|array $category Optional.
  * @return bool
  */
-function is_category ($category = '') {
+function is_category($category = '') {
        global $wp_query;
 
        if ( !$wp_query->is_category )
@@ -221,24 +232,43 @@ function is_tag( $slug = '' ) {
 }
 
 /**
- * Whether the current page query has the given taxonomy slug or contains taxonomy.
+ * Whether the current query is for the given taxonomy and/or term.
+ *
+ * If no taxonomy argument is set, returns true if any taxonomy is queried.
+ * If the taxonomy argument is passed but no term argument, returns true
+ *    if the taxonomy or taxonomies in the argument are being queried.
+ * If both taxonomy and term arguments are passed, returns true
+ *    if the current query is for a term contained in the terms argument
+ *    which has a taxonomy contained in the taxonomy argument.
  *
  * @since 2.5.0
  * @uses $wp_query
  *
- * @param string|array $slug Optional. Slug or slugs to check in current query.
+ * @param string|array $taxonomy Optional. Taxonomy slug or slugs to check in current query.
+ * @param int|array|string $term. Optional. A single or array of, The term's ID, Name or Slug
  * @return bool
  */
-function is_tax( $slug = '' ) {
-       global $wp_query;
+function is_tax( $taxonomy = '', $term = '' ) {
+       global $wp_query, $wp_taxonomies;
+
+       $queried_object = $wp_query->get_queried_object();
+       $tax_array = array_intersect(array_keys($wp_taxonomies), (array) $taxonomy);
+       $term_array = (array) $term;
 
        if ( !$wp_query->is_tax )
                return false;
 
-       if ( empty($slug) )
+       if ( empty( $taxonomy ) )
                return true;
 
-       return in_array( get_query_var('taxonomy'), (array) $slug );
+       if ( empty( $term ) ) // Only a Taxonomy provided
+               return isset($queried_object->taxonomy) && count( $tax_array ) && in_array($queried_object->taxonomy, $tax_array);
+
+       return isset($queried_object->term_id) &&
+                       count(array_intersect(
+                               array($queried_object->term_id, $queried_object->name, $queried_object->slug),
+                               $term_array
+                       ));
 }
 
 /**
@@ -249,7 +279,7 @@ function is_tax( $slug = '' ) {
  *
  * @return bool
  */
-function is_comments_popup () {
+function is_comments_popup() {
        global $wp_query;
 
        return $wp_query->is_comments_popup;
@@ -263,7 +293,7 @@ function is_comments_popup () {
  *
  * @return bool
  */
-function is_date () {
+function is_date() {
        global $wp_query;
 
        return $wp_query->is_date;
@@ -277,7 +307,7 @@ function is_date () {
  *
  * @return bool
  */
-function is_day () {
+function is_day() {
        global $wp_query;
 
        return $wp_query->is_day;
@@ -291,12 +321,26 @@ function is_day () {
  *
  * @return bool
  */
-function is_feed () {
+function is_feed() {
        global $wp_query;
 
        return $wp_query->is_feed;
 }
 
+/**
+ * Whether current page query is comment feed URL.
+ *
+ * @since 3.0.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
+function is_comment_feed() {
+       global $wp_query;
+
+       return $wp_query->is_comment_feed;
+}
+
 /**
  * Whether current page query is the front of the site.
  *
@@ -306,7 +350,7 @@ function is_feed () {
  *
  * @return bool True, if front of site.
  */
-function is_front_page () {
+function is_front_page() {
        // most likely case
        if ( 'posts' == get_option('show_on_front') && is_home() )
                return true;
@@ -319,12 +363,16 @@ function is_front_page () {
 /**
  * Whether current page view is the blog homepage.
  *
+ * This is the page which is showing the time based blog content of your site
+ * so if you set a static page for the front page of your site then this will
+ * only be true on the page which you set as the "Posts page" in Reading Settings.
+ *
  * @since 1.5.0
  * @uses $wp_query
  *
  * @return bool True if blog view homepage.
  */
-function is_home () {
+function is_home() {
        global $wp_query;
 
        return $wp_query->is_home;
@@ -338,7 +386,7 @@ function is_home () {
  *
  * @return bool
  */
-function is_month () {
+function is_month() {
        global $wp_query;
 
        return $wp_query->is_month;
@@ -361,7 +409,7 @@ function is_month () {
  * @param mixed $page Either page or list of pages to test against.
  * @return bool
  */
-function is_page ($page = '') {
+function is_page($page = '') {
        global $wp_query;
 
        if ( !$wp_query->is_page )
@@ -392,7 +440,7 @@ function is_page ($page = '') {
  *
  * @return bool
  */
-function is_paged () {
+function is_paged() {
        global $wp_query;
 
        return $wp_query->is_paged;
@@ -454,7 +502,7 @@ function is_robots() {
  *
  * @return bool
  */
-function is_search () {
+function is_search() {
        global $wp_query;
 
        return $wp_query->is_search;
@@ -475,13 +523,13 @@ function is_search () {
  * @param mixed $post Either post or list of posts to test against.
  * @return bool
  */
-function is_single ($post = '') {
+function is_single($post = '') {
        global $wp_query;
 
        if ( !$wp_query->is_single )
                return false;
 
-       if ( empty( $post) )
+       if ( empty($post) )
                return true;
 
        $post_obj = $wp_query->get_queried_object();
@@ -504,12 +552,18 @@ function is_single ($post = '') {
  * @since 1.5.0
  * @uses $wp_query
  *
+ * @param string|array $post_types Optional. Post type or types to check in current query.
  * @return bool
  */
-function is_singular() {
+function is_singular($post_types = '') {
        global $wp_query;
 
-       return $wp_query->is_singular;
+       if ( empty($post_types) || !$wp_query->is_singular )
+               return $wp_query->is_singular;
+
+       $post_obj = $wp_query->get_queried_object();
+
+       return in_array($post_obj->post_type, (array) $post_types);
 }
 
 /**
@@ -520,7 +574,7 @@ function is_singular() {
  *
  * @return bool
  */
-function is_time () {
+function is_time() {
        global $wp_query;
 
        return $wp_query->is_time;
@@ -534,7 +588,7 @@ function is_time () {
  *
  * @return bool
  */
-function is_trackback () {
+function is_trackback() {
        global $wp_query;
 
        return $wp_query->is_trackback;
@@ -548,7 +602,7 @@ function is_trackback () {
  *
  * @return bool
  */
-function is_year () {
+function is_year() {
        global $wp_query;
 
        return $wp_query->is_year;
@@ -562,7 +616,7 @@ function is_year () {
  *
  * @return bool True, if nothing is found matching WordPress Query.
  */
-function is_404 () {
+function is_404() {
        global $wp_query;
 
        return $wp_query->is_404;
@@ -1097,7 +1151,7 @@ class WP_Query {
         * @since 1.5.0
         * @access public
         */
-       function init () {
+       function init() {
                unset($this->posts);
                unset($this->query);
                $this->query_vars = array();
@@ -1140,7 +1194,6 @@ class WP_Query {
                        , 'attachment'
                        , 'attachment_id'
                        , 'name'
-                       , 'hour'
                        , 'static'
                        , 'pagename'
                        , 'page_id'
@@ -1163,9 +1216,11 @@ class WP_Query {
                        , 'meta_key'
                        , 'meta_value'
                        , 'preview'
+                       , 's'
+                       , 'sentence'
                );
 
-               foreach ($keys as $key) {
+               foreach ( $keys as $key ) {
                        if ( !isset($array[$key]))
                                $array[$key] = '';
                }
@@ -1188,7 +1243,7 @@ class WP_Query {
         *
         * @param string|array $query
         */
-       function parse_query ($query) {
+       function parse_query($query) {
                if ( !empty($query) || !isset($this->query) ) {
                        $this->init();
                        if ( is_array($query) )
@@ -1262,21 +1317,21 @@ class WP_Query {
                        }
 
                        if ( $qv['day'] ) {
-                               if (! $this->is_date) {
+                               if ( ! $this->is_date ) {
                                        $this->is_day = true;
                                        $this->is_date = true;
                                }
                        }
 
                        if ( $qv['monthnum'] ) {
-                               if (! $this->is_date) {
+                               if ( ! $this->is_date ) {
                                        $this->is_month = true;
                                        $this->is_date = true;
                                }
                        }
 
                        if ( $qv['year'] ) {
-                               if (! $this->is_date) {
+                               if ( ! $this->is_date ) {
                                        $this->is_year = true;
                                        $this->is_date = true;
                                }
@@ -1284,25 +1339,25 @@ class WP_Query {
 
                        if ( $qv['m'] ) {
                                $this->is_date = true;
-                               if (strlen($qv['m']) > 9) {
+                               if ( strlen($qv['m']) > 9 ) {
                                        $this->is_time = true;
-                               } else if (strlen($qv['m']) > 7) {
+                               } else if ( strlen($qv['m']) > 7 ) {
                                        $this->is_day = true;
-                               } else if (strlen($qv['m']) > 5) {
+                               } else if ( strlen($qv['m']) > 5 ) {
                                        $this->is_month = true;
                                } else {
                                        $this->is_year = true;
                                }
                        }
 
-                       if ('' != $qv['w']) {
+                       if ( '' != $qv['w'] ) {
                                $this->is_date = true;
                        }
 
                        if ( empty($qv['cat']) || ($qv['cat'] == '0') ) {
                                $this->is_category = false;
                        } else {
-                               if (strpos($qv['cat'], '-') !== false) {
+                               if ( strpos($qv['cat'], '-') !== false ) {
                                        $this->is_category = false;
                                } else {
                                        $this->is_category = true;
@@ -1415,7 +1470,7 @@ class WP_Query {
                        $this->is_comments_popup = true;
 
                // if we're previewing inside the write screen
-               if ('' != $qv['preview'])
+               if ( '' != $qv['preview'] )
                        $this->is_preview = true;
 
                if ( is_admin() )
@@ -1435,10 +1490,18 @@ class WP_Query {
                        $this->is_home = true;
 
                // Correct is_* for page_on_front and page_for_posts
-               if ( $this->is_home && ( empty($this->query) || $qv['preview'] == 'true' ) && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
-                       $this->is_page = true;
-                       $this->is_home = false;
-                       $qv['page_id'] = get_option('page_on_front');
+               if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
+                       $_query = wp_parse_args($query);
+                       if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
+                               $this->is_page = true;
+                               $this->is_home = false;
+                               $qv['page_id'] = get_option('page_on_front');
+                               // Correct <!--nextpage--> for page_on_front
+                               if ( !empty($qv['paged']) ) {
+                                       $qv['page'] = $qv['paged'];
+                                       unset($qv['paged']);
+                               }
+                       }
                }
 
                if ( '' != $qv['pagename'] ) {
@@ -1463,8 +1526,8 @@ class WP_Query {
                        }
                }
 
-               if ( !empty($qv['post_type']) ) {
-                       if(is_array($qv['post_type']))
+               if ( !empty($qv['post_type']) ) {
+                       if ( is_array($qv['post_type']) )
                                $qv['post_type'] = array_map('sanitize_user', $qv['post_type'], array(true));
                        else
                                $qv['post_type'] = sanitize_user($qv['post_type'], true);
@@ -1479,7 +1542,7 @@ class WP_Query {
                $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
                // Done correcting is_* for page_on_front and page_for_posts
 
-               if ('404' == $qv['error'])
+               if ( '404' == $qv['error'] )
                        $this->set_404();
 
                if ( !empty($query) )
@@ -1511,9 +1574,8 @@ class WP_Query {
         * @return mixed
         */
        function get($query_var) {
-               if (isset($this->query_vars[$query_var])) {
+               if ( isset($this->query_vars[$query_var]) )
                        return $this->query_vars[$query_var];
-               }
 
                return '';
        }
@@ -1544,7 +1606,7 @@ class WP_Query {
         * @return array List of posts.
         */
        function &get_posts() {
-               global $wpdb, $user_ID;
+               global $wpdb, $user_ID, $_wp_using_ext_object_cache;
 
                do_action_ref_array('pre_get_posts', array(&$this));
 
@@ -1573,6 +1635,19 @@ class WP_Query {
                if ( !isset($q['suppress_filters']) )
                        $q['suppress_filters'] = false;
 
+               if ( !isset($q['cache_results']) ) {
+                       if ( $_wp_using_ext_object_cache )
+                               $q['cache_results'] = false;
+                       else
+                               $q['cache_results'] = true;
+               }
+
+               if ( !isset($q['update_post_term_cache']) )
+                       $q['update_post_term_cache'] = true;
+
+               if ( !isset($q['update_post_meta_cache']) )
+                       $q['update_post_meta_cache'] = true;
+
                if ( !isset($q['post_type']) ) {
                        if ( $this->is_search )
                                $q['post_type'] = 'any';
@@ -1589,7 +1664,7 @@ class WP_Query {
                if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
                        $q['posts_per_page'] = $q['posts_per_archive_page'];
                if ( !isset($q['nopaging']) ) {
-                       if ($q['posts_per_page'] == -1) {
+                       if ( $q['posts_per_page'] == -1 ) {
                                $q['nopaging'] = true;
                        } else {
                                $q['nopaging'] = false;
@@ -1614,24 +1689,30 @@ class WP_Query {
                        $q['page_id'] = get_option('page_on_front');
                }
 
-               if (isset($q['page'])) {
+               if ( isset($q['page']) ) {
                        $q['page'] = trim($q['page'], '/');
                        $q['page'] = absint($q['page']);
                }
 
+               // If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
+               if ( isset($q['no_found_rows']) )
+                       $q['no_found_rows'] = (bool) $q['no_found_rows'];
+               else
+                       $q['no_found_rows'] = false;
+
                // If a month is specified in the querystring, load that month
                if ( $q['m'] ) {
                        $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);
                        $where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4);
-                       if (strlen($q['m'])>5)
+                       if ( strlen($q['m']) > 5 )
                                $where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
-                       if (strlen($q['m'])>7)
+                       if ( strlen($q['m']) > 7 )
                                $where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
-                       if (strlen($q['m'])>9)
+                       if ( strlen($q['m']) > 9 )
                                $where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
-                       if (strlen($q['m'])>11)
+                       if ( strlen($q['m']) > 11 )
                                $where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
-                       if (strlen($q['m'])>13)
+                       if ( strlen($q['m']) > 13 )
                                $where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
                }
 
@@ -1653,14 +1734,49 @@ class WP_Query {
                if ( $q['day'] )
                        $where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'";
 
-               if ('' != $q['name']) {
+               // If we've got a post_type AND its not "any" post_type.
+               if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
+                       foreach ( (array)$q['post_type'] as $_post_type ) {
+                               $ptype_obj = get_post_type_object($_post_type);
+                               if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
+                                       continue;
+
+                               if ( ! $ptype_obj->hierarchical || strpos($q[ $ptype_obj->query_var ], '/') === false ) {
+                                       // Non-hierarchical post_types & parent-level-hierarchical post_types can directly use 'name'
+                                       $q['name'] = $q[ $ptype_obj->query_var ];
+                               } else {
+                                       // Hierarchical post_types will operate through the
+                                       $q['pagename'] = $q[ $ptype_obj->query_var ];
+                                       $q['name'] = '';
+                               }
+
+                               // Only one request for a slug is possible, this is why name & pagename are overwritten above.
+                               break;
+                       } //end foreach
+                       unset($ptype_obj);
+               }
+
+               if ( '' != $q['name'] ) {
                        $q['name'] = sanitize_title($q['name']);
                        $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'";
-               } else if ('' != $q['pagename']) {
-                       if ( isset($this->queried_object_id) )
+               } elseif ( '' != $q['pagename'] ) {
+                       if ( isset($this->queried_object_id) ) {
                                $reqpage = $this->queried_object_id;
-                       else {
-                               $reqpage = get_page_by_path($q['pagename']);
+                       } else {
+                               if ( 'page' != $q['post_type'] ) {
+                                       foreach ( (array)$q['post_type'] as $_post_type ) {
+                                               $ptype_obj = get_post_type_object($_post_type);
+                                               if ( !$ptype_obj || !$ptype_obj->hierarchical )
+                                                       continue;
+
+                                               $reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
+                                               if ( $reqpage )
+                                                       break;
+                                       }
+                                       unset($ptype_obj);
+                               } else {
+                                       $reqpage = get_page_by_path($q['pagename']);
+                               }
                                if ( !empty($reqpage) )
                                        $reqpage = $reqpage->ID;
                                else
@@ -1668,7 +1784,7 @@ class WP_Query {
                        }
 
                        $page_for_posts = get_option('page_for_posts');
-                       if  ( ('page' != get_option('show_on_front') ) ||  empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
+                       if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
                                $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
                                $page_paths = '/' . trim($q['pagename'], '/');
                                $q['pagename'] = sanitize_title(basename($page_paths));
@@ -1677,11 +1793,12 @@ class WP_Query {
                                $reqpage_obj = get_page($reqpage);
                                if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
                                        $this->is_attachment = true;
+                                       $post_type = $q['post_type'] = 'attachment';
                                        $this->is_page = true;
                                        $q['attachment_id'] = $reqpage;
                                }
                        }
-               } elseif ('' != $q['attachment']) {
+               } elseif ( '' != $q['attachment'] ) {
                        $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
                        $attach_paths = '/' . trim($q['attachment'], '/');
                        $q['attachment'] = sanitize_title(basename($attach_paths));
@@ -1690,7 +1807,7 @@ class WP_Query {
                }
 
                if ( $q['w'] )
-                       $where .= " AND WEEK($wpdb->posts.post_date, 1)='" . $q['w'] . "'";
+                       $where .= ' AND ' . _wp_mysql_week( "`$wpdb->posts`.`post_date`" ) . " = '" . $q['w'] . "'";
 
                if ( intval($q['comments_popup']) )
                        $q['p'] = absint($q['comments_popup']);
@@ -1732,13 +1849,13 @@ class WP_Query {
                        }
                        $n = !empty($q['exact']) ? '' : '%';
                        $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 = esc_sql($q['s']);
-                       if (empty($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) ) {
@@ -1748,6 +1865,9 @@ class WP_Query {
                        }
                }
 
+               // Allow plugins to contextually add/remove/modify the search section of the database query
+               $search = apply_filters_ref_array('posts_search', array( $search, &$this ) );
+
                // Category stuff
 
                if ( empty($q['cat']) || ($q['cat'] == '0') ||
@@ -1852,7 +1972,7 @@ class WP_Query {
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag__in']) . "'";
                        $whichcat .= " AND $wpdb->term_taxonomy.term_id IN ($include_tags) ";
-                       $reqtag = is_term( $q['tag__in'][0], 'post_tag' );
+                       $reqtag = term_exists( $q['tag__in'][0], 'post_tag' );
                        if ( !empty($reqtag) )
                                $q['tag_id'] = $reqtag['term_id'];
                }
@@ -1875,12 +1995,12 @@ class WP_Query {
                // Tag and slug intersections.
                $intersections = array('category__and' => 'category', 'tag__and' => 'post_tag', 'tag_slug__and' => 'post_tag', 'tag__in' => 'post_tag', 'tag_slug__in' => 'post_tag');
                $tagin = array('tag__in', 'tag_slug__in'); // These are used to make some exceptions below
-               foreach ($intersections as $item => $taxonomy) {
+               foreach ( $intersections as $item => $taxonomy ) {
                        if ( empty($q[$item]) ) continue;
                        if ( in_array($item, $tagin) && empty($q['cat']) ) continue; // We should already have what we need if categories aren't being used
 
                        if ( $item != 'category__and' ) {
-                               $reqtag = is_term( $q[$item][0], 'post_tag' );
+                               $reqtag = term_exists( $q[$item][0], 'post_tag' );
                                if ( !empty($reqtag) )
                                        $q['tag_id'] = $reqtag['term_id'];
                        }
@@ -1911,27 +2031,36 @@ class WP_Query {
                        if ( '' != $q['taxonomy'] ) {
                                $taxonomy = $q['taxonomy'];
                                $tt[$taxonomy] = $q['term'];
-                               $terms = get_terms($q['taxonomy'], array('slug'=>$q['term']));
                        } else {
                                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
                                        if ( $t->query_var && '' != $q[$t->query_var] ) {
-                                               $terms = get_terms($taxonomy, array('slug'=>$q[$t->query_var]));
-                                               if ( !is_wp_error($terms) )
-                                                       break;
+                                               $tt[$taxonomy] = $q[$t->query_var];
+                                               break;
                                        }
                                }
                        }
+
+                       $terms = get_terms($taxonomy, array('slug' => $tt[$taxonomy], 'hide_empty' => !is_taxonomy_hierarchical($taxonomy)));
+
                        if ( is_wp_error($terms) || empty($terms) ) {
                                $whichcat = " AND 0 ";
                        } else {
-                               foreach ( $terms as $term )
+                               foreach ( $terms as $term ) {
                                        $term_ids[] = $term->term_id;
+                                       if ( is_taxonomy_hierarchical($taxonomy) ) {
+                                               $children = get_term_children($term->term_id, $taxonomy);
+                                               $term_ids = array_merge($term_ids, $children);
+                                       }
+                               }
                                $post_ids = get_objects_in_term($term_ids, $taxonomy);
-                               if ( !is_wp_error($post_ids) && count($post_ids) ) {
+                               if ( !is_wp_error($post_ids) && !empty($post_ids) ) {
                                        $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
-                                       $post_type = 'any';
-                                       $q['post_status'] = 'publish';
-                                       $post_status_join = true;
+                                       if ( empty($post_type) ) {
+                                               $post_type = 'any';
+                                               $post_status_join = true;
+                                       } elseif ( in_array('attachment', (array)$post_type) ) {
+                                               $post_status_join = true;
+                                       }
                                } else {
                                        $whichcat = " AND 0 ";
                                }
@@ -1941,59 +2070,60 @@ class WP_Query {
                // Author/user stuff
 
                if ( empty($q['author']) || ($q['author'] == '0') ) {
-                       $whichauthor='';
+                       $whichauthor = '';
                } else {
-                       $q['author'] = ''.urldecode($q['author']).'';
+                       $q['author'] = (string)urldecode($q['author']);
                        $q['author'] = addslashes_gpc($q['author']);
-                       if (strpos($q['author'], '-') !== false) {
+                       if ( strpos($q['author'], '-') !== false ) {
                                $eq = '!=';
                                $andor = 'AND';
                                $q['author'] = explode('-', $q['author']);
-                               $q['author'] = '' . absint($q['author'][1]);
+                               $q['author'] = (string)absint($q['author'][1]);
                        } else {
                                $eq = '=';
                                $andor = 'OR';
                        }
                        $author_array = preg_split('/[,\s]+/', $q['author']);
-                       $whichauthor .= " AND ($wpdb->posts.post_author ".$eq.' '.absint($author_array[0]);
-                       for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
-                               $whichauthor .= ' '.$andor." $wpdb->posts.post_author ".$eq.' '.absint($author_array[$i]);
-                       }
-                       $whichauthor .= ')';
+                       $_author_array = array();
+                       foreach ( $author_array as $key => $_author )
+                               $_author_array[] = "$wpdb->posts.post_author " . $eq . ' ' . absint($_author);
+                       $whichauthor .= ' AND (' . implode(" $andor ", $_author_array) . ')';
+                       unset($author_array, $_author_array);
                }
 
                // Author stuff for nice URLs
 
-               if ('' != $q['author_name']) {
-                       if (strpos($q['author_name'], '/') !== false) {
-                               $q['author_name'] = explode('/',$q['author_name']);
-                               if ($q['author_name'][count($q['author_name'])-1]) {
-                                       $q['author_name'] = $q['author_name'][count($q['author_name'])-1];#no trailing slash
+               if ( '' != $q['author_name'] ) {
+                       if ( strpos($q['author_name'], '/') !== false ) {
+                               $q['author_name'] = explode('/', $q['author_name']);
+                               if ( $q['author_name'][ count($q['author_name'])-1 ] ) {
+                                       $q['author_name'] = $q['author_name'][count($q['author_name'])-1]; // no trailing slash
                                } else {
-                                       $q['author_name'] = $q['author_name'][count($q['author_name'])-2];#there was a trailling slash
+                                       $q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailling slash
                                }
                        }
                        $q['author_name'] = sanitize_title($q['author_name']);
-                       $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
                        $q['author'] = get_user_by('slug', $q['author_name']);
                        if ( $q['author'] )
                                $q['author'] = $q['author']->ID;
-                       $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
+                       $whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
                }
 
                // MIME-Type stuff for attachment browsing
 
-               if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] )
-                       $whichmimetype = wp_post_mime_type_where($q['post_mime_type']);
+               if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) {
+                       $table_alias = $post_status_join ? $wpdb->posts : '';
+                       $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias);
+               }
 
-               $where .= $search.$whichcat.$whichauthor.$whichmimetype;
+               $where .= $search . $whichcat . $whichauthor . $whichmimetype;
 
                if ( empty($q['order']) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC')) )
                        $q['order'] = 'DESC';
 
                // Order by
                if ( empty($q['orderby']) ) {
-                       $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
+                       $q['orderby'] = "$wpdb->posts.post_date " . $q['order'];
                } elseif ( 'none' == $q['orderby'] ) {
                        $q['orderby'] = '';
                } else {
@@ -2002,17 +2132,19 @@ class WP_Query {
                        if ( !empty($q['meta_key']) ) {
                                $allowed_keys[] = $q['meta_key'];
                                $allowed_keys[] = 'meta_value';
+                               $allowed_keys[] = 'meta_value_num';
                        }
                        $q['orderby'] = urldecode($q['orderby']);
                        $q['orderby'] = addslashes_gpc($q['orderby']);
-                       $orderby_array = explode(' ',$q['orderby']);
-                       if ( empty($orderby_array) )
-                               $orderby_array[] = $q['orderby'];
+                       $orderby_array = explode(' ', $q['orderby']);
                        $q['orderby'] = '';
-                       for ($i = 0; $i < count($orderby_array); $i++) {
+
+                       foreach ( $orderby_array as $i => $orderby ) {
                                // Only allow certain values for safety
-                               $orderby = $orderby_array[$i];
-                               switch ($orderby) {
+                               if ( ! in_array($orderby, $allowed_keys) )
+                                       continue;
+
+                               switch ( $orderby ) {
                                        case 'menu_order':
                                                break;
                                        case 'ID':
@@ -2025,15 +2157,19 @@ class WP_Query {
                                        case 'meta_value':
                                                $orderby = "$wpdb->postmeta.meta_value";
                                                break;
+                                       case 'meta_value_num':
+                                               $orderby = "$wpdb->postmeta.meta_value+0";
+                                               break;
                                        case 'comment_count':
                                                $orderby = "$wpdb->posts.comment_count";
                                                break;
                                        default:
                                                $orderby = "$wpdb->posts.post_" . $orderby;
                                }
-                               if ( in_array($orderby_array[$i], $allowed_keys) )
-                                       $q['orderby'] .= (($i == 0) ? '' : ',') . $orderby;
+
+                               $q['orderby'] .= (($i == 0) ? '' : ',') . $orderby;
                        }
+
                        // append ASC or DESC at the end
                        if ( !empty($q['orderby']))
                                $q['orderby'] .= " {$q['order']}";
@@ -2042,30 +2178,50 @@ class WP_Query {
                                $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
                }
 
-               if ( is_array($post_type) )
+               if ( is_array($post_type) ) {
                        $post_type_cap = 'multiple_post_type';
-               else
-                       $post_type_cap = $post_type;
+               } else {
+                       $post_type_object = get_post_type_object ( $post_type );
+                       if ( !empty($post_type_object) )
+                               $post_type_cap = $post_type_object->capability_type;
+                       else
+                               $post_type_cap = $post_type;
+               }
 
                $exclude_post_types = '';
-               foreach ( get_post_types( array('exclude_from_search' => true) ) as $_wp_post_type )
-                       $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $_wp_post_type);
+               $in_search_post_types = get_post_types( array('exclude_from_search' => false) );
+               if ( ! empty( $in_search_post_types ) )
+                       $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");
 
                if ( 'any' == $post_type ) {
                        $where .= $exclude_post_types;
                } elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
-                       $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')"; 
+                       $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
                } elseif ( ! empty( $post_type ) ) {
                        $where .= " AND $wpdb->posts.post_type = '$post_type'";
+                       $post_type_object = get_post_type_object ( $post_type );
                } elseif ( $this->is_attachment ) {
                        $where .= " AND $wpdb->posts.post_type = 'attachment'";
-                       $post_type_cap = 'post';
-               } elseif ($this->is_page) {
+                       $post_type_object = get_post_type_object ( 'attachment' );
+               } elseif ( $this->is_page ) {
                        $where .= " AND $wpdb->posts.post_type = 'page'";
-                       $post_type_cap = 'page';
+                       $post_type_object = get_post_type_object ( 'page' );
                } else {
                        $where .= " AND $wpdb->posts.post_type = 'post'";
-                       $post_type_cap = 'post';
+                       $post_type_object = get_post_type_object ( 'post' );
+               }
+
+               if ( !empty($post_type_object) ) {
+                       $post_type_cap = $post_type_object->capability_type;
+                       $edit_cap = $post_type_object->cap->edit_post;
+                       $read_cap = $post_type_object->cap->read_post;
+                       $edit_others_cap = $post_type_object->cap->edit_others_posts;
+                       $read_private_cap = $post_type_object->cap->read_private_posts;
+               } else {
+                       $edit_cap = 'edit_' . $post_type_cap;
+                       $read_cap = 'read_' . $post_type_cap;
+                       $edit_others_cap = 'edit_others_' . $post_type_cap . 's';
+                       $read_private_cap = 'read_private_' . $post_type_cap . 's';
                }
 
                if ( isset($q['post_status']) && '' != $q['post_status'] ) {
@@ -2073,24 +2229,19 @@ class WP_Query {
                        $q_status = explode(',', $q['post_status']);
                        $r_status = array();
                        $p_status = array();
+                       $e_status = array();
                        if ( $q['post_status'] == 'any' ) {
-                               // @todo Use register_post_status() data to determine which states should be excluded.
-                               $r_status[] = "$wpdb->posts.post_status <> 'trash'";
+                               foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status )
+                                       $e_status[] = "$wpdb->posts.post_status <> '$status'";
                        } else {
-                               if ( in_array( 'draft'  , $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'draft'";
-                               if ( in_array( 'pending', $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'pending'";
-                               if ( in_array( 'future' , $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'future'";
-                               if ( in_array( 'inherit' , $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'inherit'";
-                               if ( in_array( 'private', $q_status ) )
-                                       $p_status[] = "$wpdb->posts.post_status = 'private'";
-                               if ( in_array( 'publish', $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'publish'";
-                               if ( in_array( 'trash', $q_status ) )
-                                       $r_status[] = "$wpdb->posts.post_status = 'trash'";
+                               foreach ( get_post_stati() as $status ) {
+                                       if ( in_array( $status, $q_status ) ) {
+                                               if ( 'private' == $status )
+                                                       $p_status[] = "$wpdb->posts.post_status = '$status'";
+                                               else
+                                                       $r_status[] = "$wpdb->posts.post_status = '$status'";
+                                       }
+                               }
                        }
 
                        if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
@@ -2098,14 +2249,17 @@ class WP_Query {
                                unset($p_status);
                        }
 
+                       if ( !empty($e_status) ) {
+                               $statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
+                       }
                        if ( !empty($r_status) ) {
-                               if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can("edit_others_{$post_type_cap}s") )
+                               if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
                                        $statuswheres[] = "($wpdb->posts.post_author = $user_ID " .  "AND (" . join( ' OR ', $r_status ) . "))";
                                else
                                        $statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
                        }
                        if ( !empty($p_status) ) {
-                               if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can("read_private_{$post_type_cap}s") )
+                               if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
                                        $statuswheres[] = "($wpdb->posts.post_author = $user_ID " .  "AND (" . join( ' OR ', $p_status ) . "))";
                                else
                                        $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
@@ -2120,11 +2274,26 @@ class WP_Query {
                } elseif ( !$this->is_singular ) {
                        $where .= " AND ($wpdb->posts.post_status = 'publish'";
 
-                       if ( is_admin() )
-                               $where .= " OR $wpdb->posts.post_status = 'future' OR $wpdb->posts.post_status = 'draft' OR $wpdb->posts.post_status = 'pending'";
+                       // Add public states.
+                       $public_states = get_post_stati( array('public' => true) );
+                       foreach ( (array) $public_states as $state ) {
+                               if ( 'publish' == $state ) // Publish is hard-coded above.
+                                       continue;
+                               $where .= " OR $wpdb->posts.post_status = '$state'";
+                       }
+
+                       if ( is_admin() ) {
+                               // Add protected states that should show in the admin all list.
+                               $admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
+                               foreach ( (array) $admin_all_states as $state )
+                                       $where .= " OR $wpdb->posts.post_status = '$state'";
+                       }
 
                        if ( is_user_logged_in() ) {
-                               $where .= current_user_can( "read_private_{$post_type_cap}s" ) ? " OR $wpdb->posts.post_status = 'private'" : " OR $wpdb->posts.post_author = $user_ID AND $wpdb->posts.post_status = 'private'";
+                               // Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
+                               $private_states = get_post_stati( array('private' => true) );
+                               foreach ( (array) $private_states as $state )
+                                       $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_ID AND $wpdb->posts.post_status = '$state'";
                        }
 
                        $where .= ')';
@@ -2136,7 +2305,7 @@ class WP_Query {
                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('=', '!=', '>', '>=', '<', '<=')) )
+                       if ( 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']);
@@ -2145,21 +2314,20 @@ class WP_Query {
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
                if ( !$q['suppress_filters'] ) {
-                       $where = apply_filters('posts_where', $where);
-                       $join = apply_filters('posts_join', $join);
+                       $where = apply_filters_ref_array('posts_where', array( $where, &$this ) );
+                       $join = apply_filters_ref_array('posts_join', array( $join, &$this ) );
                }
 
                // Paging
                if ( empty($q['nopaging']) && !$this->is_singular ) {
                        $page = absint($q['paged']);
-                       if (empty($page)) {
+                       if ( empty($page) )
                                $page = 1;
-                       }
 
                        if ( empty($q['offset']) ) {
                                $pgstrt = '';
                                $pgstrt = ($page - 1) * $q['posts_per_page'] . ', ';
-                               $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
+                               $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
                        } else { // we're ignoring $page and using 'offset'
                                $q['offset'] = absint($q['offset']);
                                $pgstrt = $q['offset'] . ', ';
@@ -2180,11 +2348,11 @@ class WP_Query {
                        }
 
                        if ( !$q['suppress_filters'] ) {
-                               $cjoin = apply_filters('comment_feed_join', $cjoin);
-                               $cwhere = apply_filters('comment_feed_where', $cwhere);
-                               $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
-                               $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC');
-                               $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
+                               $cjoin = apply_filters_ref_array('comment_feed_join', array( $cjoin, &$this ) );
+                               $cwhere = apply_filters_ref_array('comment_feed_where', array( $cwhere, &$this ) );
+                               $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( $cgroupby, &$this ) );
+                               $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+                               $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
                        }
                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
@@ -2194,7 +2362,7 @@ class WP_Query {
 
                        $post_ids = array();
 
-                       foreach ($this->comments as $comment)
+                       foreach ( $this->comments as $comment )
                                $post_ids[] = (int) $comment->comment_post_ID;
 
                        $post_ids = join(',', $post_ids);
@@ -2210,14 +2378,13 @@ class WP_Query {
                // Apply post-paging filters on where and join.  Only plugins that
                // manipulate paging queries should use these hooks.
                if ( !$q['suppress_filters'] ) {
-                       $where = apply_filters('posts_where_paged', $where);
-                       $groupby = apply_filters('posts_groupby', $groupby);
-                       $join = apply_filters('posts_join_paged', $join);
-                       $orderby = apply_filters('posts_orderby', $orderby);
-                       $distinct = apply_filters('posts_distinct', $distinct);
-                       $limits = apply_filters( 'post_limits', $limits );
-
-                       $fields = apply_filters('posts_fields', $fields);
+                       $where          = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
+                       $groupby        = apply_filters_ref_array( 'posts_groupby',             array( $groupby, &$this ) );
+                       $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
+                       $orderby        = apply_filters_ref_array( 'posts_orderby',             array( $orderby, &$this ) );
+                       $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
+                       $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );
+                       $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
                }
 
                // Announce current selection parameters.  For use by caching plugins.
@@ -2225,13 +2392,13 @@ class WP_Query {
 
                // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
                if ( !$q['suppress_filters'] ) {
-                       $where = apply_filters('posts_where_request', $where);
-                       $groupby = apply_filters('posts_groupby_request', $groupby);
-                       $join = apply_filters('posts_join_request', $join);
-                       $orderby = apply_filters('posts_orderby_request', $orderby);
-                       $distinct = apply_filters('posts_distinct_request', $distinct);
-                       $fields = apply_filters('posts_fields_request', $fields);
-                       $limits = apply_filters( 'post_limits_request', $limits );
+                       $where          = apply_filters_ref_array( 'posts_where_request',       array( $where, &$this ) );
+                       $groupby        = apply_filters_ref_array( 'posts_groupby_request',             array( $groupby, &$this ) );
+                       $join           = apply_filters_ref_array( 'posts_join_request',        array( $join, &$this ) );
+                       $orderby        = apply_filters_ref_array( 'posts_orderby_request',             array( $orderby, &$this ) );
+                       $distinct       = apply_filters_ref_array( 'posts_distinct_request',    array( $distinct, &$this ) );
+                       $fields         = apply_filters_ref_array( 'posts_fields_request',              array( $fields, &$this ) );
+                       $limits         = apply_filters_ref_array( 'post_limits_request',               array( $limits, &$this ) );
                }
 
                if ( ! empty($groupby) )
@@ -2239,69 +2406,68 @@ class WP_Query {
                if ( !empty( $orderby ) )
                        $orderby = 'ORDER BY ' . $orderby;
                $found_rows = '';
-               if ( !empty($limits) )
+               if ( !$q['no_found_rows'] && !empty($limits) )
                        $found_rows = 'SQL_CALC_FOUND_ROWS';
 
                $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
                if ( !$q['suppress_filters'] )
-                       $this->request = apply_filters('posts_request', $this->request);
+                       $this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) );
 
                $this->posts = $wpdb->get_results($this->request);
                // Raw results filter.  Prior to status checks.
                if ( !$q['suppress_filters'] )
-                       $this->posts = apply_filters('posts_results', $this->posts);
+                       $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) );
 
                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
-                       $cjoin = apply_filters('comment_feed_join', '');
-                       $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'");
-                       $cgroupby = apply_filters('comment_feed_groupby', '');
+                       $cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) );
+                       $cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
+                       $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( '', &$this ) );
                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
-                       $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC');
+                       $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
-                       $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
+                       $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
                        $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
                        $this->comments = $wpdb->get_results($comments_request);
                        $this->comment_count = count($this->comments);
                }
 
-               if ( !empty($limits) ) {
-                       $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' );
+               if ( !$q['no_found_rows'] && !empty($limits) ) {
+                       $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) );
                        $this->found_posts = $wpdb->get_var( $found_posts_query );
-                       $this->found_posts = apply_filters( 'found_posts', $this->found_posts );
+                       $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
                        $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
                }
 
                // Check post status to determine if post should be displayed.
                if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
                        $status = get_post_status($this->posts[0]);
+                       $post_status_obj = get_post_status_object($status);
                        //$type = get_post_type($this->posts[0]);
-                       if ( ('publish' != $status) ) {
+                       if ( !$post_status_obj->public ) {
                                if ( ! is_user_logged_in() ) {
                                        // User must be logged in to view unpublished posts.
                                        $this->posts = array();
                                } else {
-                                       if  (in_array($status, array('draft', 'pending', 'trash')) ) {
+                                       if  ( $post_status_obj->protected ) {
                                                // User must have edit permissions on the draft to preview.
-                                               if (! current_user_can("edit_$post_type_cap", $this->posts[0]->ID)) {
+                                               if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) {
                                                        $this->posts = array();
                                                } else {
                                                        $this->is_preview = true;
-                                                       $this->posts[0]->post_date = current_time('mysql');
-                                               }
-                                       }  else if ('future' == $status) {
-                                               $this->is_preview = true;
-                                               if (!current_user_can("edit_$post_type_cap", $this->posts[0]->ID)) {
-                                                       $this->posts = array ( );
+                                                       if ( 'future' != $status )
+                                                               $this->posts[0]->post_date = current_time('mysql');
                                                }
-                                       } else {
-                                               if (! current_user_can("read_$post_type_cap", $this->posts[0]->ID))
+                                       } elseif ( $post_status_obj->private ) {
+                                               if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
                                                        $this->posts = array();
+                                       } else {
+                                               $this->posts = array();
                                        }
                                }
                        }
 
-                       if ( $this->is_preview && current_user_can( "edit_{$post_type_cap}", $this->posts[0]->ID ) )
-                               $this->posts[0] = apply_filters('the_preview', $this->posts[0]);
+                       if ( $this->is_preview && current_user_can( $edit_cap, $this->posts[0]->ID ) )
+                               $this->posts[0] = apply_filters_ref_array('the_preview', array( $this->posts[0], &$this ));
                }
 
                // Put sticky posts at the top of the posts array
@@ -2321,10 +2487,14 @@ class WP_Query {
                                        $sticky_offset++;
                                        // Remove post from sticky posts array
                                        $offset = array_search($sticky_post->ID, $sticky_posts);
-                                       array_splice($sticky_posts, $offset, 1);
+                                       unset( $sticky_posts[$offset] );
                                }
                        }
 
+                       // If any posts have been excluded specifically, Ignore those that are sticky.
+                       if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
+                               $sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
+
                        // Fetch sticky posts that weren't in the query results
                        if ( !empty($sticky_posts) ) {
                                $stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
@@ -2338,30 +2508,32 @@ class WP_Query {
                                        }
                                        $stickies_where = "AND $wpdb->posts.post_type IN ('" . $post_types . "')";
                                }
+
                                $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" );
-                               /** @todo Make sure post is published or viewable by the current user */
                                foreach ( $stickies as $sticky_post ) {
+                                       // Ignore sticky posts the current user cannot read or are not published.
                                        if ( 'publish' != $sticky_post->post_status )
                                                continue;
-                                               array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
-                                               $sticky_offset++;
+                                       array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
+                                       $sticky_offset++;
                                }
                        }
                }
 
                if ( !$q['suppress_filters'] )
-                       $this->posts = apply_filters('the_posts', $this->posts);
+                       $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) );
 
                $this->post_count = count($this->posts);
 
                // Sanitize before caching so it'll only get done once
-               for ($i = 0; $i < $this->post_count; $i++) {
+               for ( $i = 0; $i < $this->post_count; $i++ ) {
                        $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
                }
 
-               update_post_caches($this->posts);
+               if ( $q['cache_results'] )
+                       update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
 
-               if ($this->post_count > 0) {
+               if ( $this->post_count > 0 ) {
                        $this->post = $this->posts[0];
                }
 
@@ -2369,7 +2541,7 @@ class WP_Query {
        }
 
        /**
-        * Setup the next post and iterate current post index.
+        * Set up the next post and iterate current post index.
         *
         * @since 1.5.0
         * @access public
@@ -2418,9 +2590,9 @@ class WP_Query {
         * @return bool True if posts are available, false if end of loop.
         */
        function have_posts() {
-               if ($this->current_post + 1 < $this->post_count) {
+               if ( $this->current_post + 1 < $this->post_count ) {
                        return true;
-               } elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
+               } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
                        do_action_ref_array('loop_end', array(&$this));
                        // Do some cleaning up after the loop
                        $this->rewind_posts();
@@ -2438,7 +2610,7 @@ class WP_Query {
         */
        function rewind_posts() {
                $this->current_post = -1;
-               if ($this->post_count > 0) {
+               if ( $this->post_count > 0 ) {
                        $this->post = $this->posts[0];
                }
        }
@@ -2471,7 +2643,7 @@ class WP_Query {
 
                $comment = $this->next_comment();
 
-               if ($this->current_comment == 0) {
+               if ( $this->current_comment == 0 ) {
                        do_action('comment_loop_start');
                }
        }
@@ -2487,9 +2659,9 @@ class WP_Query {
         * @return bool True, if more comments. False, if no more posts.
         */
        function have_comments() {
-               if ($this->current_comment + 1 < $this->comment_count) {
+               if ( $this->current_comment + 1 < $this->comment_count ) {
                        return true;
-               } elseif ($this->current_comment + 1 == $this->comment_count) {
+               } elseif ( $this->current_comment + 1 == $this->comment_count ) {
                        $this->rewind_comments();
                }
 
@@ -2504,7 +2676,7 @@ class WP_Query {
         */
        function rewind_comments() {
                $this->current_comment = -1;
-               if ($this->comment_count > 0) {
+               if ( $this->comment_count > 0 ) {
                        $this->comment = $this->comments[0];
                }
        }
@@ -2536,46 +2708,45 @@ class WP_Query {
         * @return object
         */
        function get_queried_object() {
-               if (isset($this->queried_object)) {
+               if ( isset($this->queried_object) )
                        return $this->queried_object;
-               }
 
                $this->queried_object = NULL;
                $this->queried_object_id = 0;
 
-               if ($this->is_category) {
+               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) {
+               } elseif ( $this->is_tag ) {
                        $tag_id = $this->get('tag_id');
                        $tag = &get_term($tag_id, 'post_tag');
                        if ( is_wp_error( $tag ) )
                                return NULL;
                        $this->queried_object = &$tag;
                        $this->queried_object_id = (int) $tag_id;
-               } else if ($this->is_tax) {
+               } elseif ( $this->is_tax ) {
                        $tax = $this->get('taxonomy');
                        $slug = $this->get('term');
-                       $term = &get_terms($tax, array('slug'=>$slug));
+                       $term = &get_terms($tax, array( 'slug' => $slug, 'hide_empty' => false ) );
                        if ( is_wp_error($term) || empty($term) )
                                return NULL;
                        $term = $term[0];
                        $this->queried_object = $term;
                        $this->queried_object_id = $term->term_id;
-               } else if ($this->is_posts_page) {
+               } elseif ( $this->is_posts_page ) {
                        $this->queried_object = & get_page(get_option('page_for_posts'));
                        $this->queried_object_id = (int) $this->queried_object->ID;
-               } else if ($this->is_single) {
+               } elseif ( $this->is_single && !is_null($this->post) ) {
                        $this->queried_object = $this->post;
                        $this->queried_object_id = (int) $this->post->ID;
-               } else if ($this->is_page) {
+               } elseif ( $this->is_page && !is_null($this->post) ) {
                        $this->queried_object = $this->post;
                        $this->queried_object_id = (int) $this->post->ID;
-               } else if ($this->is_author) {
+               } elseif ( $this->is_author ) {
                        $author_id = (int) $this->get('author');
                        $author = get_userdata($author_id);
                        $this->queried_object = $author;
@@ -2596,7 +2767,7 @@ class WP_Query {
        function get_queried_object_id() {
                $this->get_queried_object();
 
-               if (isset($this->queried_object_id)) {
+               if ( isset($this->queried_object_id) ) {
                        return $this->queried_object_id;
                }
 
@@ -2614,8 +2785,8 @@ class WP_Query {
         * @param string $query URL query string.
         * @return WP_Query
         */
-       function WP_Query ($query = '') {
-               if (! empty($query)) {
+       function WP_Query($query = '') {
+               if ( ! empty($query) ) {
                        $this->query($query);
                }
        }
@@ -2632,7 +2803,7 @@ class WP_Query {
  *
  * @return null If no link is found, null is returned.
  */
-function wp_old_slug_redirect () {
+function wp_old_slug_redirect() {
        global $wp_query;
        if ( is_404() && '' != $wp_query->query_vars['name'] ) :
                global $wpdb;
@@ -2664,7 +2835,7 @@ function wp_old_slug_redirect () {
 }
 
 /**
- * Setup global post data.
+ * Set up global post data.
  *
  * @since 1.5.0
  *
@@ -2698,7 +2869,7 @@ function setup_postdata($post) {
                $pages = explode('<!--nextpage-->', $content);
                $numpages = count($pages);
        } else {
-               $pages[0] = $post->post_content;
+               $pages = array( $post->post_content );
                $multipage = 0;
        }
 
@@ -2706,5 +2877,4 @@ function setup_postdata($post) {
 
        return true;
 }
-
 ?>
index a1d5ab54f28fb0dd68d104d61c5c7e8341ac54c0..d1cf72a578c0fa9922fc8d363ebdc06dea2eff7d 100644 (file)
@@ -4,6 +4,6 @@
  *
  * @package WordPress
  */
-_deprecated_file( basename(__FILE__), '0.0', 'registration.php' );
+_deprecated_file( basename(__FILE__), '2.1', WPINC .  '/registration.php' );
 require_once(ABSPATH . WPINC .  '/registration.php');
 ?>
index 6148bb67ebd59b3285269c9899b5c8a808566100..63f70e21325ce93aab9ed137e05e79fc0142c7d2 100644 (file)
@@ -83,7 +83,7 @@ function validate_username( $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
+ * 'rich_editing' - A string for whether to enable the rich editor. 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.
@@ -98,7 +98,7 @@ function validate_username( $username ) {
  * @uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID
  *
  * @param array $userdata An array of user data.
- * @return int The newly created user's ID.
+ * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not be created.
  */
 function wp_insert_user($userdata) {
        global $wpdb;
@@ -119,6 +119,15 @@ function wp_insert_user($userdata) {
        $user_login = sanitize_user($user_login, true);
        $user_login = apply_filters('pre_user_login', $user_login);
 
+       //Remove any non-printable chars from the login string to see if we have ended up with an empty username
+       $user_login = trim($user_login);
+
+       if ( empty($user_login) )
+               return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') );
+
+       if ( !$update && username_exists( $user_login ) )
+               return new WP_Error('existing_user_login', __('This username is already registered.') );
+
        if ( empty($user_nicename) )
                $user_nicename = sanitize_title( $user_login );
        $user_nicename = apply_filters('pre_user_nicename', $user_nicename);
@@ -131,6 +140,9 @@ function wp_insert_user($userdata) {
                $user_email = '';
        $user_email = apply_filters('pre_user_email', $user_email);
 
+       if ( !$update && ! defined( 'WP_IMPORTING' ) && email_exists($user_email) )
+               return new WP_Error('existing_user_email', __('This email address is already registered.') );
+
        if ( empty($display_name) )
                $display_name = $user_login;
        $display_name = apply_filters('pre_user_display_name', $display_name);
@@ -190,20 +202,20 @@ function wp_insert_user($userdata) {
                $user_id = (int) $wpdb->insert_id;
        }
 
-       update_usermeta( $user_id, 'first_name', $first_name);
-       update_usermeta( $user_id, 'last_name', $last_name);
-       update_usermeta( $user_id, 'nickname', $nickname );
-       update_usermeta( $user_id, 'description', $description );
-       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, 'use_ssl', $use_ssl);
+       update_user_meta( $user_id, 'first_name', $first_name);
+       update_user_meta( $user_id, 'last_name', $last_name);
+       update_user_meta( $user_id, 'nickname', $nickname );
+       update_user_meta( $user_id, 'description', $description );
+       update_user_meta( $user_id, 'rich_editing', $rich_editing);
+       update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts);
+       update_user_meta( $user_id, 'admin_color', $admin_color);
+       update_user_meta( $user_id, 'use_ssl', $use_ssl);
 
        foreach ( _wp_get_user_contactmethods() as $method => $name ) {
                if ( empty($$method) )
                        $$method = '';
 
-               update_usermeta( $user_id, $method, $$method );
+               update_user_meta( $user_id, $method, $$method );
        }
 
        if ( isset($role) ) {
@@ -259,6 +271,8 @@ function wp_update_user($userdata) {
                $userdata['user_pass'] = wp_hash_password($userdata['user_pass']);
        }
 
+       wp_cache_delete($user[ 'user_email' ], 'useremail');
+
        // Merge old and new fields with new fields overwriting old ones.
        $userdata = array_merge($user, $userdata);
        $user_id = wp_insert_user($userdata);
@@ -300,7 +314,7 @@ function wp_create_user($username, $password, $email = '') {
 
 
 /**
- * Setup the default contact methods
+ * Set up the default contact methods
  *
  * @access private
  * @since
index 4c8d9e68cad3acf74c684cd0cbad243de10b128d..ae5a3b396b7a766f527f772f28c27c1dedeeb3c8 100644 (file)
@@ -34,9 +34,8 @@ function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
  */
 function add_rewrite_tag($tagname, $regex) {
        //validation
-       if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
+       if ( strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%' )
                return;
-       }
 
        $qv = trim($tagname, '%');
 
@@ -45,6 +44,21 @@ function add_rewrite_tag($tagname, $regex) {
        $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
 }
 
+/**
+ * Add permalink structure.
+ *
+ * @see WP_Rewrite::add_permastruct()
+ * @since 3.0.0
+ *
+ * @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, $ep_mask = EP_NONE ) {
+       global $wp_rewrite;
+       return $wp_rewrite->add_permastruct( $name, $struct, $with_front, $ep_mask );
+}
+
 /**
  * Add a new feed type like /atom1/.
  *
@@ -56,9 +70,8 @@ function add_rewrite_tag($tagname, $regex) {
  */
 function add_feed($feedname, $function) {
        global $wp_rewrite;
-       if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
+       if ( ! in_array($feedname, $wp_rewrite->feeds) ) //override the file if it is
                $wp_rewrite->feeds[] = $feedname;
-       }
        $hook = 'do_feed_' . $feedname;
        // Remove default function hook
        remove_action($hook, $hook, 10, 1);
@@ -66,6 +79,28 @@ function add_feed($feedname, $function) {
        return $hook;
 }
 
+/**
+ * Remove rewrite rules and then recreate rewrite rules.
+ *
+ * @see WP_Rewrite::flush_rules()
+ * @since 3.0.0
+ *
+ * @param bool $hard Whether to update .htaccess (hard flush) or just update
+ *     rewrite_rules transient (soft flush). Default is true (hard).
+ */
+function flush_rewrite_rules( $hard = true ) {
+       global $wp_rewrite;
+       $wp_rewrite->flush_rules( $hard );
+}
+
+//pseudo-places
+/**
+ * Endpoint Mask for default, which is nothing.
+ *
+ * @since 2.1.0
+ */
+define('EP_NONE', 0);
+
 /**
  * Endpoint Mask for Permalink.
  *
@@ -157,14 +192,6 @@ define('EP_AUTHORS', 2048);
  */
 define('EP_PAGES', 4096);
 
-//pseudo-places
-/**
- * Endpoint Mask for default, which is nothing.
- *
- * @since 2.1.0
- */
-define('EP_NONE', 0);
-
 /**
  * Endpoint Mask for everything.
  *
@@ -200,7 +227,6 @@ function add_rewrite_endpoint($name, $places) {
  *
  * @access private
  * @since 2.6.0
- * @author Mark Jaquith
  *
  * @param string $base The taxonomy base that we're going to filter
  * @return string
@@ -231,7 +257,7 @@ function url_to_postid($url) {
        // First, check to see if there is a 'p=N' or 'page_id=N' to match against
        if ( preg_match('#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values) )       {
                $id = absint($values[2]);
-               if ($id)
+               if ( $id )
                        return $id;
        }
 
@@ -256,23 +282,23 @@ function url_to_postid($url) {
        $url = $url_split[0];
 
        // Add 'www.' if it is absent and should be there
-       if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') )
+       if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') )
                $url = str_replace('://', '://www.', $url);
 
        // Strip 'www.' if it is present and shouldn't be
-       if ( false === strpos(get_option('home'), '://www.') )
+       if ( false === strpos(home_url(), '://www.') )
                $url = str_replace('://www.', '://', $url);
 
        // Strip 'index.php/' if we're not using path info permalinks
        if ( !$wp_rewrite->using_index_permalinks() )
                $url = str_replace('index.php/', '', $url);
 
-       if ( false !== strpos($url, get_option('home')) ) {
+       if ( false !== strpos($url, home_url()) ) {
                // Chop off http://domain.com
-               $url = str_replace(get_option('home'), '', $url);
+               $url = str_replace(home_url(), '', $url);
        } else {
                // Chop off /path/to/blog
-               $home_path = parse_url(get_option('home'));
+               $home_path = parse_url(home_url());
                $home_path = $home_path['path'];
                $url = str_replace($home_path, '', $url);
        }
@@ -286,12 +312,11 @@ function url_to_postid($url) {
 
        // Look for matches.
        $request_match = $request;
-       foreach ($rewrite as $match => $query) {
+       foreach ( (array)$rewrite as $match => $query) {
                // If the requesting file is the anchor of the match, prepend it
                // to the path info.
-               if ( (! empty($url)) && (strpos($match, $url) === 0) && ($url != $request)) {
+               if ( !empty($url) && ($url != $request) && (strpos($match, $url) === 0) )
                        $request_match = $url . '/' . $request;
-               }
 
                if ( preg_match("!^$match!", $request_match, $matches) ) {
                        // Got a match.
@@ -300,6 +325,7 @@ function url_to_postid($url) {
 
                        // Substitute the substring matches into the query.
                        $query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
+
                        // Filter out non-public query vars
                        global $wp;
                        parse_str($query, $query_vars);
@@ -308,6 +334,7 @@ function url_to_postid($url) {
                                if ( in_array($key, $wp->public_query_vars) )
                                        $query[$key] = $value;
                        }
+
                        // Do the query
                        $query = new WP_Query($query);
                        if ( $query->is_single || $query->is_page )
@@ -696,10 +723,7 @@ class WP_Rewrite {
         * @return bool True, if permalinks are enabled.
         */
        function using_permalinks() {
-               if (empty($this->permalink_structure))
-                       return false;
-               else
-                       return true;
+               return ! empty($this->permalink_structure);
        }
 
        /**
@@ -713,14 +737,12 @@ class WP_Rewrite {
         * @return bool
         */
        function using_index_permalinks() {
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) )
                        return false;
-               }
 
                // If the index is not in the permalink, we're using mod_rewrite.
-               if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) {
+               if ( preg_match('#^/*' . $this->index . '#', $this->permalink_structure) )
                        return true;
-               }
 
                return false;
        }
@@ -736,7 +758,7 @@ class WP_Rewrite {
         * @return bool
         */
        function using_mod_rewrite_permalinks() {
-               if ( $this->using_permalinks() && ! $this->using_index_permalinks())
+               if ( $this->using_permalinks() && ! $this->using_index_permalinks() )
                        return true;
                else
                        return false;
@@ -786,20 +808,22 @@ class WP_Rewrite {
 
                //get pages in order of hierarchy, i.e. children after parents
                $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
+
+               // If we have no pages get out quick
+               if ( !$posts )
+                       return array( array(), array() );
+
                //now reverse it, because we need parents after children for rewrite rules to work properly
                $posts = array_reverse($posts, true);
 
                $page_uris = array();
                $page_attachment_uris = array();
 
-               if ( !$posts )
-                       return array( array(), array() );
-
-               foreach ($posts as $id => $post) {
+               foreach ( $posts as $id => $post ) {
                        // URL => page name
                        $uri = get_page_uri($id);
                        $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ));
-                       if ( $attachments ) {
+                       if ( !empty($attachments) ) {
                                foreach ( $attachments as $attachment ) {
                                        $attach_uri = get_page_uri($attachment->ID);
                                        $page_attachment_uris[$attach_uri] = $attachment->ID;
@@ -839,14 +863,14 @@ class WP_Rewrite {
                $uris = $page_uris[0];
                $attachment_uris = $page_uris[1];
 
-               if( is_array( $attachment_uris ) ) {
-                       foreach ($attachment_uris as $uri => $pagename) {
+               if ( is_array( $attachment_uris ) ) {
+                       foreach ( $attachment_uris as $uri => $pagename ) {
                                $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment=');
                                $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES));
                        }
                }
-               if( is_array( $uris ) ) {
-                       foreach ($uris as $uri => $pagename) {
+               if ( is_array( $uris ) ) {
+                       foreach ( $uris as $uri => $pagename ) {
                                $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename=');
                                $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES));
                        }
@@ -876,11 +900,10 @@ class WP_Rewrite {
         * @return bool|string False on no permalink structure. Date permalink structure.
         */
        function get_date_permastruct() {
-               if (isset($this->date_structure)) {
+               if ( isset($this->date_structure) )
                        return $this->date_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->date_structure = '';
                        return false;
                }
@@ -891,8 +914,8 @@ class WP_Rewrite {
                $this->date_structure = '';
                $date_endian = '';
 
-               foreach ($endians as $endian) {
-                       if (false !== strpos($this->permalink_structure, $endian)) {
+               foreach ( $endians as $endian ) {
+                       if ( false !== strpos($this->permalink_structure, $endian) ) {
                                $date_endian= $endian;
                                break;
                        }
@@ -907,7 +930,7 @@ class WP_Rewrite {
                preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
                $tok_index = 1;
                foreach ( (array) $tokens[0] as $token) {
-                       if ( ($token == '%post_id%') && ($tok_index <= 3) ) {
+                       if ( '%post_id%' == $token && ($tok_index <= 3) ) {
                                $front = $front . 'date/';
                                break;
                        }
@@ -933,9 +956,8 @@ class WP_Rewrite {
        function get_year_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
-               if (empty($structure)) {
+               if ( empty($structure) )
                        return false;
-               }
 
                $structure = str_replace('%monthnum%', '', $structure);
                $structure = str_replace('%day%', '', $structure);
@@ -959,9 +981,8 @@ class WP_Rewrite {
        function get_month_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
-               if (empty($structure)) {
+               if ( empty($structure) )
                        return false;
-               }
 
                $structure = str_replace('%day%', '', $structure);
 
@@ -998,16 +1019,15 @@ class WP_Rewrite {
         * @return bool|string False on failure. Category permalink structure.
         */
        function get_category_permastruct() {
-               if (isset($this->category_structure)) {
+               if ( isset($this->category_structure) )
                        return $this->category_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->category_structure = '';
                        return false;
                }
 
-               if (empty($this->category_base))
+               if ( empty($this->category_base) )
                        $this->category_structure = trailingslashit( $this->front . 'category' );
                else
                        $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base );
@@ -1031,16 +1051,15 @@ class WP_Rewrite {
         * @return bool|string False on failure. Tag permalink structure.
         */
        function get_tag_permastruct() {
-               if (isset($this->tag_structure)) {
+               if ( isset($this->tag_structure) )
                        return $this->tag_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->tag_structure = '';
                        return false;
                }
 
-               if (empty($this->tag_base))
+               if ( empty($this->tag_base) )
                        $this->tag_structure = trailingslashit( $this->front . 'tag' );
                else
                        $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base );
@@ -1062,8 +1081,10 @@ class WP_Rewrite {
        function get_extra_permastruct($name) {
                if ( empty($this->permalink_structure) )
                        return false;
+
                if ( isset($this->extra_permastructs[$name]) )
-                       return $this->extra_permastructs[$name];
+                       return $this->extra_permastructs[$name][0];
+
                return false;
        }
 
@@ -1080,11 +1101,10 @@ class WP_Rewrite {
         * @return string|bool False if not found. Permalink structure string.
         */
        function get_author_permastruct() {
-               if (isset($this->author_structure)) {
+               if ( isset($this->author_structure) )
                        return $this->author_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->author_structure = '';
                        return false;
                }
@@ -1107,11 +1127,10 @@ class WP_Rewrite {
         * @return string|bool False if not found. Permalink structure string.
         */
        function get_search_permastruct() {
-               if (isset($this->search_structure)) {
+               if ( isset($this->search_structure) )
                        return $this->search_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->search_structure = '';
                        return false;
                }
@@ -1134,9 +1153,8 @@ class WP_Rewrite {
         * @return string|bool False if not found. Permalink structure string.
         */
        function get_page_permastruct() {
-               if (isset($this->page_structure)) {
+               if ( isset($this->page_structure) )
                        return $this->page_structure;
-               }
 
                if (empty($this->permalink_structure)) {
                        $this->page_structure = '';
@@ -1161,11 +1179,10 @@ class WP_Rewrite {
         * @return string|bool False if not found. Permalink structure string.
         */
        function get_feed_permastruct() {
-               if (isset($this->feed_structure)) {
+               if ( isset($this->feed_structure) )
                        return $this->feed_structure;
-               }
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) ) {
                        $this->feed_structure = '';
                        return false;
                }
@@ -1188,9 +1205,8 @@ class WP_Rewrite {
         * @return string|bool False if not found. Permalink structure string.
         */
        function get_comment_feed_permastruct() {
-               if (isset($this->comment_feed_structure)) {
+               if ( isset($this->comment_feed_structure) )
                        return $this->comment_feed_structure;
-               }
 
                if (empty($this->permalink_structure)) {
                        $this->comment_feed_structure = '';
@@ -1253,10 +1269,10 @@ class WP_Rewrite {
        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 ( (array) $this->feeds as $feed_name) {
+               foreach ( (array) $this->feeds as $feed_name)
                        $feedregex2 .= $feed_name . '|';
-               }
                $feedregex2 = '(' . trim($feedregex2, '|') .  ')/?$';
+
                //$feedregex is identical but with /feed/ added on as well, so URLs like <permalink>/feed/atom
                //and <permalink>/atom are both possible
                $feedregex = $this->feed_base  . '/' . $feedregex2;
@@ -1267,7 +1283,7 @@ class WP_Rewrite {
                $commentregex = 'comment-page-([0-9]{1,})/?$';
 
                //build up an array of endpoint regexes to append => queries to append
-               if ($endpoints) {
+               if ( $endpoints ) {
                        $ep_query_append = array ();
                        foreach ( (array) $this->endpoints as $endpoint) {
                                //match everything after the endpoint name, but allow for nothing to appear there
@@ -1290,12 +1306,11 @@ class WP_Rewrite {
                $trackbackindex = $index;
                //build a list from the rewritecode and queryreplace arrays, that will look something like
                //tagname=$matches[i] where i is the current $i
-               for ($i = 0; $i < $num_tokens; ++$i) {
-                       if (0 < $i) {
+               for ( $i = 0; $i < $num_tokens; ++$i ) {
+                       if ( 0 < $i )
                                $queries[$i] = $queries[$i - 1] . '&';
-                       } else {
+                       else
                                $queries[$i] = '';
-                       }
 
                        $query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1);
                        $queries[$i] .= $query_token;
@@ -1303,18 +1318,14 @@ class WP_Rewrite {
 
                //get the structure, minus any cruft (stuff that isn't tags) at the front
                $structure = $permalink_structure;
-               if ($front != '/') {
+               if ( $front != '/' )
                        $structure = str_replace($front, '', $structure);
-               }
+
                //create a list of dirs to walk over, making rewrite rules for each level
                //so for example, a $structure of /%year%/%month%/%postname% would create
                //rewrite rules for /%year%/, /%year%/%month%/ and /%year%/%month%/%postname%
                $structure = trim($structure, '/');
-               if ($walk_dirs) {
-                       $dirs = explode('/', $structure);
-               } else {
-                       $dirs[] = $structure;
-               }
+               $dirs = $walk_dirs ? explode('/', $structure) : array( $structure );
                $num_dirs = count($dirs);
 
                //strip slashes from the front of $front
@@ -1323,22 +1334,33 @@ class WP_Rewrite {
                //the main workhorse loop
                $post_rewrite = array();
                $struct = $front;
-               for ($j = 0; $j < $num_dirs; ++$j) {
+               for ( $j = 0; $j < $num_dirs; ++$j ) {
                        //get the struct for this dir, and trim slashes off the front
                        $struct .= $dirs[$j] . '/'; //accumulate. see comment near explode('/', $structure) above
                        $struct = ltrim($struct, '/');
+
                        //replace tags with regexes
                        $match = str_replace($this->rewritecode, $this->rewritereplace, $struct);
+
                        //make a list of tags, and store how many there are in $num_toks
                        $num_toks = preg_match_all('/%.+?%/', $struct, $toks);
+
                        //get the 'tagname=$matches[i]'
                        $query = ( isset($queries) && is_array($queries) ) ? $queries[$num_toks - 1] : '';
 
                        //set up $ep_mask_specific which is used to match more specific URL types
-                       switch ($dirs[$j]) {
-                               case '%year%': $ep_mask_specific = EP_YEAR; break;
-                               case '%monthnum%': $ep_mask_specific = EP_MONTH; break;
-                               case '%day%': $ep_mask_specific = EP_DAY; break;
+                       switch ( $dirs[$j] ) {
+                               case '%year%':
+                                       $ep_mask_specific = EP_YEAR;
+                                       break;
+                               case '%monthnum%':
+                                       $ep_mask_specific = EP_MONTH;
+                                       break;
+                               case '%day%':
+                                       $ep_mask_specific = EP_DAY;
+                                       break;
+                               default:
+                                       $ep_mask_specific = EP_NONE;
                        }
 
                        //create query for /page/xx
@@ -1364,36 +1386,35 @@ class WP_Rewrite {
                        $feedquery2 = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1);
 
                        //if asked to, turn the feed queries into comment feed ones
-                       if ($forcomments) {
+                       if ( $forcomments ) {
                                $feedquery .= '&withcomments=1';
                                $feedquery2 .= '&withcomments=1';
                        }
 
                        //start creating the array of rewrites for this dir
                        $rewrite = array();
-                       if ($feed) //...adding on /feed/ regexes => queries
+                       if ( $feed ) //...adding on /feed/ regexes => queries
                                $rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2);
-                       if ($paged) //...and /page/xx ones
+                       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 )
+                       if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask )
                                $rewrite = array_merge($rewrite, array($commentmatch => $commentquery));
                        else if ( EP_ROOT & $ep_mask && get_option('page_on_front') )
                                $rewrite = array_merge($rewrite, array($rootcommentmatch => $rootcommentquery));
 
                        //do endpoints
-                       if ($endpoints) {
+                       if ( $endpoints ) {
                                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) {
+                                       if ( $ep[0] & $ep_mask || $ep[0] & $ep_mask_specific )
                                                $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
-                                       }
                                }
                        }
 
                        //if we've got some tags in this dir
-                       if ($num_toks) {
+                       if ( $num_toks ) {
                                $post = false;
                                $page = false;
 
@@ -1401,24 +1422,36 @@ class WP_Rewrite {
                                //individual post. Do this by checking it contains at least one of 1) post name,
                                //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
                                //minute all present). Set these flags now as we need them for the endpoints.
-                               if (strpos($struct, '%postname%') !== false || strpos($struct, '%post_id%') !== false
+                               if ( strpos($struct, '%postname%') !== false
+                                               || strpos($struct, '%post_id%') !== false
                                                || strpos($struct, '%pagename%') !== false
-                                               || (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)) {
+                                               || (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)
+                                               ) {
                                        $post = true;
-                                       if (strpos($struct, '%pagename%') !== false)
+                                       if ( strpos($struct, '%pagename%') !== false )
                                                $page = true;
                                }
 
+                               if ( ! $post ) {
+                                       // For custom post types, we need to add on endpoints as well.
+                                       foreach ( get_post_types( array('_builtin' => false ) ) as $ptype ) {
+                                               if ( strpos($struct, "%$ptype%") !== false ) {
+                                                       $post = true;
+                                                       $page = is_post_type_hierarchical( $ptype ); // This is for page style attachment url's
+                                                       break;
+                                               }
+                                       }
+                               }
+
                                //if we're creating rules for a permalink, do all the endpoints like attachments etc
-                               if ($post) {
-                                       $post = true;
+                               if ( $post ) {
                                        //create query and regex for trackback
                                        $trackbackmatch = $match . $trackbackregex;
                                        $trackbackquery = $trackbackindex . '?' . $query . '&tb=1';
                                        //trim slashes from the end of the regex for this dir
                                        $match = rtrim($match, '/');
                                        //get rid of brackets
-                                       $submatchbase = str_replace(array('(',')'),'',$match);
+                                       $submatchbase = str_replace( array('(', ')'), '', $match);
 
                                        //add a rule for at attachments, which take the form of <permalink>/some-text
                                        $sub1 = $submatchbase . '/([^/]+)/';
@@ -1444,12 +1477,14 @@ class WP_Rewrite {
                                        $subcommentquery = $subquery . '&cpage=' . $this->preg_index(2);
 
                                        //do endpoints for attachments
-                                       if ( !empty($endpoints) ) { 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 ( !empty($endpoints) ) {
+                                               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);
+                                                       }
                                                }
-                                       } }
+                                       }
 
                                        //now we've finished with endpoints, finish off the $sub1 and $sub2 matches
                                        $sub1 .= '?$';
@@ -1470,7 +1505,7 @@ class WP_Rewrite {
                                $rewrite = array_merge($rewrite, array($match => $query));
 
                                //if we're matching a permalink, add those extras (attachments etc) on
-                               if ($post) {
+                               if ( $post ) {
                                        //add trackback
                                        $rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite);
 
@@ -1526,21 +1561,28 @@ class WP_Rewrite {
        function rewrite_rules() {
                $rewrite = array();
 
-               if (empty($this->permalink_structure)) {
+               if ( empty($this->permalink_structure) )
                        return $rewrite;
-               }
 
-               // robots.txt
-               $robots_rewrite = array('robots\.txt$' => $this->index . '?robots=1');
+               // robots.txt -only if installed at the root
+               $home_path = parse_url( home_url() );
+               $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
 
-               //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',
-                                                               '.*wp-rdf.php$' =>      $this->index .'?feed=rdf',
-                                                               '.*wp-rss.php$' =>      $this->index .'?feed=rss',
-                                                               '.*wp-rss2.php$'        =>      $this->index .'?feed=rss2',
-                                                               '.*wp-feed.php$'        =>      $this->index .'?feed=feed',
+               // 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',
+                                                               '.*wp-rdf.php$'         =>      $this->index . '?feed=rdf',
+                                                               '.*wp-rss.php$'         =>      $this->index . '?feed=rss',
+                                                               '.*wp-rss2.php$'        =>      $this->index . '?feed=rss2',
+                                                               '.*wp-feed.php$'        =>      $this->index . '?feed=feed',
                                                                '.*wp-commentsrss2.php$'        =>      $this->index . '?feed=rss2&withcomments=1');
 
+               // Registration rules
+               $registration_pages = array();
+               if ( is_multisite() && is_main_site() ) {
+                       $registration_pages['.*wp-signup.php$'] = $this->index . '?signup=true';
+                       $registration_pages['.*wp-activate.php$'] = $this->index . '?activate=true';
+               }
+
                // Post
                $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK);
                $post_rewrite = apply_filters('post_rewrite_rules', $post_rewrite);
@@ -1579,14 +1621,18 @@ class WP_Rewrite {
                $page_rewrite = apply_filters('page_rewrite_rules', $page_rewrite);
 
                // Extra permastructs
-               foreach ( $this->extra_permastructs as $permastruct )
-                       $this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct, EP_NONE));
+               foreach ( $this->extra_permastructs as $permastruct ) {
+                       if ( is_array($permastruct) )
+                               $this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct[0], $permastruct[1]));
+                       else
+                               $this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct, EP_NONE));
+               }
 
                // Put them together.
                if ( $this->use_verbose_page_rules )
-                       $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);
+                       $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);
                else
-                       $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
+                       $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
 
                do_action_ref_array('generate_rewrite_rules', array(&$this));
                $this->rules = apply_filters('rewrite_rules_array', $this->rules);
@@ -1634,25 +1680,23 @@ class WP_Rewrite {
         * @return string
         */
        function mod_rewrite_rules() {
-               if ( ! $this->using_permalinks()) {
+               if ( ! $this->using_permalinks() )
                        return '';
-               }
 
                $site_root = parse_url(get_option('siteurl'));
-               if ( isset( $site_root['path'] ) ) {
+               if ( isset( $site_root['path'] ) )
                        $site_root = trailingslashit($site_root['path']);
-               }
 
-               $home_root = parse_url(get_option('home'));
-               if ( isset( $home_root['path'] ) ) {
+               $home_root = parse_url(home_url());
+               if ( isset( $home_root['path'] ) )
                        $home_root = trailingslashit($home_root['path']);
-               } else {
+               else
                        $home_root = '/';
-               }
 
                $rules = "<IfModule mod_rewrite.c>\n";
                $rules .= "RewriteEngine On\n";
                $rules .= "RewriteBase $home_root\n";
+               $rules .= "RewriteRule ^index\.php$ - [L]\n"; // Prevent -f checks on index.php.
 
                //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
                foreach ( (array) $this->non_wp_rules as $match => $query) {
@@ -1661,14 +1705,14 @@ class WP_Rewrite {
 
                        // If the match is unanchored and greedy, prepend rewrite conditions
                        // to avoid infinite redirects and eclipsing of real files.
-                       if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
+                       //if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
                                //nada.
-                       }
+                       //}
 
                        $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
                }
 
-               if ($this->use_verbose_rules) {
+               if ( $this->use_verbose_rules ) {
                        $this->matches = '';
                        $rewrite = $this->rewrite_rules();
                        $num_rules = count($rewrite);
@@ -1682,15 +1726,14 @@ class WP_Rewrite {
 
                                // If the match is unanchored and greedy, prepend rewrite conditions
                                // to avoid infinite redirects and eclipsing of real files.
-                               if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
+                               //if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
                                        //nada.
-                               }
+                               //}
 
-                               if (strpos($query, $this->index) !== false) {
+                               if ( strpos($query, $this->index) !== false )
                                        $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
-                               } else {
+                               else
                                        $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n";
-                               }
                        }
                } else {
                        $rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" .
@@ -1717,36 +1760,92 @@ class WP_Rewrite {
         *
         * @return string
         */
-       function iis7_url_rewrite_rules($add_parent_tags = false, $indent = "  ", $end_of_line = "\n") {
+       function iis7_url_rewrite_rules( $add_parent_tags = false ) {
 
-               if ( ! $this->using_permalinks()) {
+               if ( ! $this->using_permalinks() )
                        return '';
-               }
-               
                $rules = '';
-               $extra_indent = '';
                if ( $add_parent_tags ) {
-                       $rules .= "<configuration>".$end_of_line;
-                       $rules .= $indent."<system.webServer>".$end_of_line;
-                       $rules .= $indent.$indent."<rewrite>".$end_of_line;
-                       $rules .= $indent.$indent.$indent."<rules>".$end_of_line;
-                       $extra_indent = $indent.$indent.$indent.$indent;
+                       $rules .= '<configuration>
+       <system.webServer>
+               <rewrite>
+                       <rules>';
+               }
+               if ( !is_multisite() ) {
+                       $rules .= '
+                               <rule name="wordpress" patternSyntax="Wildcard">
+                                       <match url="*" />
+                                               <conditions>
+                                                       <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
+                                                       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
+                                               </conditions>
+                                       <action type="Rewrite" url="index.php" />
+                               </rule>';
+               } else {
+                       if (is_subdomain_install()) {
+                               $rules .= '
+                               <rule name="wordpress - Rule 1" stopProcessing="true">
+                                       <match url="^index\.php$" ignoreCase="false" />
+                                       <action type="None" />
+                               </rule>
+                               <rule name="wordpress - Rule 2" stopProcessing="true">
+                                       <match url="^files/(.+)" ignoreCase="false" />
+                                       <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
+                               </rule>
+                               <rule name="wordpress - Rule 3" stopProcessing="true">
+                                       <match url="^" ignoreCase="false" />
+                                       <conditions logicalGrouping="MatchAny">
+                                               <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
+                                               <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
+                                       </conditions>
+                                       <action type="None" />
+                               </rule>
+                               <rule name="wordpress - Rule 4" stopProcessing="true">
+                                       <match url="." ignoreCase="false" />
+                                       <action type="Rewrite" url="index.php" />
+                               </rule>';
+                       } else {
+                               $rules .= '
+                               <rule name="wordpress - Rule 1" stopProcessing="true">
+                                       <match url="^index\.php$" ignoreCase="false" />
+                                       <action type="None" />
+                               </rule>
+                               <rule name="wordpress - Rule 2" stopProcessing="true">
+                                       <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
+                                       <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
+                               </rule>
+                               <rule name="wordpress - Rule 3" stopProcessing="true">
+                                       <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
+                                       <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
+                               </rule>
+                               <rule name="wordpress - Rule 4" stopProcessing="true">
+                                       <match url="^" ignoreCase="false" />
+                                       <conditions logicalGrouping="MatchAny">
+                                               <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
+                                               <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
+                                       </conditions>
+                                       <action type="None" />
+                               </rule>
+                               <rule name="wordpress - Rule 5" stopProcessing="true">
+                                       <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
+                                       <action type="Rewrite" url="{R:2}" />
+                               </rule>
+                               <rule name="wordpress - Rule 6" stopProcessing="true">
+                                       <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
+                                       <action type="Rewrite" url="{R:2}" />
+                               </rule>
+                               <rule name="wordpress - Rule 7" stopProcessing="true">
+                                       <match url="." ignoreCase="false" />
+                                       <action type="Rewrite" url="index.php" />
+                               </rule>';
+                       }
                }
-               
-               $rules .= $extra_indent."<rule name=\"wordpress\" patternSyntax=\"Wildcard\">".$end_of_line;
-               $rules .= $extra_indent.$indent."<match url=\"*\" />".$end_of_line;
-               $rules .= $extra_indent.$indent.$indent."<conditions>".$end_of_line;
-               $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />".$end_of_line;
-               $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />".$end_of_line;
-               $rules .= $extra_indent.$indent.$indent."</conditions>".$end_of_line;
-               $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line;
-               $rules .= $extra_indent."</rule>";
-               
                if ( $add_parent_tags ) {
-                       $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line;
-                       $rules .= $indent.$indent."</rewrite>".$end_of_line;
-                       $rules .= $indent."</system.webServer>".$end_of_line;
-                       $rules .= "</configuration>";
+                       $rules .= '
+                       </rules>
+               </rewrite>
+       </system.webServer>
+</configuration>';
                }
 
                $rules = apply_filters('iis7_url_rewrite_rules', $rules);
@@ -1771,7 +1870,7 @@ class WP_Rewrite {
                //get everything up to the first ?
                $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?'));
                $front = substr($redirect, 0, $index);
-               if ($front != $this->index) { //it doesn't redirect to WP's index.php
+               if ( $front != $this->index ) { //it doesn't redirect to WP's index.php
                        $this->add_external_rule($regex, $redirect);
                } else {
                        if ( 'bottom' == $after)
@@ -1827,10 +1926,10 @@ class WP_Rewrite {
         * @param string $struct Permalink structure.
         * @param bool $with_front Prepend front base to permalink structure.
         */
-       function add_permastruct($name, $struct, $with_front = true) {
+       function add_permastruct($name, $struct, $with_front = true, $ep_mask = EP_NONE) {
                if ( $with_front )
                        $struct = $this->front . $struct;
-               $this->extra_permastructs[$name] = $struct;
+               $this->extra_permastructs[$name] = array($struct, $ep_mask);
        }
 
        /**
@@ -1868,9 +1967,8 @@ class WP_Rewrite {
                $this->permalink_structure = get_option('permalink_structure');
                $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
                $this->root = '';
-               if ($this->using_index_permalinks()) {
+               if ( $this->using_index_permalinks() )
                        $this->root = $this->index . '/';
-               }
                $this->category_base = get_option( 'category_base' );
                $this->tag_base = get_option( 'tag_base' );
                unset($this->category_structure);
@@ -1880,7 +1978,7 @@ class WP_Rewrite {
                unset($this->search_structure);
                unset($this->feed_structure);
                unset($this->comment_feed_structure);
-               $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
+               $this->use_trailing_slashes = ( '/' == substr($this->permalink_structure, -1, 1) );
 
                // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
                if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) )
@@ -1905,7 +2003,7 @@ class WP_Rewrite {
         * @param string $permalink_structure Permalink structure.
         */
        function set_permalink_structure($permalink_structure) {
-               if ($permalink_structure != $this->permalink_structure) {
+               if ( $permalink_structure != $this->permalink_structure ) {
                        update_option('permalink_structure', $permalink_structure);
                        $this->init();
                        do_action('permalink_structure_changed', $this->permalink_structure, $permalink_structure);
@@ -1925,7 +2023,7 @@ class WP_Rewrite {
         * @param string $category_base Category permalink structure base.
         */
        function set_category_base($category_base) {
-               if ($category_base != $this->category_base) {
+               if ( $category_base != $this->category_base ) {
                        update_option('category_base', $category_base);
                        $this->init();
                }
index 3ccd75a9569c574ef2ce797dbebd85f16b225458..ea3269289fb7b7f0d66e4055ae3dddc6f0f0f964 100644 (file)
@@ -5,6 +5,6 @@
  * @package WordPress
  */
 
-_deprecated_file( basename(__FILE__), '0.0', 'rss.php' );
+_deprecated_file( basename(__FILE__), '2.1', WPINC . '/rss.php' );
 require_once (ABSPATH . WPINC . '/rss.php');
 ?>
index d48230ac6f5477eab405de2d0113b6df06a11d7f..6feefdcbda9a0a214ec8da359183e5c909209a20 100644 (file)
  * @subpackage MagpieRSS
  */
 
+/**
+ * Deprecated. Use SimplePie (class-simplepie.php) instead.
+ */
+_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/class-simplepie.php' );
+
 /*
  * Hook to use another RSS object instead of MagpieRSS
  */
@@ -62,7 +67,7 @@ class MagpieRSS {
                $this->parser = $parser;
 
                # pass in parser, and a reference to this object
-               # setup handlers
+               # set up handlers
                #
                xml_set_object( $this->parser, $this );
                xml_set_element_handler($this->parser,
@@ -456,7 +461,7 @@ function fetch_rss ($url) {
 
                // else attempt a conditional get
 
-               // setup headers
+               // set up headers
                if ( $cache_status == 'STALE' ) {
                        $rss = $cache->get( $url );
                        if ( isset($rss->etag) and $rss->last_modified ) {
@@ -535,7 +540,7 @@ endif;
  * @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 = "" ) {
        $resp = wp_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT));
        if ( is_wp_error($resp) ) {
                $error = array_shift($resp->errors);
@@ -546,10 +551,23 @@ function _fetch_remote_file ($url, $headers = "" ) {
                $resp->error = $error[0] . "\n"; //\n = Snoopy compatibility
                return $resp;
        }
+
+       // Snoopy returns headers unprocessed.
+       // Also note, WP_HTTP lowercases all keys, Snoopy did not.
+       $return_headers = array();
+       foreach ( $resp['headers'] as $key => $value ) {
+               if ( !is_array($value) ) {
+                       $return_headers[] = "$key: $value";
+               } else {
+                       foreach ( $value as $v )
+                               $return_headers[] = "$key: $v";
+               }
+       }
+
        $response = new stdClass;
        $response->status = $resp['response']['code'];
        $response->response_code = $resp['response']['code'];
-       $response->headers = $resp['headers'];
+       $response->headers = $return_headers;
        $response->results = $resp['body'];
 
        return $response;
@@ -582,11 +600,11 @@ function _response_to_rss ($resp) {
                                $val = "";
                        }
 
-                       if ( $field == 'ETag' ) {
+                       if ( $field == 'etag' ) {
                                $rss->etag = $val;
                        }
 
-                       if ( $field == 'Last-Modified' ) {
+                       if ( $field == 'last-modified' ) {
                                $rss->last_modified = $val;
                        }
                }
@@ -606,7 +624,7 @@ function _response_to_rss ($resp) {
 }
 
 /**
- * Setup constants with default values, unless user overrides.
+ * Set up constants with default values, unless user overrides.
  *
  * @since unknown
  * @package External
@@ -710,7 +728,6 @@ class RSSCache {
        Output:         true on sucess
 \*=======================================================================*/
        function set ($url, $rss) {
-               global $wpdb;
                $cache_option = 'rss_' . $this->file_name( $url );
 
                set_transient($cache_option, $rss, $this->MAX_AGE);
index f629585fda4837aca93b763923d4013f40bb6384..fcd8f55cff8230bad5a632cefedb2f47181d029f 100644 (file)
@@ -8,8 +8,7 @@
  * file.
  *
  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
- * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and disables compression and concatenation,
- * define('STYLE_DEBUG', true); loads the development (non-minified) versions of all CSS and disables compression and concatenation,
+ * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
  * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
  * define('COMPRESS_CSS', false); disables compression of CSS,
@@ -38,7 +37,7 @@ require( ABSPATH . WPINC . '/class.wp-styles.php' );
 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
 
 /**
- * Setup WordPress scripts to load by default for Administration Panels.
+ * Set up WordPress scripts to load by default for Administration Panels.
  *
  * Localizes a few of the scripts.
  * $scripts->add_data( 'script-handle', 'group', 1 ); queues the script for the footer
@@ -61,7 +60,7 @@ function wp_default_scripts( &$scripts ) {
 
        $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
 
-       $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20091212' );
+       $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20100531' );
        $scripts->add_data( 'common', 'group', 1 );
        $scripts->localize( 'common', 'commonL10n', array(
                'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
@@ -89,7 +88,7 @@ function wp_default_scripts( &$scripts ) {
 
        $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20091124' );
 
-       $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
+       $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
 
        $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20091119' );
        $scripts->add_data( 'wp-ajax-response', 'group', 1 );
@@ -99,48 +98,48 @@ function wp_default_scripts( &$scripts ) {
                'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
        ) );
 
-       $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20091012' );
+       $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20100410' );
        $scripts->add_data( 'autosave', 'group', 1 );
 
        $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091128' );
        $scripts->add_data( 'wp-lists', 'group', 1 );
 
-       $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-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
-       $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
-       $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
-       $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
+       $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3');
+       $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.3');
+       $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.3');
+       $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.3');
+       $scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.3');
+       $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.3' );
+       $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.3');
+       $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.3');
 
        // not used in core, replaced by Jcrop.js
        $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
 
-       $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
+       $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.4.2');
 
-       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.1' );
+       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-core', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-tabs', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-sortable', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-draggable', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-droppable', '/wp-includes/js/jquery/ui.droppable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-droppable', '/wp-includes/js/jquery/ui.droppable.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-droppable', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-selectable', '/wp-includes/js/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-selectable', '/wp-includes/js/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-selectable', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-resizable', 'group', 1 );
 
-       $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' );
+       $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.3' );
        $scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
 
        // deprecated, not used in core, most functionality is included in jQuery 1.3
@@ -150,9 +149,6 @@ function wp_default_scripts( &$scripts ) {
        $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
        $scripts->add_data( 'jquery-color', 'group', 1 );
 
-       // deprecated, not used in core
-       $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
-
        $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125');
        $scripts->add_data( 'suggest', 'group', 1 );
 
@@ -165,7 +161,7 @@ function wp_default_scripts( &$scripts ) {
        $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
        $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
 
-       $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20091124');
+       $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20100407');
        $scripts->add_data( 'thickbox', 'group', 1 );
        $scripts->localize( 'thickbox', 'thickboxL10n', array(
                        'next' => __('Next &gt;'),
@@ -173,13 +169,14 @@ function wp_default_scripts( &$scripts ) {
                        'image' => __('Image'),
                        'of' => __('of'),
                        'close' => __('Close'),
+                       'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
                        'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};'
        ) );
-       
+
 
        $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8');
 
-       $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.1');
+       $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.2');
 
        $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201');
        $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201');
@@ -193,14 +190,14 @@ function wp_default_scripts( &$scripts ) {
                $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
        }
 
-       $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20091208');
+       $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20100523');
        $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post;
        if ( empty($max_upload_size) )
                $max_upload_size = __('not configured');
        // 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.'),
-                       'file_exceeds_size_limit' => sprintf( __('This file is too big. The maximum upload size for your server is %s.'), $max_upload_size ),
+                       'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'),
                        'zero_byte_file' => __('This file is empty. Please try another.'),
                        'invalid_filetype' => __('This file type is not allowed. Please try another.'),
                        'default_error' => __('An error occurred in the upload. Please try again later.'),
@@ -210,12 +207,13 @@ function wp_default_scripts( &$scripts ) {
                        'upload_failed' => __('Upload failed.'),
                        'io_error' => __('IO error.'),
                        'security_error' => __('Security error.'),
-                       'file_cancelled' => __('File cancelled.'),
+                       'file_cancelled' => __('File canceled.'),
                        'upload_stopped' => __('Upload stopped.'),
                        'dismiss' => __('Dismiss'),
                        'crunching' => __('Crunching&hellip;'),
                        'deleted' => __('moved to the trash.'),
-                       'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
+                       'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};',
+                       'error_uploading' => __('&#8220;%s&#8221; has failed to upload due to an error')
        ) );
 
        $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
@@ -237,7 +235,7 @@ function wp_default_scripts( &$scripts ) {
                $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20091201' );
                $scripts->add_data( 'admin-categories', 'group', 1 );
 
-               $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery'), '20090623' );
+               $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), '20100213' );
                $scripts->add_data( 'admin-tags', 'group', 1 );
                $scripts->localize( 'admin-tags', 'tagsl10n', array(
                        'noPerm' => __('You do not have permission to do that.'),
@@ -248,7 +246,7 @@ function wp_default_scripts( &$scripts ) {
                $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
                $scripts->add_data( 'admin-custom-fields', 'group', 1 );
 
-               $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' );
+               $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20100331' );
                $scripts->add_data( 'password-strength-meter', 'group', 1 );
                $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
                        'empty' => __('Strength indicator'),
@@ -257,25 +255,27 @@ function wp_default_scripts( &$scripts ) {
                        /* translators: password strength */
                        'good' => _x('Medium', 'password strength'),
                        'strong' => __('Strong'),
+                       'mismatch' => __('Mismatch'),
                        'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
+               $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20100301' );
                $scripts->add_data( 'user-profile', 'group', 1 );
 
-               $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091129' );
+               $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20100418' );
                $scripts->add_data( 'admin-comments', 'group', 1 );
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
                        'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
                ) );
 
-               $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
+               $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20100403' );
+               $scripts->add_data( 'xfn', 'group', 1 );
 
                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
                $scripts->add_data( 'postbox', 'group', 1 );
 
-               $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20091208' );
+               $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20100526' );
                $scripts->add_data( 'post', 'group', 1 );
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
@@ -305,7 +305,7 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090506' );
+               $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090526' );
                $scripts->add_data( 'link', 'group', 1 );
 
                $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20091202' );
@@ -332,14 +332,7 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
                ));
 
-               $scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090717' );
-               $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
-                       'updateCompleted' => __('Update completed.'),
-                       'error' => __('Error:'),
-                       'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
-               ));
-
-               $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' );
+               $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' );
                $scripts->add_data( 'theme-preview', 'group', 1 );
 
                $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20091202' );
@@ -358,39 +351,49 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery' ), '20090520' );
+               $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), '20100407' );
                $scripts->add_data( 'plugin-install', 'group', 1 );
                $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
                        'plugin_information' => __('Plugin Information:'),
+                       'ays' => __('Are you sure you want to install this plugin?'),
                        '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$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090618' );
+               $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20100523' );
                $scripts->add_data( 'dashboard', 'group', 1 );
 
                $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );
                $scripts->add_data( 'hoverIntent', 'group', 1 );
 
-               $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' );
-               $scripts->add_data( 'media', 'group', 1 );
+               $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js", null, '20091223' );
 
-               $scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
-               $scripts->add_data( 'codepress', 'group', 1 );
+               $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20100524' );
+               $scripts->add_data( 'media', 'group', 1 );
 
                $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20091111' );
                $scripts->add_data( 'image-edit', 'group', 1 );
 
-               $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091210b' );
+               $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20100518' );
                $scripts->add_data( 'set-post-thumbnail', 'group', 1 );
                $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
-                       'setThumbnail' => __( 'Use as thumbnail' ),
+                       'setThumbnail' => __( 'Use as featured image' ),
                        'saving' => __( 'Saving...' ),
                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
                        'done' => __( 'Done' )
                ) );
 
+               // Navigation Menus
+               $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100611' );
+               $scripts->localize( 'nav-menu', 'navMenuL10n', array(
+                       'noResultsFound' => _x('No results found.', 'search results'),
+                       'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
+                       'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
+               ) );
+
+               $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('farbtastic'), '20100531' );
+               $scripts->add_data( 'custom-background', 'group', 1 );
        }
 }
 
@@ -418,48 +421,52 @@ function wp_default_styles( &$styles ) {
        $styles->base_url = $guessurl;
        $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
        $styles->default_version = get_bloginfo( 'version' );
-       $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
+       $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
        $styles->default_dirs = array('/wp-admin/');
 
-       $suffix = defined('STYLE_DEBUG') && STYLE_DEBUG ? '.dev' : '';
-
-       $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
+       $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
 
-       // all colors stylesheets need to have the same query strings (cache manifest compat)
-       $colors_version = '20091217';
+       $rtl_styles = array( 'wp-admin', 'global', 'colors', 'colors-fresh', 'colors-classic', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'nav-menu', 'farbtastic' );
+       // Any rtl stylesheets that don't have a .dev version for ltr
+       $no_suffix = array( 'farbtastic' );
 
-       $styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20091221' );
-       $styles->add_data( 'wp-admin', 'rtl', "/wp-admin/rtl$suffix.css" );
+       $styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20100614' );
 
-       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20091217' );
+       $styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20100610' );
        $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
 
+       // all colors stylesheets need to have the same query strings (cache manifest compat)
+       $colors_version = '20100610';
+
        // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
        $styles->add( 'colors', true, array(), $colors_version );
 
        // do not refer to these directly, the right one is queued by the above "meta" colors handle
-       $styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version);
-       $styles->add_data( 'colors-fresh', 'rtl', true );
-       $styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version);
-       $styles->add_data( 'colors-classic', 'rtl', true );
-
-       $styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20091228' );
-       $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20091029' );
-       $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20091118' );
-       $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20091211' );
-       $styles->add( 'install', "/wp-admin/css/install$suffix.css", array(), '20090514' );
-       $styles->add( 'theme-editor', "/wp-admin/css/theme-editor$suffix.css", array(), '20090625' );
-       $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20091022' );
+       $styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version );
+       $styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version );
+
+       $styles->add( 'ms', "/wp-admin/css/ms$suffix.css", array(), '20100528' );
+       $styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20100108' );
+       $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20100519' );
+       $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20100610' );
+       $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20100424' );
+       $styles->add( 'install', "/wp-admin/css/install$suffix.css", array(), '20100605' ); // Readme as well
+       $styles->add( 'theme-editor', "/wp-admin/css/theme-editor$suffix.css", array(), '20100514' );
+       $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20100424' );
        $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
-       $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20091010' );
-       $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20090514' );
-       $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20090610' );
+       $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20100601' );
+       $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100402' );
+       $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20100523' );
        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
        $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
        $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
+       $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100611' );
 
-       foreach ( $rtl_styles as $rtl_style )
+       foreach ( $rtl_styles as $rtl_style ) {
                $styles->add_data( $rtl_style, 'rtl', true );
+               if ( $suffix && ! in_array( $rtl_style, $no_suffix ) )
+                       $styles->add_data( $rtl_style, 'suffix', $suffix );
+       }
 }
 
 /**
@@ -488,7 +495,7 @@ function wp_prototype_before_jquery( $js_array ) {
 }
 
 /**
- * Load localized script just in time for MCE.
+ * Load localized data on print rather than initialization.
  *
  * These localizations require information that may not be loaded even by init.
  *
@@ -505,6 +512,7 @@ function wp_just_in_time_script_localization() {
                'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
                'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
        ) );
+
 }
 
 /**
@@ -542,7 +550,7 @@ function wp_style_loader_src( $src, $handle ) {
                $parsed = parse_url( $src );
                $url = $color->url;
 
-               if ( defined('STYLE_DEBUG') && STYLE_DEBUG )
+               if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG )
                        $url = preg_replace('/.css$|.css(?=\?)/', '.dev.css', $url);
 
                if ( isset($parsed['query']) && $parsed['query'] ) {
index bad91c14ba56654032a917ef61eb4882685b759d..f2048bda63eeeeb208094eb57951c54ee73cb4db 100644 (file)
@@ -190,23 +190,23 @@ function get_shortcode_regex() {
  * @param array $m Regular expression match array
  * @return mixed False on failure.
  */
-function do_shortcode_tag($m) {
+function do_shortcode_tag( $m ) {
        global $shortcode_tags;
 
        // allow [[foo]] syntax for escaping a tag
-       if ($m[1] == '[' && $m[6] == ']') {
+       if ( $m[1] == '[' && $m[6] == ']' ) {
                return substr($m[0], 1, -1);
        }
 
        $tag = $m[2];
-       $attr = shortcode_parse_atts($m[3]);
+       $attr = shortcode_parse_atts( $m[3] );
 
-       if ( isset($m[5]) ) {
+       if ( isset( $m[5] ) ) {
                // enclosing tag - extra parameter
-               return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $m[2]) . $m[6];
+               return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6];
        } else {
                // self-closing tag
-               return $m[1] . call_user_func($shortcode_tags[$tag], $attr, NULL, $m[2]) . $m[6];
+               return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, NULL,  $tag ) . $m[6];
        }
 }
 
index 98282027f3b2462d7415d36d8520d5f39bff6243..69f9c28639f9bfeb98d84a6ea134ca69fe695644 100644 (file)
  * Creates the initial taxonomies when 'init' action is fired.
  */
 function create_initial_taxonomies() {
-       register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
-       register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'), 'query_var' => false, 'rewrite' => false) ) ;
-       register_taxonomy( 'link_category', 'link', array('hierarchical' => false, 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
+       register_taxonomy( 'category', 'post', array(
+               'hierarchical' => true,
+               'update_count_callback' => '_update_post_term_count',
+               'query_var' => false,
+               'rewrite' => false,
+               'public' => true,
+               'show_ui' => true,
+               '_builtin' => true,
+       ) ) ;
+
+       register_taxonomy( 'post_tag', 'post', array(
+               'hierarchical' => false,
+               'update_count_callback' => '_update_post_term_count',
+               'query_var' => false,
+               'rewrite' => false,
+               'public' => true,
+               'show_ui' => true,
+               '_builtin' => true,
+       ) );
+
+       register_taxonomy( 'nav_menu', 'nav_menu_item', array(
+               'hierarchical' => false,
+               'labels' => array(
+                       'name' => __( 'Navigation Menus' ),
+                       'singular_name' => __( 'Navigation Menu' ),
+               ),
+               'query_var' => false,
+               'rewrite' => false,
+               'show_ui' => false,
+               '_builtin' => true,
+               'show_in_nav_menus' => false,
+       ) ) ;
+
+       register_taxonomy( 'link_category', 'link', array(
+               'hierarchical' => false,
+               'labels' => array(
+                       'name' => __( 'Categories' ),
+                       'singular_name' => __( 'Category' ),
+                       'update_item' => __( 'Update Category' ),
+               ),
+               'query_var' => false,
+               'rewrite' => false,
+               'public' => false,
+               'show_ui' => false,
+               '_builtin' => true,
+       ) ) ;
 }
 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
 
+/**
+ * Get a list of registered taxonomy objects.
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 3.0.0
+ * @uses $wp_taxonomies
+ * @see register_taxonomy
+ *
+ * @param array $args An array of key => value arguments to match against the taxonomy objects.
+ * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
+ * @param string $operator The logical operation to perform. 'or' means only one element
+ *  from the array needs to match; 'and' means all elements must match. The default is 'and'.
+ * @return array A list of taxonomy names or objects
+ */
+function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
+       global $wp_taxonomies;
+
+       $field = ('names' == $output) ? 'name' : false;
+
+       return wp_filter_object_list($wp_taxonomies, $args, $operator, $field);
+}
+
+
 /**
  * Return all of the taxonomy names that are of $object_type.
  *
@@ -37,9 +104,10 @@ add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
  * @uses $wp_taxonomies
  *
  * @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts)
+ * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
  * @return array The names of all taxonomy of $object_type.
  */
-function get_object_taxonomies($object) {
+function get_object_taxonomies($object, $output = 'names') {
        global $wp_taxonomies;
 
        if ( is_object($object) ) {
@@ -51,9 +119,13 @@ function get_object_taxonomies($object) {
        $object = (array) $object;
 
        $taxonomies = array();
-       foreach ( (array) $wp_taxonomies as $taxonomy ) {
-               if ( array_intersect($object, (array) $taxonomy->object_type) )
-                       $taxonomies[] = $taxonomy->name;
+       foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) {
+               if ( array_intersect($object, (array) $tax_obj->object_type) ) {
+                       if ( 'names' == $output )
+                               $taxonomies[] = $tax_name;
+                       else
+                               $taxonomies[ $tax_name ] = $tax_obj;
+               }
        }
 
        return $taxonomies;
@@ -70,7 +142,7 @@ function get_object_taxonomies($object) {
  * @since 2.3.0
  *
  * @uses $wp_taxonomies
- * @uses is_taxonomy() Checks whether taxonomy exists
+ * @uses taxonomy_exists() Checks whether taxonomy exists
  *
  * @param string $taxonomy Name of taxonomy object to return
  * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist
@@ -78,7 +150,7 @@ function get_object_taxonomies($object) {
 function get_taxonomy( $taxonomy ) {
        global $wp_taxonomies;
 
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists( $taxonomy ) )
                return false;
 
        return $wp_taxonomies[$taxonomy];
@@ -87,19 +159,21 @@ function get_taxonomy( $taxonomy ) {
 /**
  * Checks that the taxonomy name exists.
  *
+ * Formerly is_taxonomy(), introduced in 2.3.0.
+ *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3.0
+ * @since 3.0.0
  *
  * @uses $wp_taxonomies
  *
  * @param string $taxonomy Name of taxonomy object
- * @return bool Whether the taxonomy exists or not.
+ * @return bool Whether the taxonomy exists.
  */
-function is_taxonomy( $taxonomy ) {
+function taxonomy_exists( $taxonomy ) {
        global $wp_taxonomies;
 
-       return isset($wp_taxonomies[$taxonomy]);
+       return isset( $wp_taxonomies[$taxonomy] );
 }
 
 /**
@@ -114,14 +188,14 @@ function is_taxonomy( $taxonomy ) {
  * @subpackage Taxonomy
  * @since 2.3.0
  *
- * @uses is_taxonomy() Checks whether taxonomy exists
+ * @uses taxonomy_exists() Checks whether taxonomy exists
  * @uses get_taxonomy() Used to get the taxonomy object
  *
  * @param string $taxonomy Name of taxonomy object
  * @return bool Whether the taxonomy is hierarchical
  */
 function is_taxonomy_hierarchical($taxonomy) {
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return false;
 
        $taxonomy = get_taxonomy($taxonomy);
@@ -136,12 +210,14 @@ function is_taxonomy_hierarchical($taxonomy) {
  * parameter), along with strings for the taxonomy name and another string for
  * the object type.
  *
- * Nothing is returned, so expect error maybe or use is_taxonomy() to check
+ * Nothing is returned, so expect error maybe or use taxonomy_exists() to check
  * whether taxonomy exists.
  *
  * Optional $args contents:
  *
- * hierarachical - has some defined purpose at other parts of the API and is a
+ * label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used.
+ *
+ * hierarchical - has some defined purpose at other parts of the API and is a
  * boolean value.
  *
  * update_count_callback - works much like a hook, in that it will be called
@@ -153,6 +229,20 @@ function is_taxonomy_hierarchical($taxonomy) {
  * query_var - false to prevent queries, or string to customize query var
  * (?$query_var=$term); default will use $taxonomy as query var.
  *
+ * public - If the taxonomy should be publically queryable; //@TODO not implemented.
+ * defaults to true.
+ *
+ * show_ui - If the WordPress UI admin tags UI should apply to this taxonomy;
+ * defaults to public.
+ *
+ * show_in_nav_menus - true makes this taxonomy available for selection in navigation menus.
+ * Defaults to public.
+ *
+ * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget;
+ * defaults to show_ui which defalts to public.
+ *
+ * labels - An array of labels for this taxonomy. You can see accepted values in {@link get_taxonomy_labels()}. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.
+ *
  * @package WordPress
  * @subpackage Taxonomy
  * @since 2.3.0
@@ -167,10 +257,21 @@ function is_taxonomy_hierarchical($taxonomy) {
 function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
        global $wp_taxonomies, $wp_rewrite, $wp;
 
-       if (!is_array($wp_taxonomies))
+       if ( ! is_array($wp_taxonomies) )
                $wp_taxonomies = array();
 
-       $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
+       $defaults = array(      'hierarchical' => false,
+                                               'update_count_callback' => '',
+                                               'rewrite' => true,
+                                               'query_var' => $taxonomy,
+                                               'public' => true,
+                                               'show_ui' => null,
+                                               'show_tagcloud' => null,
+                                               '_builtin' => false,
+                                               'labels' => array(),
+                                               'capabilities' => array(),
+                                               'show_in_nav_menus' => null,
+                                       );
        $args = wp_parse_args($args, $defaults);
 
        if ( false !== $args['query_var'] && !empty($wp) ) {
@@ -180,18 +281,120 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
                $wp->add_query_var($args['query_var']);
        }
 
-       if ( false !== $args['rewrite'] && !empty($wp_rewrite) ) {
-               if ( !is_array($args['rewrite']) )
-                       $args['rewrite'] = array();
-               if ( !isset($args['rewrite']['slug']) )
-                       $args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy);
-               $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term");
-               $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%");
+       if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
+               $args['rewrite'] = wp_parse_args($args['rewrite'], array(
+                       'slug' => sanitize_title_with_dashes($taxonomy),
+                       'with_front' => true,
+               ));
+               $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
+               $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
        }
 
+       if ( is_null($args['show_ui']) )
+               $args['show_ui'] = $args['public'];
+
+       // Whether to show this type in nav-menus.php. Defaults to the setting for public.
+       if ( null === $args['show_in_nav_menus'] )
+               $args['show_in_nav_menus'] = $args['public'];
+
+       if ( is_null($args['show_tagcloud']) )
+               $args['show_tagcloud'] = $args['show_ui'];
+
+       $default_caps = array(
+               'manage_terms' => 'manage_categories',
+               'edit_terms'   => 'manage_categories',
+               'delete_terms' => 'manage_categories',
+               'assign_terms' => 'edit_posts',
+       );
+       $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] );
+       unset( $args['capabilities'] );
+
        $args['name'] = $taxonomy;
-       $args['object_type'] = $object_type;
+       $args['object_type'] = (array) $object_type;
+
+       $args['labels'] = get_taxonomy_labels( (object) $args );
+       $args['label'] = $args['labels']->name;
+
        $wp_taxonomies[$taxonomy] = (object) $args;
+
+       // register callback handling for metabox
+       add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_hierarchical_term');
+}
+
+/**
+ * Builds an object with all taxonomy labels out of a taxonomy object
+ *
+ * Accepted keys of the label array in the taxonomy object:
+ * - name - general name for the taxonomy, usually plural. The same as and overriden by $tax->label. Default is Post Tags/Categories
+ * - singular_name - name for one object of this taxonomy. Default is Post Tag/Category
+ * - search_items - Default is Search Tags/Search Categories
+ * - popular_items - This string isn't used on hierarchical taxonomies. Default is Popular Tags
+ * - all_items - Default is All Tags/All Categories
+ * - parent_item - This string isn't used on non-hierarchical taxonomies. In hierarchical ones the default is Parent Category
+ * - parent_item_colon - The same as <code>parent_item</code>, but with colon <code>:</code> in the end
+ * - edit_item - Default is Edit Tag/Edit Category
+ * - update_item - Default is Update Tag/Update Category
+ * - add_new_item - Default is Add New Tag/Add New Category
+ * - new_item_name - Default is New Tag Name/New Category Name
+ * - separate_items_with_commas - This string isn't used on hierarchical taxonomies. Default is "Separate tags with commas," used in the meta box.
+ * - add_or_remove_items - This string isn't used on hierarchical taxonomies. Default is "Add or remove tags," used in the meta box when JavaScript is disabled.
+ * - choose_from_most_used - This string isn't used on hierarchical taxonomies. Default is "Choose from the most used tags," used in the meta box.
+ *
+ * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories.)
+ *
+ * @since 3.0.0
+ * @param object $tax Taxonomy object
+ * @return object object with all the labels as member variables
+ */
+
+function get_taxonomy_labels( $tax ) {
+       if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) )
+               $tax->labels['separate_items_with_commas'] = $tax->helps;
+
+       $nohier_vs_hier_defaults = array(
+               'name' => array( _x( 'Post Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
+               'singular_name' => array( _x( 'Post Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
+               'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
+               'popular_items' => array( __( 'Popular Tags' ), null ),
+               'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ),
+               'parent_item' => array( null, __( 'Parent Category' ) ),
+               'parent_item_colon' => array( null, __( 'Parent Category:' ) ),
+               'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
+               'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ),
+               'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
+               'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
+               'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
+               'add_or_remove_items' => array( __( 'Add or remove tags' ), null ),
+               'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ),
+       );
+
+       return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
+}
+
+/**
+ * Add an already registered taxonomy to an object type.
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 3.0.0
+ * @uses $wp_taxonomies Modifies taxonomy object
+ *
+ * @param string $taxonomy Name of taxonomy object
+ * @param array|string $object_type Name of the object type
+ * @return bool True if successful, false if not
+ */
+function register_taxonomy_for_object_type( $taxonomy, $object_type) {
+       global $wp_taxonomies;
+
+       if ( !isset($wp_taxonomies[$taxonomy]) )
+               return false;
+
+       if ( ! get_post_type_object($object_type) )
+               return false;
+
+       $wp_taxonomies[$taxonomy]->object_type[] = $object_type;
+
+       return true;
 }
 
 //
@@ -220,38 +423,38 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
  * @uses $wpdb
  * @uses wp_parse_args() Creates an array from string $args.
  *
- * @param string|array $terms String of term or array of string values of terms that will be used
+ * @param int|array $term_ids Term id or array of term ids of terms that will be used
  * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
  * @param array|string $args Change the order of the object_ids, either ASC or DESC
  * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
  *     the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
  */
-function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
+function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
        global $wpdb;
 
-       if ( !is_array( $terms) )
-               $terms = array($terms);
+       if ( ! is_array( $term_ids ) )
+               $term_ids = array( $term_ids );
 
-       if ( !is_array($taxonomies) )
-               $taxonomies = array($taxonomies);
+       if ( ! is_array( $taxonomies ) )
+               $taxonomies = array( $taxonomies );
 
        foreach ( (array) $taxonomies as $taxonomy ) {
-               if ( ! is_taxonomy($taxonomy) )
-                       return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+               if ( ! taxonomy_exists( $taxonomy ) )
+                       return new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy' ) );
        }
 
-       $defaults = array('order' => 'ASC');
+       $defaults = array( 'order' => 'ASC' );
        $args = wp_parse_args( $args, $defaults );
-       extract($args, EXTR_SKIP);
+       extract( $args, EXTR_SKIP );
 
-       $order = ( 'desc' == strtolower($order) ) ? 'DESC' : 'ASC';
+       $order = ( 'desc' == strtolower( $order ) ) ? 'DESC' : 'ASC';
 
-       $terms = array_map('intval', $terms);
+       $term_ids = array_map('intval', $term_ids );
 
-       $taxonomies = "'" . implode("', '", $taxonomies) . "'";
-       $terms = "'" . implode("', '", $terms) . "'";
+       $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
+       $term_ids = "'" . implode( "', '", $term_ids ) . "'";
 
-       $object_ids = $wpdb->get_col("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 IN ($taxonomies) AND tt.term_id IN ($terms) ORDER BY tr.object_id $order");
+       $object_ids = $wpdb->get_col("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 IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order");
 
        if ( ! $object_ids )
                return array();
@@ -308,7 +511,7 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
                return $error;
        }
 
-       if ( ! is_taxonomy($taxonomy) ) {
+       if ( ! taxonomy_exists($taxonomy) ) {
                $error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
                return $error;
        }
@@ -375,7 +578,7 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
 function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
 
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return false;
 
        if ( 'slug' == $field ) {
@@ -388,8 +591,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
                $value = stripslashes($value);
                $field = 't.name';
        } else {
-               $field = 't.term_id';
-               $value = (int) $value;
+               return get_term( (int) $value, $taxonomy, $output, $filter);
        }
 
        $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 $field = %s LIMIT 1", $taxonomy, $value) );
@@ -398,6 +600,8 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
 
        wp_cache_add($term->term_id, $term, $taxonomy);
 
+       $term = apply_filters('get_term', $term, $taxonomy);
+       $term = apply_filters("get_$taxonomy", $term, $taxonomy);
        $term = sanitize_term($term, $taxonomy, $filter);
 
        if ( $output == OBJECT ) {
@@ -432,7 +636,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
  * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
  */
 function get_term_children( $term_id, $taxonomy ) {
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
 
        $term_id = intval( $term_id );
@@ -530,7 +734,7 @@ function get_term_to_edit( $id, $taxonomy ) {
  *
  * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
  * along with the $args array.
-
+ *
  * The 'get_terms_fields' filter passes the fields for the SELECT query
  * along with the $args array.
  *
@@ -545,18 +749,19 @@ function get_term_to_edit( $id, $taxonomy ) {
  * 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
+ * exclude - Default is an empty array.  An array, 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.
+ * exclude_tree - Default is an empty array.  An array, 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
+ * include - Default is an empty array.  An array, 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.
+ * number - The maximum number of terms to return.  Default is to return them all.
  *
  * offset - The number by which to offset the terms query.
  *
@@ -616,7 +821,7 @@ function &get_terms($taxonomies, $args = '') {
        }
 
        foreach ( (array) $taxonomies as $taxonomy ) {
-               if ( ! is_taxonomy($taxonomy) ) {
+               if ( ! taxonomy_exists($taxonomy) ) {
                        $error = & new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
                        return $error;
                }
@@ -625,7 +830,7 @@ function &get_terms($taxonomies, $args = '') {
        $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
 
        $defaults = array('orderby' => 'name', 'order' => 'ASC',
-               'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
+               'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(),
                'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
                'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
                'pad_counts' => false, 'offset' => '', 'search' => '');
@@ -683,24 +888,29 @@ function &get_terms($taxonomies, $args = '') {
                $orderby = 't.slug';
        else if ( 'term_group' == $_orderby )
                $orderby = 't.term_group';
+       else if ( 'none' == $_orderby )
+               $orderby = '';
        elseif ( empty($_orderby) || 'id' == $_orderby )
                $orderby = 't.term_id';
 
        $orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
 
+       if ( !empty($orderby) )
+               $orderby = "ORDER BY $orderby";
+       else
+               $order = '';
+
        $where = '';
        $inclusions = '';
        if ( !empty($include) ) {
                $exclude = '';
                $exclude_tree = '';
-               $interms = preg_split('/[\s,]+/',$include);
-               if ( count($interms) ) {
-                       foreach ( (array) $interms as $interm ) {
-                               if (empty($inclusions))
-                                       $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
-                               else
-                                       $inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
-                       }
+               $interms = wp_parse_id_list($include);
+               foreach ( $interms as $interm ) {
+                       if ( empty($inclusions) )
+                               $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
+                       else
+                               $inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
                }
        }
 
@@ -709,29 +919,27 @@ function &get_terms($taxonomies, $args = '') {
        $where .= $inclusions;
 
        $exclusions = '';
-       if ( ! empty( $exclude_tree ) ) {
-               $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
-               foreach( (array) $excluded_trunks as $extrunk ) {
+       if ( !empty( $exclude_tree ) ) {
+               $excluded_trunks = wp_parse_id_list($exclude_tree);
+               foreach ( $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 ) {
+                       foreach( $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) ) {
-                       foreach ( (array) $exterms as $exterm ) {
-                               if ( empty($exclusions) )
-                                       $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
-                               else
-                                       $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
-                       }
+               $exterms = wp_parse_id_list($exclude);
+               foreach ( $exterms as $exterm ) {
+                       if ( empty($exclusions) )
+                               $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
+                       else
+                               $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
                }
        }
 
@@ -758,13 +966,13 @@ function &get_terms($taxonomies, $args = '') {
 
        // 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 )
                        $limit = 'LIMIT ' . $offset . ',' . $number;
                else
                        $limit = 'LIMIT ' . $number;
-
-       } else
+       } else {
                $limit = '';
+       }
 
        if ( !empty($search) ) {
                $search = like_escape($search);
@@ -772,15 +980,30 @@ function &get_terms($taxonomies, $args = '') {
        }
 
        $selects = array();
-       if ( 'all' == $fields )
-               $selects = array('t.*', 'tt.*');
-       else if ( 'ids' == $fields )
-               $selects = array('t.term_id', 'tt.parent', 'tt.count');
-       else if ( 'names' == $fields )
-               $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
-        $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
-
-       $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
+       switch ( $fields ) {
+               case 'all':
+                       $selects = array('t.*', 'tt.*');
+                       break;
+               case 'ids':
+               case 'id=>parent':
+                       $selects = array('t.term_id', 'tt.parent', 'tt.count');
+                       break;
+               case 'names':
+                       $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
+                       break;
+               case 'count':
+                       $orderby = '';
+                       $order = '';
+                       $selects = array('COUNT(*)');
+       }
+    $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
+
+       $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where $orderby $order $limit";
+
+       if ( 'count' == $fields ) {
+               $term_count = $wpdb->get_var($query);
+               return $term_count;
+       }
 
        $terms = $wpdb->get_results($query);
        if ( 'all' == $fields ) {
@@ -808,7 +1031,7 @@ function &get_terms($taxonomies, $args = '') {
                foreach ( $terms as $k => $term ) {
                        if ( ! $term->count ) {
                                $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
-                               if( is_array($children) )
+                               if ( is_array($children) )
                                        foreach ( $children as $child )
                                                if ( $child->count )
                                                        continue 2;
@@ -821,7 +1044,11 @@ function &get_terms($taxonomies, $args = '') {
        reset ( $terms );
 
        $_terms = array();
-       if ( 'ids' == $fields ) {
+       if ( 'id=>parent' == $fields ) {
+               while ( $term = array_shift($terms) )
+                       $_terms[$term->term_id] = $term->parent;
+               $terms = $_terms;
+       } elseif ( 'ids' == $fields ) {
                while ( $term = array_shift($terms) )
                        $_terms[] = $term->term_id;
                $terms = $_terms;
@@ -846,9 +1073,11 @@ function &get_terms($taxonomies, $args = '') {
  *
  * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
  *
+ * Formerly is_term(), introduced in 2.3.0.
+ *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3.0
+ * @since 3.0.0
  *
  * @uses $wpdb
  *
@@ -857,7 +1086,7 @@ function &get_terms($taxonomies, $args = '') {
  * @param int $parent ID of parent term under which to confine the exists search.
  * @return mixed Get the term id or Term Object, if exists.
  */
-function is_term($term, $taxonomy = '', $parent = 0) {
+function term_exists($term, $taxonomy = '', $parent = 0) {
        global $wpdb;
 
        $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
@@ -1027,32 +1256,32 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
 /**
  * Count how many terms are in Taxonomy.
  *
- * Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code>
- * or <code>array('ignore_empty' => true);</code>.
+ * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
  *
  * @package WordPress
  * @subpackage Taxonomy
  * @since 2.3.0
  *
- * @uses $wpdb
+ * @uses get_terms()
  * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
  *
  * @param string $taxonomy Taxonomy name
- * @param array|string $args Overwrite defaults
+ * @param array|string $args Overwrite defaults. See get_terms()
  * @return int How many terms are in $taxonomy
  */
 function wp_count_terms( $taxonomy, $args = array() ) {
-       global $wpdb;
-
-       $defaults = array('ignore_empty' => false);
+       $defaults = array('hide_empty' => false);
        $args = wp_parse_args($args, $defaults);
-       extract($args, EXTR_SKIP);
 
-       $where = '';
-       if ( $ignore_empty )
-               $where = 'AND count > 0';
+       // backwards compatibility
+       if ( isset($args['ignore_empty']) ) {
+               $args['hide_empty'] = $args['ignore_empty'];
+               unset($args['ignore_empty']);
+       }
+
+       $args['fields'] = 'count';
 
-       return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = %s $where", $taxonomy) );
+       return get_terms($taxonomy, $args);
 }
 
 /**
@@ -1079,7 +1308,7 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
                $taxonomies = array($taxonomies);
 
        foreach ( (array) $taxonomies as $taxonomy ) {
-               $tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+               $tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
                $in_tt_ids = "'" . implode("', '", $tt_ids) . "'";
                do_action( 'delete_term_relationships', $object_id, $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) );
@@ -1118,7 +1347,7 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
 
        $term = (int) $term;
 
-       if ( ! $ids = is_term($term, $taxonomy) )
+       if ( ! $ids = term_exists($term, $taxonomy) )
                return false;
        if ( is_wp_error( $ids ) )
                return $ids;
@@ -1131,7 +1360,7 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
 
        if ( isset($default) ) {
                $default = (int) $default;
-               if ( ! is_term($default, $taxonomy) )
+               if ( ! term_exists($default, $taxonomy) )
                        unset($default);
        }
 
@@ -1218,7 +1447,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
                $taxonomies = array($taxonomies);
 
        foreach ( (array) $taxonomies as $taxonomy ) {
-               if ( ! is_taxonomy($taxonomy) )
+               if ( ! taxonomy_exists($taxonomy) )
                        return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
        }
 
@@ -1341,13 +1570,14 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
  * @since 2.3.0
  * @uses $wpdb
  *
+ * @uses apply_filters() Calls 'pre_insert_term' hook with term and taxonomy as parameters.
  * @uses do_action() Calls 'create_term' hook with the term id and taxonomy id as parameters.
  * @uses do_action() Calls 'create_$taxonomy' hook with term id and taxonomy id as parameters.
  * @uses apply_filters() Calls 'term_id_filter' hook with term id and taxonomy id as parameters.
  * @uses do_action() Calls 'created_term' hook with the term id and taxonomy id as parameters.
  * @uses do_action() Calls 'created_$taxonomy' hook with term id and taxonomy id as parameters.
  *
- * @param int|string $term The term to add or update.
+ * @param string $term The term to add or update.
  * @param string $taxonomy The taxonomy to which to add the term
  * @param array|string $args Change the values of the inserted term
  * @return array|WP_Error The Term ID and Term Taxonomy ID
@@ -1355,9 +1585,13 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
 function wp_insert_term( $term, $taxonomy, $args = array() ) {
        global $wpdb;
 
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
 
+       $term = apply_filters( 'pre_insert_term', $term, $taxonomy );
+               if ( is_wp_error( $term ) )
+                       return $term;
+
        if ( is_int($term) && 0 == $term )
                return new WP_Error('invalid_term_id', __('Invalid term ID'));
 
@@ -1393,19 +1627,39 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
                }
        }
 
-       if ( ! $term_id = is_term($slug) ) {
-               if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-                       return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
-               $term_id = (int) $wpdb->insert_id;
-       } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
-               // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
-               // by incorporating parent slugs.
+       if ( $term_id = term_exists($slug) ) {
+               $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A );
+               // We've got an existing term in the same taxonomy, which matches the name of the new term:
+               if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && term_exists( (int) $term_id, $taxonomy ) ) {
+                       // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level.
+                       $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) );
+                       if ( in_array($name, $siblings) ) {
+                               return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.'));
+                       } else {
+                               $slug = wp_unique_term_slug($slug, (object) $args);
+                               if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
+                                       return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+                               $term_id = (int) $wpdb->insert_id;
+                       }
+               } elseif ( $existing_term['name'] != $name ) {
+                       // We've got an existing term, with a different name, Create the new term.
+                       $slug = wp_unique_term_slug($slug, (object) $args);
+                       if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
+                               return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+                       $term_id = (int) $wpdb->insert_id;
+               } elseif ( term_exists( (int) $term_id, $taxonomy ) )  {
+                       // Same name, same slug.
+                       return new WP_Error('term_exists', __('A term with the name provided already exists.'));
+               }
+       } else {
+               // This term does not exist at all in the database, Create it.
                $slug = wp_unique_term_slug($slug, (object) $args);
                if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
                        return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
                $term_id = (int) $wpdb->insert_id;
        }
 
+       // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string.
        if ( empty($slug) ) {
                $slug = sanitize_title($slug, $term_id);
                do_action( 'edit_terms', $term_id );
@@ -1462,7 +1716,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
 
        $object_id = (int) $object_id;
 
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
 
        if ( !is_array($terms) )
@@ -1470,6 +1724,8 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
 
        if ( ! $append )
                $old_tt_ids =  wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none'));
+       else
+               $old_tt_ids = array();
 
        $tt_ids = array();
        $term_ids = array();
@@ -1478,8 +1734,12 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                if ( !strlen(trim($term)) )
                        continue;
 
-               if ( !$term_info = is_term($term, $taxonomy) )
+               if ( !$term_info = term_exists($term, $taxonomy) ) {
+                       // Skip if a non-existent term ID is passed.
+                       if ( is_int($term) )
+                               continue;
                        $term_info = wp_insert_term($term, $taxonomy);
+               }
                if ( is_wp_error($term_info) )
                        return $term_info;
                $term_ids[] = $term_info['term_id'];
@@ -1510,7 +1770,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
        if ( ! $append && isset($t->sort) && $t->sort ) {
                $values = array();
                $term_order = 0;
-               $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+               $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
                foreach ( $tt_ids as $tt_id )
                        if ( in_array($tt_id, $final_tt_ids) )
                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
@@ -1530,7 +1790,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
  * slug has to be globally unique for every taxonomy.
  *
  * The way this works is that if the taxonomy that the term belongs to is
- * heirarchical and has a parent, it will append that parent to the $slug.
+ * hierarchical and has a parent, it will append that parent to the $slug.
  *
  * If that still doesn't return an unique slug, then it try to append a number
  * until it finds a number that is truely unique.
@@ -1549,6 +1809,9 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
 function wp_unique_term_slug($slug, $term) {
        global $wpdb;
 
+       if ( ! term_exists( $slug ) )
+               return $slug;
+
        // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
        // by incorporating parent slugs.
        if ( is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) {
@@ -1557,7 +1820,10 @@ function wp_unique_term_slug($slug, $term) {
                        $parent_term = get_term($the_parent, $term->taxonomy);
                        if ( is_wp_error($parent_term) || empty($parent_term) )
                                break;
-                               $slug .= '-' . $parent_term->slug;
+                       $slug .= '-' . $parent_term->slug;
+                       if ( ! term_exists( $slug ) )
+                               return $slug;
+
                        if ( empty($parent_term->parent) )
                                break;
                        $the_parent = $parent_term->parent;
@@ -1621,7 +1887,7 @@ function wp_unique_term_slug($slug, $term) {
 function wp_update_term( $term_id, $taxonomy, $args = array() ) {
        global $wpdb;
 
-       if ( ! is_taxonomy($taxonomy) )
+       if ( ! taxonomy_exists($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
 
        $term_id = (int) $term_id;
@@ -1675,7 +1941,7 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
        if ( $id && ($id != $term_id) ) {
                // If an empty slug was passed or the parent changed, reset the slug to something unique.
                // Otherwise, bail.
-               if ( $empty_slug || ( $parent != $term->parent) )
+               if ( $empty_slug || ( $parent != $term['parent']) )
                        $slug = wp_unique_term_slug($slug, (object) $args);
                else
                        return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
@@ -1689,9 +1955,9 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
        do_action( 'edited_terms', $term_id );
 
        $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
-       do_action( 'edit_term_taxonomy', $tt_id );
+       do_action( 'edit_term_taxonomy', $tt_id, $taxonomy );
        $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
-       do_action( 'edited_term_taxonomy', $tt_id );
+       do_action( 'edited_term_taxonomy', $tt_id, $taxonomy );
 
        do_action("edit_term", $term_id, $tt_id, $taxonomy);
        do_action("edit_$taxonomy", $term_id, $tt_id);
@@ -1787,19 +2053,19 @@ function wp_update_term_count_now( $terms, $taxonomy ) {
 
        $taxonomy = get_taxonomy($taxonomy);
        if ( !empty($taxonomy->update_count_callback) ) {
-               call_user_func($taxonomy->update_count_callback, $terms);
+               call_user_func($taxonomy->update_count_callback, $terms, $taxonomy);
        } else {
                // Default count updater
                foreach ( (array) $terms as $term) {
                        $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
-                       do_action( 'edit_term_taxonomy', $term );
+                       do_action( 'edit_term_taxonomy', $term, $taxonomy );
                        $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
-                       do_action( 'edited_term_taxonomy', $term );
+                       do_action( 'edited_term_taxonomy', $term, $taxonomy );
                }
 
        }
 
-       clean_term_cache($terms);
+       clean_term_cache($terms, '', false);
 
        return true;
 }
@@ -1849,8 +2115,9 @@ function clean_object_term_cache($object_ids, $object_type) {
  *
  * @param int|array $ids Single or list of Term IDs
  * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context.
+ * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true.
  */
-function clean_term_cache($ids, $taxonomy = '') {
+function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) {
        global $wpdb;
        static $cleaned = array();
 
@@ -1860,32 +2127,42 @@ function clean_term_cache($ids, $taxonomy = '') {
        $taxonomies = array();
        // If no taxonomy, assume tt_ids.
        if ( empty($taxonomy) ) {
-               $tt_ids = implode(', ', $ids);
+               $tt_ids = array_map('intval', $ids);
+               $tt_ids = implode(', ', $tt_ids);
                $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)");
+               $ids = array();
                foreach ( (array) $terms as $term ) {
                        $taxonomies[] = $term->taxonomy;
+                       $ids[] = $term->term_id;
                        wp_cache_delete($term->term_id, $term->taxonomy);
                }
                $taxonomies = array_unique($taxonomies);
        } else {
-               foreach ( $ids as $id ) {
-                       wp_cache_delete($id, $taxonomy);
-               }
                $taxonomies = array($taxonomy);
+               foreach ( $taxonomies as $taxonomy ) {
+                       foreach ( $ids as $id ) {
+                               wp_cache_delete($id, $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");
+
+               if ( $clean_taxonomy ) {
+                       wp_cache_delete('all_ids', $taxonomy);
+                       wp_cache_delete('get', $taxonomy);
+                       delete_option("{$taxonomy}_children");
+                       // Regenerate {$taxonomy}_children
+                       _get_term_hierarchy($taxonomy);
+               }
+
+               do_action('clean_term_cache', $ids, $taxonomy);
        }
 
        wp_cache_set('last_changed', time(), 'terms');
-
-       do_action('clean_term_cache', $ids, $taxonomy);
 }
 
 
@@ -1954,7 +2231,7 @@ function update_object_term_cache($object_ids, $object_type) {
        if ( empty( $ids ) )
                return false;
 
-       $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id');
+       $terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id'));
 
        $object_terms = array();
        foreach ( (array) $terms as $term )
@@ -2015,20 +2292,20 @@ function update_term_cache($terms, $taxonomy = '') {
  *      option. That is the name of the taxonomy, immediately followed by '_children'.
  *
  * @param string $taxonomy Taxonomy Name
- * @return array Empty if $taxonomy isn't hierarachical or returns children as Term IDs.
+ * @return array Empty if $taxonomy isn't hierarchical or returns children as Term IDs.
  */
 function _get_term_hierarchy($taxonomy) {
        if ( !is_taxonomy_hierarchical($taxonomy) )
                return array();
        $children = get_option("{$taxonomy}_children");
+
        if ( is_array($children) )
                return $children;
-
        $children = array();
-       $terms = get_terms($taxonomy, 'get=all');
-       foreach ( $terms as $term ) {
-               if ( $term->parent > 0 )
-                       $children[$term->parent][] = $term->term_id;
+       $terms = get_terms($taxonomy, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent'));
+       foreach ( $terms as $term_id => $parent ) {
+               if ( $parent > 0 )
+                       $children[$parent][] = $term_id;
        }
        update_option("{$taxonomy}_children", $children);
 
@@ -2129,7 +2406,9 @@ function _pad_term_counts(&$terms, $taxonomy) {
        }
 
        // Get the object and term ids and stick them in a lookup table
-       $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'");
+       $tax_obj = get_taxonomy($taxonomy);
+       $object_types = esc_sql($tax_obj->object_type);
+       $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 (" . implode(',', array_keys($term_ids)) . ") AND post_type IN ('" . implode("', '", $object_types) . "') AND post_status = 'publish'");
        foreach ( $results as $row ) {
                $id = $term_ids[$row->term_taxonomy_id];
                $term_items[$id][$row->object_id] = isset($term_items[$id][$row->object_id]) ? ++$term_items[$id][$row->object_id] : 1;
@@ -2158,7 +2437,7 @@ function _pad_term_counts(&$terms, $taxonomy) {
 //
 
 /**
- * Will update term count based on posts.
+ * Will update term count based on object types of the current taxonomy.
  *
  * Private function for the default callback for post_tag and category
  * taxonomies.
@@ -2170,15 +2449,19 @@ function _pad_term_counts(&$terms, $taxonomy) {
  * @uses $wpdb
  *
  * @param array $terms List of Term taxonomy IDs
+ * @param object $taxonomy Current taxonomy object of terms
  */
-function _update_post_term_count( $terms ) {
+function _update_post_term_count( $terms, $taxonomy ) {
        global $wpdb;
 
+       $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type);
+       $object_types = esc_sql($object_types);
+
        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 ) );
-               do_action( 'edit_term_taxonomy', $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 IN ('" . implode("', '", $object_types) . "') AND term_taxonomy_id = %d", $term ) );
+               do_action( 'edit_term_taxonomy', $term, $taxonomy );
                $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
-               do_action( 'edited_term_taxonomy', $term );
+               do_action( 'edited_term_taxonomy', $term, $taxonomy );
        }
 }
 
@@ -2202,6 +2485,10 @@ function get_term_link( $term, $taxonomy ) {
                        $term = &get_term_by('slug', $term, $taxonomy);
                }
        }
+
+       if ( !is_object($term) )
+               $term = new WP_Error('invalid_term', __('Empty Term'));
+
        if ( is_wp_error( $term ) )
                return $term;
 
@@ -2216,15 +2503,15 @@ function get_term_link( $term, $taxonomy ) {
        $slug = $term->slug;
 
        if ( empty($termlink) ) {
-               $file = trailingslashit( get_option('home') );
                $t = get_taxonomy($taxonomy);
                if ( $t->query_var )
-                       $termlink = "$file?$t->query_var=$slug";
+                       $termlink = "?$t->query_var=$slug";
                else
-                       $termlink = "$file?taxonomy=$taxonomy&term=$slug";
+                       $termlink = "?taxonomy=$taxonomy&term=$slug";
+               $termlink = home_url($termlink);
        } else {
                $termlink = str_replace("%$taxonomy%", $slug, $termlink);
-               $termlink = get_option('home') . user_trailingslashit($termlink, 'category');
+               $termlink = home_url( user_trailingslashit($termlink, 'category') );
        }
        return apply_filters('term_link', $termlink, $term, $taxonomy);
 }
@@ -2374,4 +2661,24 @@ function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
        return false;
 }
 
-?>
+/**
+ * Determine if the given object type is associated with the given taxonomy.
+ *
+ * @since 3.0.0
+ * @uses get_object_taxonomies()
+ *
+ * @param string $object_type Object type string
+ * @param string $taxonomy.  Single taxonomy name
+ * @return bool True if object is associated with the taxonomy, otherwise false.
+ */
+function is_object_in_taxonomy($object_type, $taxonomy) {
+       $taxonomies = get_object_taxonomies($object_type);
+
+       if ( empty($taxonomies) )
+               return false;
+
+       if ( in_array($taxonomy, $taxonomies) )
+               return true;
+
+       return false;
+}
index 9fd4ffe5171d860ea89aeff68b7886badcd20087..7c72a05e13c426e0701005b4122e624d1f908c30 100644 (file)
@@ -3,76 +3,45 @@
  * Loads the correct template based on the visitor's url
  * @package WordPress
  */
-if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
+if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
        do_action('template_redirect');
-       if ( is_robots() ) {
-               do_action('do_robots');
-               return;
-       } else if ( is_feed() ) {
-               do_feed();
-               return;
-       } else if ( is_trackback() ) {
-               include(ABSPATH . 'wp-trackback.php');
-               return;
-       } else if ( is_404() && $template = get_404_template() ) {
-               include($template);
-               return;
-       } else if ( is_search() && $template = get_search_template() ) {
-               include($template);
-               return;
-       } else if ( is_tax() && $template = get_taxonomy_template()) {
-               include($template);
-               return;
-       } else if ( is_home() && $template = get_home_template() ) {
-               include($template);
-               return;
-       } else if ( is_attachment() && $template = get_attachment_template() ) {
+
+// Process feeds and trackbacks even if not using themes.
+if ( is_robots() ) :
+       do_action('do_robots');
+       return;
+elseif ( is_feed() ) :
+       do_feed();
+       return;
+elseif ( is_trackback() ) :
+       include( ABSPATH . 'wp-trackback.php' );
+       return;
+endif;
+
+if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
+       $template = false;
+       if     ( is_404()            && $template = get_404_template()            ) :
+       elseif ( is_search()         && $template = get_search_template()         ) :
+       elseif ( is_tax()            && $template = get_taxonomy_template()       ) :
+       elseif ( is_front_page()     && $template = get_front_page_template()     ) :
+       elseif ( is_home()           && $template = get_home_template()           ) :
+       elseif ( is_attachment()     && $template = get_attachment_template()     ) :
                remove_filter('the_content', 'prepend_attachment');
-               include($template);
-               return;
-       } else if ( is_single() && $template = get_single_template() ) {
-               include($template);
-               return;
-       } else if ( is_page() && $template = get_page_template() ) {
-               include($template);
-               return;
-       } else if ( is_category() && $template = get_category_template()) {
-               include($template);
-               return;
-       } else if ( is_tag() && $template = get_tag_template()) {
-               include($template);
-               return;
-       } else if ( is_author() && $template = get_author_template() ) {
-               include($template);
-               return;
-       } else if ( is_date() && $template = get_date_template() ) {
-               include($template);
-               return;
-       } else if ( is_archive() && $template = get_archive_template() ) {
-               include($template);
-               return;
-       } else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
-               include($template);
-               return;
-       } else if ( is_paged() && $template = get_paged_template() ) {
-               include($template);
-               return;
-       } else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
-               include(TEMPLATEPATH . "/index.php");
-               return;
-       }
-} else {
-       // Process feeds and trackbacks even if not using themes.
-       if ( is_robots() ) {
-               do_action('do_robots');
-               return;
-       } else if ( is_feed() ) {
-               do_feed();
-               return;
-       } else if ( is_trackback() ) {
-               include(ABSPATH . 'wp-trackback.php');
-               return;
-       }
-}
+       elseif ( is_single()         && $template = get_single_template()         ) :
+       elseif ( is_page()           && $template = get_page_template()           ) :
+       elseif ( is_category()       && $template = get_category_template()       ) :
+       elseif ( is_tag()            && $template = get_tag_template()            ) :
+       elseif ( is_author()         && $template = get_author_template()         ) :
+       elseif ( is_date()           && $template = get_date_template()           ) :
+       elseif ( is_archive()        && $template = get_archive_template()        ) :
+       elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
+       elseif ( is_paged()          && $template = get_paged_template()          ) :
+       else :
+               $template = get_index_template();
+       endif;
+       if ( $template = apply_filters( 'template_include', $template ) )
+               include( $template );
+       return;
+endif;
 
-?>
\ No newline at end of file
+?>
similarity index 53%
rename from wp-content/themes/classic/comments-popup.php
rename to wp-includes/theme-compat/comments-popup.php
index 68d5a9c22668dab708f1861f23da7ae25f6ee821..479bbeb7f439014245d199f296a5bea6e4011bba 100644 (file)
@@ -1,12 +1,17 @@
 <?php
 /**
  * @package WordPress
- * @subpackage Classic_Theme
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ * 
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ * 
  */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
 ?><!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>
+     <title><?php printf(__('%1$s - Comments on %2$s'), get_option('blogname'), the_title('','',false)); ?></title>
 
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
        <style type="text/css" media="screen">
@@ -25,13 +30,12 @@ add_filter('comment_text', 'popuplinks');
 if ( have_posts() ) :
 while( have_posts()) : the_post();
 ?>
+<h2 id="comments"><?php _e('Comments'); ?></h2>
 
-<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>
+<p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'); ?></a></p>
 
 <?php if ( pings_open() ) { ?>
-<p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
+<p><?php printf(__('The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em>%s</em>'), get_trackback_url()); ?></p>
 <?php } ?>
 
 <?php
@@ -39,8 +43,8 @@ while( have_posts()) : the_post();
 $commenter = wp_get_current_commenter();
 extract($commenter);
 $comments = get_approved_comments($id);
-$commentstatus = get_post($id);
-if ( post_password_required($commentstatus) ) {  // and it doesn't match the cookie
+$post = get_post($id);
+if ( post_password_required($post) ) {  // and it doesn't match the cookie
        echo(get_the_password_form());
 } else { ?>
 
@@ -49,41 +53,41 @@ if ( post_password_required($commentstatus) ) {  // and it doesn't match the coo
 <?php foreach ($comments as $comment) { ?>
        <li id="comment-<?php comment_ID() ?>">
        <?php comment_text() ?>
-       <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
+       <p><cite><?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?> <?php printf(__('by %1$s &#8212; %2$s @ <a href="#comment-%3$s">%4$s</a>'), get_comment_author_link(), get_comment_date(), get_comment_ID(), get_comment_time()); ?></cite></p>
        </li>
 
 <?php } // end for each comment ?>
 </ol>
 <?php } else { // this is displayed if there are no comments so far ?>
-       <p><?php _e("No comments yet."); ?></p>
+       <p><?php _e('No comments yet.'); ?></p>
 <?php } ?>
 
-<?php if ( comments_open($commentstatus) ) { ?>
-<h2><?php _e("Leave a comment"); ?></h2>
-<p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>
+<?php if ( comments_open() ) { ?>
+<h2><?php _e('Leave a comment'); ?></h2>
+<p><?php printf(__('Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code>%s</code>'), allowed_tags()); ?></p>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
-<?php if ( is_user_logged_in() ) : ?>
-<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(); ?>" title="<?php echo esc_attr(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
+<?php if ( $user_ID ) : ?>
+       <p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out &raquo;</a>'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity, wp_logout_url(get_permalink())); ?></p>
 <?php else : ?>
        <p>
          <input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr($comment_author); ?>" size="28" tabindex="1" />
-          <label for="author"><?php _e("Name"); ?></label>
+          <label for="author"><?php _e('Name'); ?></label>
        </p>
 
        <p>
          <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="28" tabindex="2" />
-          <label for="email"><?php _e("E-mail"); ?></label>
+          <label for="email"><?php _e('E-mail'); ?></label>
        </p>
 
        <p>
          <input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="28" tabindex="3" />
-          <label for="url"><?php _e("<abbr title=\"Universal Resource Locator\">URL</abbr>"); ?></label>
+          <label for="url"><?php _e('<abbr title="Universal Resource Locator">URL</abbr>'); ?></label>
        </p>
 <?php endif; ?>
 
        <p>
-         <label for="comment"><?php _e("Your Comment"); ?></label>
+         <label for="comment"><?php _e('Your Comment'); ?></label>
        <br />
          <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
        </p>
@@ -91,28 +95,27 @@ if ( post_password_required($commentstatus) ) {  // and it doesn't match the coo
        <p>
          <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
          <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
-         <input name="submit" type="submit" tabindex="5" value="<?php esc_attr_e("Say It!"); ?>" />
+         <input name="submit" type="submit" tabindex="5" value="<?php _e('Say It!' ); ?>" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
 </form>
 <?php } else { // comments are closed ?>
-<p><?php _e("Sorry, the comment form is closed at this time."); ?></p>
+<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
 <?php }
 } // end password check
 ?>
 
-<div><strong><a href="javascript:window.close()"><?php _e("Close this window."); ?></a></strong></div>
+<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 have_posts()
-else: //have_posts()
+endwhile; // have_posts()
+else: // have_posts()
 ?>
-<p>Sorry, no posts matched your criteria.</p>
+<p><?php _e('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); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>WordPress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p>
+<p class="credit"><?php timer_stop(1); ?> <cite><?php printf(__('Powered by <a href="%s" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a>'), 'http://wordpress.org/'); ?></cite></p>
 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
 <script type="text/javascript">
 <!--
similarity index 50%
rename from wp-content/themes/default/comments.php
rename to wp-includes/theme-compat/comments.php
index 186a73ca16e2fbc75695c724a5df59cf9c272539..b095d51c75be0082583083fbfc99eb26aa355cbc 100644 (file)
@@ -1,15 +1,20 @@
 <?php
 /**
  * @package WordPress
- * @subpackage Default_Theme
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ * 
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ * 
  */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
 
 // 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 ( post_password_required() ) { ?>
-               <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
+               <p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.'); ?></p> 
        <?php
                return;
        }
@@ -18,7 +23,8 @@
 <!-- You can start editing here. -->
 
 <?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 printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number() ),
+                                                                       number_format_i18n( get_comments_number() ), '&#8220;' . get_the_title() . '&#8221;' ); ?></h3>
 
        <div class="navigation">
                <div class="alignleft"><?php previous_comments_link() ?></div>
@@ -26,7 +32,7 @@
        </div>
 
        <ol class="commentlist">
-       <?php wp_list_comments(); ?>
+       <?php wp_list_comments();?>
        </ol>
 
        <div class="navigation">
@@ -40,7 +46,7 @@
 
         <?php else : // comments are closed ?>
                <!-- If comments are closed. -->
-               <p class="nocomments">Comments are closed.</p>
+               <p class="nocomments"><?php _e('Comments are closed.'); ?></p>
 
        <?php endif; ?>
 <?php endif; ?>
 
 <div id="respond">
 
-<h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
+<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>
+<div id="cancel-comment-reply"> 
+       <small><?php cancel_comment_reply_link() ?></small>
+</div> 
 
 <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
-<p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
+<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() )); ?></p>
 <?php else : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 
 <?php if ( is_user_logged_in() ) : ?>
 
-<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
+<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
 
 <?php else : ?>
 
 <p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
-<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
+<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
 <p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
-<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
+<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
-<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
-<label for="url"><small>Website</small></label></p>
+<p><input type="text" name="url" id="url" value="<?php echo  esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
+<label for="url"><small><?php _e('Website'); ?></small></label></p>
 
 <?php endif; ?>
 
-<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
+<!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>'), allowed_tags()); ?></small></p>-->
 
 <p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>
 
-<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
-<?php comment_id_fields(); ?>
+<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit Comment'); ?>" />
+<?php comment_id_fields(); ?> 
 </p>
 <?php do_action('comment_form', $post->ID); ?>
 
diff --git a/wp-includes/theme-compat/footer.php b/wp-includes/theme-compat/footer.php
new file mode 100644 (file)
index 0000000..93e44cc
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ * 
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ * 
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?>
+
+<hr />
+<div id="footer" role="contentinfo">
+<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
+       <p>
+               <?php printf(__('%1$s is proudly powered by %2$s'), get_bloginfo('name'),
+               '<a href="http://wordpress.org/">WordPress</a>'); ?>
+               <br /><?php printf(__('%1$s and %2$s.'), '<a href="' . get_bloginfo('rss2_url') . '">' . __('Entries (RSS)') . '</a>', '<a href="' . get_bloginfo('comments_rss2_url') . '">' . __('Comments (RSS)') . '</a>'); ?>
+               <!-- <?php printf(__('%d queries. %s seconds.'), get_num_queries(), timer_stop(0, 3)); ?> -->
+       </p>
+</div>
+</div>
+
+<!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ -->
+<?php /* "Just what do you think you're doing Dave?" */ ?>
+
+               <?php wp_footer(); ?>
+</body>
+</html>
similarity index 74%
rename from wp-content/themes/default/header.php
rename to wp-includes/theme-compat/header.php
index 5c21f94d185c2f692a4902dede17dbbc5cc87cac..6089b181101489d0be510811e3e43ac763f7ff49 100644 (file)
@@ -1,8 +1,13 @@
 <?php
 /**
  * @package WordPress
- * @subpackage Default_Theme
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ * 
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ * 
  */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
 ?>
 <!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(); ?>>
@@ -18,7 +23,7 @@
 <style type="text/css" media="screen">
 
 <?php
-// Checks to see whether it needs a sidebar or not
+// Checks to see whether it needs a sidebar
 if ( empty($withcomments) && !is_single() ) {
 ?>
        #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
@@ -38,7 +43,7 @@ if ( empty($withcomments) && !is_single() ) {
 
 <div id="header" role="banner">
        <div id="headerimg">
-               <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
+               <h1><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a></h1>
                <div class="description"><?php bloginfo('description'); ?></div>
        </div>
 </div>
diff --git a/wp-includes/theme-compat/sidebar.php b/wp-includes/theme-compat/sidebar.php
new file mode 100644 (file)
index 0000000..d2c9727
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ * 
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ * 
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?>
+       <div id="sidebar" role="complementary">
+               <ul>
+                       <?php   /* Widgetized sidebar, if you have the plugin installed. */
+                                       if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
+                       <li>
+                               <?php get_search_form(); ?>
+                       </li>
+
+                       <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
+                       <li><h2><?php _e('Author'); ?></h2>
+                       <p>A little something about you, the author. Nothing lengthy, just an overview.</p>
+                       </li>
+                       -->
+
+                       <?php if ( is_404() || is_category() || is_day() || is_month() ||
+                                               is_year() || is_search() || is_paged() ) {
+                       ?> <li>
+
+                       <?php /* If this is a 404 page */ if (is_404()) { ?>
+                       <?php /* If this is a category archive */ } elseif (is_category()) { ?>
+                       <p><?php printf(__('You are currently browsing the archives for the %s category.'), single_cat_title('', false)); ?></p>
+
+                       <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
+                       <p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for the day %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time(__('l, F jS, Y'))); ?></p>
+
+                       <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
+                       <p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time(__('F, Y'))); ?></p>
+
+                       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
+                       <p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for the year %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time('Y')); ?></p>
+
+                       <?php /* If this is a search result */ } elseif (is_search()) { ?>
+                       <p><?php printf(__('You have searched the <a href="%1$s/">%2$s</a> blog archives for <strong>&#8216;%3$s&#8217;</strong>. If you are unable to find anything in these search results, you can try one of these links.'), get_bloginfo('url'), get_bloginfo('name'), esc_html( get_search_query() ) ); ?></p>
+
+                       <?php /* If this set is paginated */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
+                       <p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives.'), get_bloginfo('url'), get_bloginfo('name')); ?></p>
+
+                       <?php } ?>
+
+                       </li>
+               <?php }?>
+               </ul>
+               <ul role="navigation">
+                       <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
+
+                       <li><h2><?php _e('Archives'); ?></h2>
+                               <ul>
+                               <?php wp_get_archives(array('type' => 'monthly')); ?>
+                               </ul>
+                       </li>
+
+                       <?php wp_list_categories(array('show_count' => 1, 'title_li' => '<h2>' . __('Categories') . '</h2>')); ?>
+               </ul>
+               <ul>
+                       <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
+                               <?php wp_list_bookmarks(); ?>
+
+                               <li><h2><?php _e('Meta'); ?></h2>
+                               <ul>
+                                       <?php wp_register(); ?>
+                                       <li><?php wp_loginout(); ?></li>
+                                       <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
+                                       <li><a href="http://gmpg.org/xfn/"><abbr title="<?php _e('XHTML Friends Network'); ?>"><?php _e('XFN'); ?></abbr></a></li>
+                                       <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>">WordPress</a></li>
+                                       <?php wp_meta(); ?>
+                               </ul>
+                               </li>
+                       <?php } ?>
+
+                       <?php endif; ?>
+               </ul>
+       </div>
+
index ddea5cb817b589b8753f6956e38e1e29193c6705..6268f452a07d534c3409968e5254e1d5e94278b8 100644 (file)
@@ -6,6 +6,17 @@
  * @subpackage Template
  */
 
+/**
+ * Whether a child theme is in use.
+ *
+ * @since 3.0.0
+ *
+ * @return bool true if a child theme is in use, false otherwise.
+ **/
+function is_child_theme() {
+       return ( TEMPLATEPATH !== STYLESHEETPATH );
+}
+
 /**
  * Retrieve name of the current stylesheet.
  *
@@ -170,15 +181,15 @@ function get_template_directory_uri() {
  * @return array Theme data.
  */
 function get_theme_data( $theme_file ) {
-       $default_headers = array( 
-               'Name' => 'Theme Name', 
-               'URI' => 'Theme URI', 
-               'Description' => 'Description', 
-               'Author' => 'Author', 
+       $default_headers = array(
+               'Name' => 'Theme Name',
+               'URI' => 'Theme URI',
+               'Description' => 'Description',
+               'Author' => 'Author',
                'AuthorURI' => 'Author URI',
-               'Version' => 'Version', 
-               'Template' => 'Template', 
-               'Status' => 'Status', 
+               'Version' => 'Version',
+               'Template' => 'Template',
+               'Status' => 'Status',
                'Tags' => 'Tags'
                );
 
@@ -222,12 +233,13 @@ function get_theme_data( $theme_file ) {
                $theme_data['Tags'] = array_map( 'trim', explode( ',', wp_kses( $theme_data['Tags'], array() ) ) );
 
        if ( $theme_data['Author'] == '' ) {
-               $theme_data['Author'] = __('Anonymous');
+               $theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous');
        } else {
+               $theme_data['AuthorName'] = wp_kses( $theme_data['Author'], $themes_allowed_tags );
                if ( empty( $theme_data['AuthorURI'] ) ) {
-                       $theme_data['Author'] = wp_kses( $theme_data['Author'], $themes_allowed_tags );
+                       $theme_data['Author'] = $theme_data['AuthorName'];
                } else {
-                       $theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], __( 'Visit author homepage' ), wp_kses( $theme_data['Author'], $themes_allowed_tags ) );
+                       $theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], __( 'Visit author homepage' ), $theme_data['AuthorName'] );
                }
        }
 
@@ -297,6 +309,8 @@ function get_themes() {
                        $title = $name;
                }
 
+               $parent_template = $template;
+
                if ( empty($template) ) {
                        if ( file_exists("$theme_root/$stylesheet/index.php") )
                                $template = $stylesheet;
@@ -319,7 +333,10 @@ function get_themes() {
                                if ( isset($theme_files[$template]) && file_exists( $theme_files[$template]['theme_root'] . "/$template/index.php" ) ) {
                                        $template_directory = $theme_files[$template]['theme_root'] . "/$template";
                                } else {
-                                       $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'));
+                                       if ( empty( $parent_template) )
+                                               $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template');
+                                       else
+                                               $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf( __('The parent theme is missing. Please install the "%s" parent theme.'),  $parent_template ), 'error' => 'no_parent', 'parent' => $parent_template );
                                        continue;
                                }
 
@@ -370,7 +387,7 @@ function get_themes() {
                //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes
                $template_files = array_unique($template_files);
                $stylesheet_files = array_unique($stylesheet_files);
-                       
+
                $template_dir = dirname($template_files[0]);
                $stylesheet_dir = dirname($stylesheet_files[0]);
 
@@ -398,7 +415,26 @@ function get_themes() {
                }
 
                $theme_roots[$stylesheet] = str_replace( WP_CONTENT_DIR, '', $theme_root );
-               $wp_themes[$name] = array( 'Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ) );
+               $wp_themes[$name] = array(
+                       'Name' => $name,
+                       'Title' => $title,
+                       'Description' => $description,
+                       'Author' => $author,
+                       'Author Name' => $theme_data['AuthorName'],
+                       'Author URI' => $theme_data['AuthorURI'],
+                       'Version' => $version,
+                       'Template' => $template,
+                       'Stylesheet' => $stylesheet,
+                       'Template Files' => $template_files,
+                       'Stylesheet Files' => $stylesheet_files,
+                       'Template Dir' => $template_dir,
+                       'Stylesheet Dir' => $stylesheet_dir,
+                       'Status' => $theme_data['Status'],
+                       'Screenshot' => $screenshot,
+                       'Tags' => $theme_data['Tags'],
+                       'Theme Root' => $theme_root,
+                       'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ),
+               );
        }
 
        unset($theme_files);
@@ -592,14 +628,13 @@ function search_theme_directories() {
                                                        @closedir($stylish_dir);
                                                }
                                        }
-                                       @closedir($theme_subdir);
+                                       @closedir($theme_subdirs);
                                        if ( !$found_subdir_themes )
                                                $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.'));
                                }
                        }
                }
-               if ( is_dir( $theme_dir ) )
-                       @closedir( $theme_dir );
+               @closedir( $themes_dir );
        }
        return $theme_files;
 }
@@ -619,7 +654,7 @@ function get_theme_root( $stylesheet_or_template = false ) {
        if ($stylesheet_or_template) {
                $theme_roots = get_theme_roots();
 
-               if ( $theme_roots[$stylesheet_or_template] )
+               if ( ! empty( $theme_roots[$stylesheet_or_template] ) )
                        $theme_root = WP_CONTENT_DIR . $theme_roots[$stylesheet_or_template];
                else
                        $theme_root = WP_CONTENT_DIR . '/themes';
@@ -643,7 +678,7 @@ function get_theme_root( $stylesheet_or_template = false ) {
 function get_theme_root_uri( $stylesheet_or_template = false ) {
        $theme_roots = get_theme_roots();
 
-       if ( $theme_roots[$stylesheet_or_template] )
+       if ( isset( $theme_roots[$stylesheet_or_template] ) && $theme_roots[$stylesheet_or_template] )
                $theme_root_uri = content_url( $theme_roots[$stylesheet_or_template] );
        else
                $theme_root_uri = content_url( 'themes' );
@@ -680,6 +715,17 @@ function get_query_template($type) {
        return apply_filters("{$type}_template", locate_template(array("{$type}.php")));
 }
 
+/**
+ * Retrieve path of index template in current or parent template.
+ *
+ * @since 3.0.0
+ *
+ * @return string
+ */
+function get_index_template() {
+       return get_query_template('index');
+}
+
 /**
  * Retrieve path of 404 template in current or parent template.
  *
@@ -710,7 +756,20 @@ function get_archive_template() {
  * @return string
  */
 function get_author_template() {
-       return get_query_template('author');
+       $author_id = absint( get_query_var( 'author' ) );
+       $author = get_user_by( 'id', $author_id );
+       $author = $author->user_nicename;
+
+       $templates = array();
+
+       if ( $author )
+               $templates[] = "author-{$author}.php";
+       if ( $author_id )
+               $templates[] = "author-{$author_id}.php";
+       $templates[] = 'author.php';
+
+       $template = locate_template( $templates );
+       return apply_filters( 'author_template', $template );
 }
 
 /**
@@ -816,6 +875,8 @@ function get_date_template() {
 /**
  * Retrieve path of home template in current or parent template.
  *
+ * This is the template used for the page containing the blog posts
+ *
  * Attempts to locate 'home.php' first before falling back to 'index.php'.
  *
  * @since 1.5.0
@@ -828,6 +889,20 @@ function get_home_template() {
        return apply_filters('home_template', $template);
 }
 
+/**
+ * Retrieve path of front-page template in current or parent template.
+ *
+ * Looks for 'front-page.php'.
+ *
+ * @since 3.0.0
+ * @uses apply_filters() Calls 'front_page_template' on file path of template.
+ *
+ * @return string
+ */
+function get_front_page_template() {
+       return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) );
+}
+
 /**
  * Retrieve path of page template in current or parent template.
  *
@@ -842,10 +917,16 @@ function get_home_template() {
 function get_page_template() {
        global $wp_query;
 
-       $id = (int) $wp_query->post->ID;
+       $id = (int) $wp_query->get_queried_object_id();
        $template = get_post_meta($id, '_wp_page_template', true);
        $pagename = get_query_var('pagename');
 
+       if ( !$pagename && $id > 0 ) {
+               // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
+               $post = $wp_query->get_queried_object();
+               $pagename = $post->post_name;
+       }
+
        if ( 'default' == $template )
                $template = '';
 
@@ -891,7 +972,11 @@ function get_search_template() {
  * @return string
  */
 function get_single_template() {
-       return get_query_template('single');
+       global $wp_query;
+
+       $object = $wp_query->get_queried_object();
+       $templates = array('single-' . $object->post_type . '.php', 'single.php');
+       return apply_filters('single_template', locate_template($templates));
 }
 
 /**
@@ -926,9 +1011,7 @@ function get_attachment_template() {
  * 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.
+ * parent template.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'comments_popup_template' filter on path.
@@ -937,8 +1020,10 @@ function get_attachment_template() {
  */
 function get_comments_popup_template() {
        $template = locate_template(array("comments-popup.php"));
+
+       // Backward compat code will be removed in a future release
        if ('' == $template)
-               $template = get_theme_root() . '/default/comments-popup.php';
+               $template = WPINC . '/theme-compat/comments-popup.php';
 
        return apply_filters('comments_popup_template', $template);
 }
@@ -953,14 +1038,17 @@ function get_comments_popup_template() {
  *
  * @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.
+ * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false.
  * @return string The template filename if one is located.
  */
-function locate_template($template_names, $load = false) {
-       if (!is_array($template_names))
+function locate_template($template_names, $load = false, $require_once = true ) {
+       if ( !is_array($template_names) )
                return '';
 
        $located = '';
-       foreach($template_names as $template_name) {
+       foreach ( $template_names as $template_name ) {
+               if ( !$template_name )
+                       continue;
                if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
                        $located = STYLESHEETPATH . '/' . $template_name;
                        break;
@@ -970,14 +1058,14 @@ function locate_template($template_names, $load = false) {
                }
        }
 
-       if ($load && '' != $located)
-               load_template($located);
+       if ( $load && '' != $located )
+               load_template( $located, $require_once );
 
        return $located;
 }
 
 /**
- * Require once the template file with WordPress environment.
+ * Require 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
@@ -986,14 +1074,18 @@ function locate_template($template_names, $load = false) {
  * @since 1.5.0
  *
  * @param string $_template_file Path to template file.
+ * @param bool $require_once Whether to require_once or require. Default true.
  */
-function load_template($_template_file) {
+function load_template( $_template_file, $require_once = true ) {
        global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
 
-       if ( is_array($wp_query->query_vars) )
-               extract($wp_query->query_vars, EXTR_SKIP);
+       if ( is_array( $wp_query->query_vars ) )
+               extract( $wp_query->query_vars, EXTR_SKIP );
 
-       require_once($_template_file);
+       if ( $require_once )
+               require_once( $_template_file );
+       else
+               require( $_template_file );
 }
 
 /**
@@ -1038,7 +1130,7 @@ function preview_theme() {
        }
 
        // Prevent theme mods to current theme being used on theme being previewed
-       add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) );
+       add_filter( 'pre_option_mods_' . get_current_theme(), '__return_empty_array' );
 
        ob_start( 'preview_theme_ob_filter' );
 }
@@ -1098,7 +1190,7 @@ function preview_theme_ob_filter_callback( $matches ) {
        if (
                ( false !== strpos($matches[3], '/wp-admin/') )
        ||
-               ( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], get_option('home')) )
+               ( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) )
        ||
                ( false !== strpos($matches[3], '/feed/') )
        ||
@@ -1132,13 +1224,13 @@ function switch_theme($template, $stylesheet) {
 /**
  * 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.
+ * Does not check the default theme, which is the fallback and should always exist.
+ * Will switch theme to the fallback theme 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
+ * @see WP_DEFAULT_THEME
  *
  * @return bool
  */
@@ -1147,13 +1239,13 @@ function validate_current_theme() {
        if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) )
                return true;
 
-       if ( get_template() != 'default' && !file_exists(get_template_directory() . '/index.php') ) {
-               switch_theme('default', 'default');
+       if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) {
+               switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
                return false;
        }
 
-       if ( get_stylesheet() != 'default' && !file_exists(get_template_directory() . '/style.css') ) {
-               switch_theme('default', 'default');
+       if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) {
+               switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
                return false;
        }
 
@@ -1178,7 +1270,7 @@ function validate_current_theme() {
 function get_theme_mod($name, $default = false) {
        $theme = get_current_theme();
 
-       $mods = get_option("mods_$theme");
+       $mods = get_option( "mods_$theme" );
 
        if ( isset($mods[$name]) )
                return apply_filters( "theme_mod_$name", $mods[$name] );
@@ -1253,7 +1345,9 @@ function remove_theme_mods() {
  * @return string
  */
 function get_header_textcolor() {
-       return get_theme_mod('header_textcolor', HEADER_TEXTCOLOR);
+       $default = defined('HEADER_TEXTCOLOR') ? HEADER_TEXTCOLOR : '';
+
+       return get_theme_mod('header_textcolor', $default);
 }
 
 /**
@@ -1274,7 +1368,9 @@ function header_textcolor() {
  * @return string
  */
 function get_header_image() {
-       return get_theme_mod('header_image', HEADER_IMAGE);
+       $default = defined('HEADER_IMAGE') ? HEADER_IMAGE : '';
+
+       return get_theme_mod('header_image', $default);
 }
 
 /**
@@ -1298,26 +1394,217 @@ function header_image() {
  * @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.
+ * @param callback $admin_header_callback Call on custom header administration screen.
+ * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional.
  */
-function add_custom_image_header($header_callback, $admin_header_callback) {
+function add_custom_image_header($header_callback, $admin_header_callback, $admin_image_div_callback = '') {
        if ( ! empty($header_callback) )
                add_action('wp_head', $header_callback);
 
+       add_theme_support( 'custom-header' );
+
        if ( ! is_admin() )
                return;
        require_once(ABSPATH . 'wp-admin/custom-header.php');
-       $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback);
+       $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback, $admin_image_div_callback);
        add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init'));
 }
 
+/**
+ * Register a selection of default headers to be displayed by the custom header admin UI.
+ *
+ * @since 3.0.0
+ *
+ * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.
+ */
+function register_default_headers( $headers ) {
+       global $_wp_default_headers;
+
+       $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
+}
+
+/**
+ * Unregister default headers.
+ *
+ * This function must be called after register_default_headers() has already added the
+ * header you want to remove.
+ *
+ * @see register_default_headers()
+ * @since 3.0.0
+ *
+ * @param string|array The header string id (key of array) to remove, or an array thereof.
+ * @return True on success, false on failure.
+ */
+function unregister_default_headers( $header ) {
+       global $_wp_default_headers;
+       if ( is_array( $header ) ) {
+               array_map( 'unregister_default_headers', $header );
+       } elseif ( isset( $_wp_default_headers[ $header ] ) ) {
+               unset( $_wp_default_headers[ $header ] );
+               return true;
+       } else {
+               return false;
+       }
+}
+
+/**
+ * Retrieve background image for custom background.
+ *
+ * @since 3.0.0
+ *
+ * @return string
+ */
+function get_background_image() {
+       $default = defined('BACKGROUND_IMAGE') ? BACKGROUND_IMAGE : '';
+
+       return get_theme_mod('background_image', $default);
+}
+
+/**
+ * Display background image path.
+ *
+ * @since 3.0.0
+ */
+function background_image() {
+       echo get_background_image();
+}
+
+/**
+ * Retrieve value for custom background color.
+ *
+ * @since 3.0.0
+ * @uses BACKGROUND_COLOR
+ *
+ * @return string
+ */
+function get_background_color() {
+       $default = defined('BACKGROUND_COLOR') ? BACKGROUND_COLOR : '';
+
+       return get_theme_mod('background_color', $default);
+}
+
+/**
+ * Display background color value.
+ *
+ * @since 3.0.0
+ */
+function background_color() {
+       echo get_background_color();
+}
+
+/**
+ * Add callbacks for background image 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_Background class and that will be added
+ * to the 'admin_menu' action.
+ *
+ * @since 3.0.0
+ * @uses Custom_Background 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 custom background administration screen.
+ * @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional.
+ */
+function add_custom_background($header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '') {
+       if ( isset($GLOBALS['custom_background']) )
+               return;
+
+       if ( empty($header_callback) )
+               $header_callback = '_custom_background_cb';
+
+       add_action('wp_head', $header_callback);
+
+       add_theme_support( 'custom-background' );
+
+       if ( ! is_admin() )
+               return;
+       require_once(ABSPATH . 'wp-admin/custom-background.php');
+       $GLOBALS['custom_background'] =& new Custom_Background($admin_header_callback, $admin_image_div_callback);
+       add_action('admin_menu', array(&$GLOBALS['custom_background'], 'init'));
+}
+
+/**
+ * Default custom background callback.
+ *
+ * @since 3.0.0
+ * @see add_custom_background()
+ * @access protected
+ */
+function _custom_background_cb() {
+       $background = get_background_image();
+       $color = get_background_color();
+       if ( ! $background && ! $color )
+               return;
+
+       $style = $color ? "background-color: #$color;" : '';
+
+       if ( $background ) {
+               $image = " background-image: url('$background');";
+
+               $repeat = get_theme_mod( 'background_repeat', 'repeat' );
+               if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
+                       $repeat = 'repeat';
+               $repeat = " background-repeat: $repeat;";
+
+               $position = get_theme_mod( 'background_position_x', 'left' );
+               if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
+                       $position = 'left';
+               $position = " background-position: top $position;";
+
+               $attachment = get_theme_mod( 'background_attachment', 'scroll' );
+               if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
+                       $attachment = 'scroll';
+               $attachment = " background-attachment: $attachment;";
+
+               $style .= $image . $repeat . $position . $attachment;
+       }
+?>
+<style type="text/css">
+body { <?php echo trim( $style ); ?> }
+</style>
+<?php
+}
+
+/**
+ * Add callback for custom TinyMCE editor stylesheets.
+ *
+ * The parameter $stylesheet is the name of the stylesheet, relative to
+ * the theme root. It also accepts an array of stylesheets.
+ * It is optional and defaults to 'editor-style.css'.
+ *
+ * @since 3.0.0
+ *
+ * @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
+ *     Defaults to 'editor-style.css'
+ */
+function add_editor_style( $stylesheet = 'editor-style.css' ) {
+
+       add_theme_support( 'editor-style' );
+
+       if ( ! is_admin() )
+               return;
+
+       global $editor_styles;
+       $editor_styles = (array) $editor_styles;
+       $stylesheet    = (array) $stylesheet;
+       if ( is_rtl() ) {
+               $rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);
+               $stylesheet[] = $rtl_stylesheet;
+       }
+
+       $editor_styles = array_merge( $editor_styles, $stylesheet );
+}
+
 /**
  * Allows a theme to register its support of a certain feature
- * 
- * Must be called in the themes functions.php file to work.
  *
- * @author Mark Jaquith
- * @since 2.9
+ * Must be called in the theme's functions.php file to work.
+ * If attached to a hook, it must be after_setup_theme.
+ * The init hook may be too late for some features.
+ *
+ * @since 2.9.0
  * @param string $feature the feature being added
  */
 function add_theme_support( $feature ) {
@@ -1329,15 +1616,37 @@ function add_theme_support( $feature ) {
                $_wp_theme_features[$feature] = array_slice( func_get_args(), 1 );
 }
 
+/**
+ * Allows a theme to de-register its support of a certain feature
+ *
+ * Should be called in the theme's functions.php file. Generally would
+ * be used for child themes to override support from the parent theme.
+ *
+ * @since 3.0.0
+ * @see add_theme_support()
+ * @param string $feature the feature being added
+ * @return bool Whether feature was removed.
+ */
+function remove_theme_support( $feature ) {
+       // Blacklist: for internal registrations not used directly by themes.
+       if ( in_array( $feature, array( 'custom-background', 'custom-header', 'editor-style', 'widgets' ) ) )
+               return false;
+
+       global $_wp_theme_features;
+
+       if ( ! isset( $_wp_theme_features[$feature] ) )
+               return false;
+       unset( $_wp_theme_features[$feature] );
+       return true;
+}
+
 /**
  * Checks a theme's support for a given feature
  *
- * @author Mark Jaquith
- * @since 2.9
+ * @since 2.9.0
  * @param string $feature the feature being checked
  * @return boolean
  */
-
 function current_theme_supports( $feature ) {
        global $_wp_theme_features;
 
@@ -1372,8 +1681,7 @@ function current_theme_supports( $feature ) {
 /**
  * Checks a theme's support for a given feature before loading the functions which implement it.
  *
- * @author Peter Westwood
- * @since 2.9
+ * @since 2.9.0
  * @param string $feature the feature being checked
  * @param string $include the file containing the functions that implement the feature
  */
@@ -1382,4 +1690,28 @@ function require_if_theme_supports( $feature, $include) {
                require ( $include );
 }
 
+/**
+ * Checks an attachment being deleted to see if it's a header or background image.
+ *
+ * If true it removes the theme modification which would be pointing at the deleted
+ * attachment
+ *
+ * @access private
+ * @since 3.0.0
+ * @param int $id the attachment id
+ */
+function _delete_attachment_theme_mod( $id ) {
+       $attachment_image = wp_get_attachment_url( $id );
+       $header_image = get_header_image();
+       $background_image = get_background_image();
+
+       if ( $header_image && $header_image == $attachment_image )
+               remove_theme_mod( 'header_image' );
+
+       if ( $background_image && $background_image == $attachment_image )
+               remove_theme_mod( 'background_image' );
+}
+
+add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
+
 ?>
index 3b710569fa395ed235cbecb390de4f57d1fa624f..e071921458467d035028c947a7f8de6a010e581d 100644 (file)
@@ -26,7 +26,7 @@ function wp_version_check() {
        global $wp_version, $wpdb, $wp_local_package;
        $php_version = phpversion();
 
-       $current = get_transient( 'update_core' );
+       $current = get_site_transient( 'update_core' );
        if ( ! is_object($current) ) {
                $current = new stdClass;
                $current->updates = array();
@@ -37,18 +37,33 @@ function wp_version_check() {
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
-       set_transient( 'update_core', $current );
+       set_site_transient( 'update_core', $current );
 
        if ( method_exists( $wpdb, 'db_version' ) )
                $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
        else
                $mysql_version = 'N/A';
+
+       $num_blogs = 1;
+       $wp_install = home_url( '/' );
+       $multisite_enabled = 0;
+       $user_count = count_users( );
+       if ( is_multisite( ) ) {
+               $num_blogs = get_blog_count( );
+               $wp_install = network_site_url( );
+               $multisite_enabled = 1;
+       }
+
        $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";
+       $url = "http://api.wordpress.org/core/version-check/1.5/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled";
 
        $options = array(
-               'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
-               'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
+               'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
+               'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
+               'headers' => array(
+                       'wp_install' => $wp_install,
+                       'wp_blog' => home_url( '/' )
+               )
        );
 
        $response = wp_remote_get($url, $options);
@@ -62,7 +77,7 @@ function wp_version_check() {
        $body = trim( $response['body'] );
        $body = str_replace(array("\r\n", "\r"), "\n", $body);
        $new_options = array();
-       foreach( explode( "\n\n", $body ) as $entry) {
+       foreach ( explode( "\n\n", $body ) as $entry ) {
                $returns = explode("\n", $entry);
                $new_option = new stdClass();
                $new_option->response = esc_attr( $returns[0] );
@@ -74,6 +89,10 @@ function wp_version_check() {
                        $new_option->current = esc_attr( $returns[3] );
                if ( isset( $returns[4] ) )
                        $new_option->locale = esc_attr( $returns[4] );
+               if ( isset( $returns[5] ) )
+                       $new_option->php_version = esc_attr( $returns[5] );
+               if ( isset( $returns[6] ) )
+                       $new_option->mysql_version = esc_attr( $returns[6] );
                $new_options[] = $new_option;
        }
 
@@ -81,7 +100,7 @@ function wp_version_check() {
        $updates->updates = $new_options;
        $updates->last_checked = time();
        $updates->version_checked = $wp_version;
-       set_transient( 'update_core',  $updates);
+       set_site_transient( 'update_core',  $updates);
 }
 
 /**
@@ -108,8 +127,8 @@ function wp_update_plugins() {
                require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
 
        $plugins = get_plugins();
-       $active  = get_option( 'active_plugins' );
-       $current = get_transient( 'update_plugins' );
+       $active  = get_option( 'active_plugins', array() );
+       $current = get_site_transient( 'update_plugins' );
        if ( ! is_object($current) )
                $current = new stdClass;
 
@@ -141,9 +160,9 @@ function wp_update_plugins() {
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
-       set_transient( 'update_plugins', $current );
+       set_site_transient( 'update_plugins', $current );
 
-       $to_send = (object)compact('plugins', 'active');
+       $to_send = (object) compact('plugins', 'active');
 
        $options = array(
                'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
@@ -156,7 +175,7 @@ function wp_update_plugins() {
        if ( is_wp_error( $raw_response ) )
                return false;
 
-       if( 200 != $raw_response['response']['code'] )
+       if ( 200 != $raw_response['response']['code'] )
                return false;
 
        $response = unserialize( $raw_response['body'] );
@@ -166,7 +185,7 @@ function wp_update_plugins() {
        else
                $new_option->response = array();
 
-       set_transient( 'update_plugins', $new_option );
+       set_site_transient( 'update_plugins', $new_option );
 }
 
 /**
@@ -185,14 +204,14 @@ function wp_update_plugins() {
 function wp_update_themes( ) {
        global $wp_version;
 
-       if( defined( 'WP_INSTALLING' ) )
+       if ( defined( 'WP_INSTALLING' ) )
                return false;
 
-       if( !function_exists( 'get_themes' ) )
+       if ( !function_exists( 'get_themes' ) )
                require_once( ABSPATH . 'wp-includes/theme.php' );
 
        $installed_themes = get_themes( );
-       $current_theme = get_transient( 'update_themes' );
+       $current_theme = get_site_transient( 'update_themes' );
        if ( ! is_object($current_theme) )
                $current_theme = new stdClass;
 
@@ -204,13 +223,12 @@ function wp_update_themes( ) {
        $themes = array();
        $checked = array();
        $themes['current_theme'] = (array) $current_theme;
-       foreach( (array) $installed_themes as $theme_title => $theme ) {
+       foreach ( (array) $installed_themes as $theme_title => $theme ) {
                $themes[$theme['Stylesheet']] = array();
                $checked[$theme['Stylesheet']] = $theme['Version'];
 
-               foreach( (array) $theme as $key => $value ) {
+               foreach ( (array) $theme as $key => $value )
                        $themes[$theme['Stylesheet']][$key] = $value;
-               }
        }
 
        $theme_changed = false;
@@ -230,12 +248,12 @@ function wp_update_themes( ) {
                }
        }
 
-       if( $time_not_changed && !$theme_changed )
+       if ( $time_not_changed && !$theme_changed )
                return false;
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current_theme->last_checked = time();
-       set_transient( 'update_themes', $current_theme );
+       set_site_transient( 'update_themes', $current_theme );
 
        $current_theme->template = get_option( 'template' );
 
@@ -247,25 +265,25 @@ function wp_update_themes( ) {
 
        $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
 
-       if( is_wp_error( $raw_response ) )
+       if ( is_wp_error( $raw_response ) )
                return false;
 
-       if( 200 != $raw_response['response']['code'] )
+       if ( 200 != $raw_response['response']['code'] )
                return false;
 
        $response = unserialize( $raw_response['body'] );
-       if( $response ) {
+       if ( $response ) {
                $new_option->checked = $checked;
                $new_option->response = $response;
        }
 
-       set_transient( 'update_themes', $new_option );
+       set_site_transient( 'update_themes', $new_option );
 }
 
 function _maybe_update_core() {
        global $wp_version;
 
-       $current = get_transient( 'update_core' );
+       $current = get_site_transient( 'update_core' );
 
        if ( isset( $current->last_checked ) &&
                43200 > ( time() - $current->last_checked ) &&
@@ -286,7 +304,7 @@ function _maybe_update_core() {
  * @access private
  */
 function _maybe_update_plugins() {
-       $current = get_transient( 'update_plugins' );
+       $current = get_site_transient( 'update_plugins' );
        if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
                return;
        wp_update_plugins();
@@ -302,8 +320,8 @@ function _maybe_update_plugins() {
  * @access private
  */
 function _maybe_update_themes( ) {
-       $current = get_transient( 'update_themes' );
-       if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
+       $current = get_site_transient( 'update_themes' );
+       if ( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
                return;
 
        wp_update_themes();
@@ -320,6 +338,7 @@ add_action( 'wp_update_plugins', 'wp_update_plugins' );
 
 add_action( 'load-themes.php', 'wp_update_themes' );
 add_action( 'load-update.php', 'wp_update_themes' );
+add_action( 'load-update-core.php', 'wp_update_themes' );
 add_action( 'admin_init', '_maybe_update_themes' );
 add_action( 'wp_update_themes', 'wp_update_themes' );
 
index 71fd7a3222c32d10f3f6f513ed9e583287a35d97..66d5d2e960115dc0a9ff0e996d00812a543c01ce 100644 (file)
@@ -41,7 +41,7 @@ function wp_signon( $credentials = '', $secure_cookie = '' ) {
        do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
 
        if ( '' === $secure_cookie )
-               $secure_cookie = is_ssl() ? true : false;
+               $secure_cookie = is_ssl();
 
        global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
        $auth_secure_cookie = $secure_cookie;
@@ -83,20 +83,30 @@ function wp_authenticate_username_password($user, $username, $password) {
                return $error;
        }
 
-       $userdata = get_userdatabylogin($username);
+       $userdata = get_user_by('login', $username);
 
-       if ( !$userdata ) {
+       if ( !$userdata )
                return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
+
+       if ( is_multisite() ) {
+               // Is user marked as spam?
+               if ( 1 == $userdata->spam)
+                       return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Your account has been marked as a spammer.'));
+
+               // Is a user's blog marked as spam?
+               if ( !is_super_admin( $userdata->ID ) && isset($userdata->primary_blog) ) {
+                       $details = get_blog_details( $userdata->primary_blog );
+                       if ( is_object( $details ) && $details->spam == 1 )
+                               return new WP_Error('blog_suspended', __('Site Suspended.'));
+               }
        }
 
        $userdata = apply_filters('wp_authenticate_user', $userdata, $password);
-       if ( is_wp_error($userdata) ) {
+       if ( is_wp_error($userdata) )
                return $userdata;
-       }
 
-       if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) ) {
+       if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )
                return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
-       }
 
        $user =  new WP_User($userdata->ID);
        return $user;
@@ -130,47 +140,52 @@ function wp_authenticate_cookie($user, $username, $password) {
 }
 
 /**
- * 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.
+ * Number of posts user has written.
  *
- * @since 1.5.0
- * @uses $wpdb WordPress database object to create queries.
+ * @since 3.0.0
+ * @uses $wpdb WordPress database object for queries.
  *
- * @param string $field User field to retrieve.
- * @param string $user Optional. User username.
- * @return string The value in the field.
+ * @param int $userid User ID.
+ * @return int Amount of posts user has written.
  */
-function get_profile($field, $user = false) {
+function count_user_posts($userid) {
        global $wpdb;
-       if ( !$user )
-               $user = esc_sql( $_COOKIE[USER_COOKIE] );
-       return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) );
+
+       $where = get_posts_by_author_sql('post', TRUE, $userid);
+
+       $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
+
+       return apply_filters('get_usernumposts', $count, $userid);
 }
 
 /**
- * Number of posts user has written.
+ * Number of posts written by a list of users.
  *
- * @since 0.71
- * @uses $wpdb WordPress database object for queries.
- *
- * @param int $userid User ID.
- * @return int Amount of posts user has written.
+ * @since 3.0.0
+ * @param array $userid User ID number list.
+ * @return array Amount of posts each user has written.
  */
-function get_usernumposts($userid) {
+function count_many_users_posts($users) {
        global $wpdb;
-       $userid = (int) $userid;
-       $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);
+
+       $count = array();
+       if ( ! is_array($users) || empty( $users ) )
+               return $count;
+
+       $userlist = implode( ',', $users );
+       $where = get_posts_by_author_sql( 'post' );
+
+       $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
+       foreach ( $result as $row ) {
+               $count[ $row[0] ] = $row[1];
+       }
+
+       foreach ( $users as $id ) {
+               if ( ! isset( $count[ $id ] ) )
+                       $count[ $id ] = 0;
+       }
+
+       return $count;
 }
 
 /**
@@ -196,16 +211,28 @@ function user_pass_ok($user_login, $user_pass) {
 //
 
 /**
- * Retrieve user option that can be either global, user, or blog.
+ * Get the current user's ID
+ *
+ * @since MU
+ *
+ * @uses wp_get_current_user
+ *
+ * @return int The current user's ID
+ */
+function get_current_user_id() {
+       $user = wp_get_current_user();
+       return ( isset( $user->ID ) ? (int) $user->ID : 0 );
+}
+
+/**
+ * Retrieve user option that can be either per Site or per Network.
  *
  * 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.
+ * The option will first check for the per site name and then the per Network name.
  *
  * @since 2.0.0
  * @uses $wpdb WordPress database object for queries.
@@ -214,24 +241,29 @@ function user_pass_ok($user_login, $user_pass) {
  *
  * @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.
+ * @param bool $deprecated Use get_option() to check for an option in the options table.
  * @return mixed
  */
-function get_user_option( $option, $user = 0, $check_blog_options = true ) {
+function get_user_option( $option, $user = 0, $deprecated = '' ) {
        global $wpdb;
 
-       $option = preg_replace('|[^a-z0-9_]|i', '', $option);
-       if ( empty($user) )
+       if ( !empty( $deprecated ) )
+               _deprecated_argument( __FUNCTION__, '3.0' );
+
+       if ( empty($user) ) {
                $user = wp_get_current_user();
-       else
-               $user = get_userdata($user);
-
-       if ( isset( $user->{$wpdb->prefix . $option} ) ) // Blog specific
-               $result = $user->{$wpdb->prefix . $option};
-       elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
-               $result = $user->{$option};
-       elseif ( $check_blog_options ) // Blog global
-               $result = get_option( $option );
+               $user = $user->ID;
+       }
+
+       $user = get_userdata($user);
+
+       // Keys used as object vars cannot have dashes.
+       $key = str_replace('-', '', $option);
+
+       if ( isset( $user->{$wpdb->prefix . $key} ) ) // Blog specific
+               $result = $user->{$wpdb->prefix . $key};
+       elseif ( isset( $user->{$key} ) ) // User specific and cross-blog
+               $result = $user->{$key};
        else
                $result = false;
 
@@ -245,20 +277,52 @@ function get_user_option( $option, $user = 0, $check_blog_options = true ) {
  * global blog options. If the 'global' parameter is false, which it is by default
  * it will prepend the WordPress table prefix to the option name.
  *
+ * Deletes the user option if $newvalue is empty.
+ *
  * @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.
+ * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
  * @return unknown
  */
 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
        global $wpdb;
+
        if ( !$global )
                $option_name = $wpdb->prefix . $option_name;
-       return update_usermeta( $user_id, $option_name, $newvalue );
+
+       // For backward compatibility. See differences between update_user_meta() and deprecated update_usermeta().
+       // http://core.trac.wordpress.org/ticket/13088
+       if ( is_null( $newvalue ) || is_scalar( $newvalue ) && empty( $newvalue ) )
+               return delete_user_meta( $user_id, $option_name );
+
+       return update_user_meta( $user_id, $option_name, $newvalue );
+}
+
+/**
+ * Delete 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 default
+ * it will prepend the WordPress table prefix to the option name.
+ *
+ * @since 3.0.0
+ * @uses $wpdb WordPress database object for queries
+ *
+ * @param int $user_id User ID
+ * @param string $option_name User option name.
+ * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
+ * @return unknown
+ */
+function delete_user_option( $user_id, $option_name, $global = false ) {
+       global $wpdb;
+
+       if ( !$global )
+               $option_name = $wpdb->prefix . $option_name;
+       return delete_user_meta( $user_id, $option_name );
 }
 
 /**
@@ -278,154 +342,165 @@ function get_users_of_blog( $id = '' ) {
        global $wpdb, $blog_id;
        if ( empty($id) )
                $id = (int) $blog_id;
-       $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$wpdb->prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
+       $blog_prefix = $wpdb->get_blog_prefix($id);
+       $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
        return $users;
 }
 
-//
-// User meta functions
-//
-
 /**
- * Remove user meta data.
+ * Add meta data field to a user.
  *
- * @since 2.0.0
- * @uses $wpdb WordPress database object for queries.
+ * Post meta data is called "Custom Fields" on the Administration Panels.
+ *
+ * @since 3.0.0
+ * @uses add_metadata()
+ * @link http://codex.wordpress.org/Function_Reference/add_user_meta
  *
- * @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.
+ * @param int $user_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 delete_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);
-
-       if ( is_array($meta_value) || is_object($meta_value) )
-               $meta_value = serialize($meta_value);
-       $meta_value = trim( $meta_value );
-
-       $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
-
-       if ( $cur && $cur->umeta_id )
-               do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $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", $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) );
-
-       wp_cache_delete($user_id, 'users');
-
-       if ( $cur && $cur->umeta_id )
-               do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
-
-       return true;
+function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {
+       return add_metadata('user', $user_id, $meta_key, $meta_value, $unique);
 }
 
 /**
- * Retrieve user metadata.
+ * Remove metadata matching criteria from a user.
  *
- * 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.
+ * 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.
  *
- * @since 2.0.0
- * @uses $wpdb WordPress database object for queries.
+ * @since 3.0.0
+ * @uses delete_metadata()
+ * @link http://codex.wordpress.org/Function_Reference/delete_user_meta
  *
- * @param int $user_id User ID
- * @param string $meta_key Optional. Metadata key.
- * @return mixed
+ * @param int $user_id user ID
+ * @param string $meta_key Metadata name.
+ * @param mixed $meta_value Optional. Metadata value.
+ * @return bool False for failure. True for success.
  */
-function get_usermeta( $user_id, $meta_key = '') {
-       global $wpdb;
-       $user_id = (int) $user_id;
-
-       if ( !$user_id )
-               return false;
-
-       if ( !empty($meta_key) ) {
-               $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
-               $user = wp_cache_get($user_id, 'users');
-               // Check the cached user object
-               if ( false !== $user && isset($user->$meta_key) )
-                       $metas = array($user->$meta_key);
-               else
-                       $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
-       } else {
-               $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
-       }
-
-       if ( empty($metas) ) {
-               if ( empty($meta_key) )
-                       return array();
-               else
-                       return '';
-       }
-
-       $metas = array_map('maybe_unserialize', $metas);
+function delete_user_meta($user_id, $meta_key, $meta_value = '') {
+       return delete_metadata('user', $user_id, $meta_key, $meta_value);
+}
 
-       if ( count($metas) == 1 )
-               return $metas[0];
-       else
-               return $metas;
+/**
+ * Retrieve user meta field for a user.
+ *
+ * @since 3.0.0
+ * @uses get_metadata()
+ * @link http://codex.wordpress.org/Function_Reference/get_user_meta
+ *
+ * @param int $user_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_user_meta($user_id, $key, $single = false) {
+       return get_metadata('user', $user_id, $key, $single);
 }
 
 /**
- * Update metadata of user.
+ * Update user meta field based on user ID.
  *
- * 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.
+ * Use the $prev_value parameter to differentiate between meta fields with the
+ * same key and user ID.
  *
- * Will remove the metadata, if the meta value is empty.
+ * If the meta field for the user does not exist, it will be added.
  *
- * @since 2.0.0
- * @uses $wpdb WordPress database object for queries
+ * @since 3.0.0
+ * @uses update_metadata
+ * @link http://codex.wordpress.org/Function_Reference/update_user_meta
  *
- * @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.
+ * @param int $user_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_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_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') {
+       return update_metadata('user', $user_id, $meta_key, $meta_value, $prev_value);
+}
+
+/**
+ * Count number of users who have each of the user roles.
+ *
+ * Assumes there are neither duplicated nor orphaned capabilities meta_values.
+ * Assumes role names are unique phrases.  Same assumption made by WP_User_Search::prepare_query()
+ * Using $strategy = 'time' this is CPU-intensive and should handle around 10^7 users.
+ * Using $strategy = 'memory' this is memory-intensive and should handle around 10^5 users, but see WP Bug #12257.
+ *
+ * @since 3.0.0
+ * @param string $strategy 'time' or 'memory'
+ * @return array Includes a grand total and an array of counts indexed by role strings.
+ */
+function count_users($strategy = 'time') {
+       global $wpdb, $blog_id, $wp_roles;
 
-       /** @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);
+       // Initialize
+       $id = (int) $blog_id;
+       $blog_prefix = $wpdb->get_blog_prefix($id);
+       $result = array();
 
-       if (empty($meta_value)) {
-               return delete_usermeta($user_id, $meta_key);
-       }
+       if ( 'time' == $strategy ) {
+               global $wp_roles;
 
-       $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
+               if ( ! isset( $wp_roles ) )
+                       $wp_roles = new WP_Roles();
 
-       if ( $cur )
-               do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
+               $avail_roles = $wp_roles->get_names();
 
-       if ( !$cur )
-               $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
-       else if ( $cur->meta_value != $meta_value )
-               $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
-       else
-               return false;
+               // Build a CPU-intensive query that will return concise information.
+               $select_count = array();
+               foreach ( $avail_roles as $this_role => $name ) {
+                       $select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%" . like_escape($this_role) . "%', FALSE))";
+               }
+               $select_count = implode(', ', $select_count);
+
+               // Add the meta_value index to the selection list, then run the query.
+               $row = $wpdb->get_row( "SELECT $select_count, COUNT(*) FROM $wpdb->usermeta WHERE meta_key = '{$blog_prefix}capabilities'", ARRAY_N );
+
+               // Run the previous loop again to associate results with role names.
+               $col = 0;
+               $role_counts = array();
+               foreach ( $avail_roles as $this_role => $name ) {
+                       $count = (int) $row[$col++];
+                       if ($count > 0) {
+                               $role_counts[$this_role] = $count;
+                       }
+               }
 
-       wp_cache_delete($user_id, 'users');
+               // Get the meta_value index from the end of the result set.
+               $total_users = (int) $row[$col];
 
-       if ( !$cur )
-               do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
-       else
-               do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
+               $result['total_users'] = $total_users;
+               $result['avail_roles'] =& $role_counts;
+       } else {
+               $avail_roles = array();
+
+               $users_of_blog = $wpdb->get_col( "SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = '{$blog_prefix}capabilities'" );
+
+               foreach ( $users_of_blog as $caps_meta ) {
+                       $b_roles = unserialize($caps_meta);
+                       if ( is_array($b_roles) ) {
+                               foreach ( $b_roles as $b_role => $val ) {
+                                       if ( isset($avail_roles[$b_role]) ) {
+                                               $avail_roles[$b_role]++;
+                                       } else {
+                                               $avail_roles[$b_role] = 1;
+                                       }
+                               }
+                       }
+               }
 
-       return true;
+               $result['total_users'] = count( $users_of_blog );
+               $result['avail_roles'] =& $avail_roles;
+       }
+
+       return $result;
 }
 
 //
@@ -433,10 +508,9 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
 //
 
 /**
- * Setup global user vars.
+ * Set up global user vars.
  *
- * Used by set_current_user() for back compat. Might be deprecated in the
- * future.
+ * Used by wp_set_current_user() for back compat. Might be deprecated in the future.
  *
  * @since 2.0.4
  * @global string $userdata User description.
@@ -448,7 +522,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
  * @global string $user_pass_md5 MD5 of the user's password
  * @global string $user_identity The display name of the user
  *
- * @param int $for_user_id Optional. User ID to setup global data.
+ * @param int $for_user_id Optional. User ID to set up global data.
  */
 function setup_userdata($for_user_id = '') {
        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
@@ -458,13 +532,16 @@ function setup_userdata($for_user_id = '') {
        else
                $user = new WP_User($for_user_id);
 
-       if ( 0 == $user->ID )
+       $userdata   = $user->data;
+       $user_ID    = (int) $user->ID;
+       $user_level = (int) isset($user->user_level) ? $user->user_level : 0;
+
+       if ( 0 == $user->ID ) {
+               $user_login = $user_email = $user_url = $user_pass_md5 = $user_identity = '';
                return;
+       }
 
-       $userdata = $user->data;
        $user_login     = $user->user_login;
-       $user_level     = (int) isset($user->user_level) ? $user->user_level : 0;
-       $user_ID = (int) $user->ID;
        $user_email     = $user->user_email;
        $user_url       = $user->user_url;
        $user_pass_md5  = md5($user->user_pass);
@@ -489,12 +566,14 @@ function setup_userdata($for_user_id = '') {
  * <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>multi - Default is 'false'. Whether to skip the ID attribute on the 'select' element. A 'true' value is overridden when id argument is set.</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>id - Default is the value of the 'name' parameter. ID attribute of select element.</li>
  * <li>class - Class attribute of select element.</li>
+ * <li>blog_id - ID of blog (Multisite only). Defaults to ID of current blog.</li>
  * </ol>
  *
  * @since 2.3.0
@@ -510,7 +589,8 @@ function wp_dropdown_users( $args = '' ) {
                'orderby' => 'display_name', 'order' => 'ASC',
                'include' => '', 'exclude' => '', 'multi' => 0,
                'show' => 'display_name', 'echo' => 1,
-               'selected' => 0, 'name' => 'user', 'class' => ''
+               'selected' => 0, 'name' => 'user', 'class' => '', 'blog_id' => $GLOBALS['blog_id'],
+               'id' => '',
        );
 
        $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
@@ -518,7 +598,8 @@ function wp_dropdown_users( $args = '' ) {
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
 
-       $query = "SELECT * FROM $wpdb->users";
+       $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
+       $query = "SELECT {$wpdb->users}.* FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities'";
 
        $query_where = array();
 
@@ -535,7 +616,7 @@ function wp_dropdown_users( $args = '' ) {
                $query_where[] = "ID NOT IN ($exclude)";
 
        if ( $query_where )
-               $query .= " WHERE " . join(' AND', $query_where);
+               $query .= " AND " . join(' AND', $query_where);
 
        $query .= " ORDER BY $orderby $order";
 
@@ -543,19 +624,25 @@ function wp_dropdown_users( $args = '' ) {
 
        $output = '';
        if ( !empty($users) ) {
-               $id = $multi ? "" : "id='$name'";
+               $name = esc_attr( $name );
+               if ( $multi && ! $id )
+                       $id = '';
+               else
+                       $id = $id ? " id='" . esc_attr( $id ) . "'" : " id='$name'";
 
-               $output = "<select name='$name' $id class='$class'>\n";
+               $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_none )
-                       $output .= "\t<option value='-1'>$show_option_none</option>\n";
+               if ( $show_option_none ) {
+                       $_selected = selected( -1, $selected, false );
+                       $output .= "\t<option value='-1'$_selected>$show_option_none</option>\n";
+               }
 
                foreach ( (array) $users as $user ) {
                        $user->ID = (int) $user->ID;
-                       $_selected = $user->ID == $selected ? " selected='selected'" : '';
+                       $_selected = selected( $user->ID, $selected, false );
                        $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
                        $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
                }
@@ -576,8 +663,8 @@ function wp_dropdown_users( $args = '' ) {
  *
  * 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.
+ * should be used to retrieve user data. The intention is if the current data
+ * had been cached already, there would be no need to call this function.
  *
  * @access private
  * @since 2.5.0
@@ -586,17 +673,56 @@ function wp_dropdown_users( $args = '' ) {
  * @param object $user The user data object.
  */
 function _fill_user( &$user ) {
+       $metavalues = get_user_metavalues(array($user->ID));
+       _fill_single_user($user, $metavalues[$user->ID]);
+}
+
+/**
+ * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
+ *
+ * @since 3.0.0
+ * @param array $ids User ID numbers list.
+ * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
+ */
+function get_user_metavalues($ids) {
        global $wpdb;
 
+       $clean = array_map('intval', $ids);
+       if ( 0 == count($clean) )
+               return $objects;
+
+       $list = implode(',', $clean);
+
        $show = $wpdb->hide_errors();
-       $metavalues = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user->ID));
+       $metavalues = $wpdb->get_results("SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE user_id IN ($list)");
        $wpdb->show_errors($show);
 
-       if ( $metavalues ) {
-               foreach ( (array) $metavalues as $meta ) {
-                       $value = maybe_unserialize($meta->meta_value);
-                       $user->{$meta->meta_key} = $value;
-               }
+       $objects = array();
+       foreach($clean as $id) {
+               $objects[$id] = array();
+       }
+       foreach($metavalues as $meta_object) {
+               $objects[$meta_object->user_id][] = $meta_object;
+       }
+
+       return $objects;
+}
+
+/**
+ * Unserialize user metadata, fill $user object, then cache everything.
+ *
+ * @since 3.0.0
+ * @param object $user The User object.
+ * @param array $metavalues An array of objects provided by get_user_metavalues()
+ */
+function _fill_single_user( &$user, &$metavalues ) {
+       global $wpdb;
+
+       foreach ( $metavalues as $meta ) {
+               $value = maybe_unserialize($meta->meta_value);
+               // Keys used as object vars cannot have dashes.
+               $key = str_replace('-', '', $meta->meta_key);
+               $user->{$key} = $value;
        }
 
        $level = $wpdb->prefix . 'user_level';
@@ -611,10 +737,28 @@ function _fill_user( &$user ) {
        if ( isset($user->description) )
                $user->user_description = $user->description;
 
-       wp_cache_add($user->ID, $user, 'users');
-       wp_cache_add($user->user_login, $user->ID, 'userlogins');
-       wp_cache_add($user->user_email, $user->ID, 'useremail');
-       wp_cache_add($user->user_nicename, $user->ID, 'userslugs');
+       update_user_caches($user);
+}
+
+/**
+ * Take an array of user objects, fill them with metas, and cache them.
+ *
+ * @since 3.0.0
+ * @param array $users User objects
+ */
+function _fill_many_users( &$users ) {
+       $ids = array();
+       foreach($users as $user_object) {
+               $ids[] = $user_object->ID;
+       }
+
+    $metas = get_user_metavalues($ids);
+
+       foreach($users as $user_object) {
+               if (isset($metas[$user_object->ID])) {
+               _fill_single_user($user_object, $metas[$user_object->ID]);
+               }
+       }
 }
 
 /**
@@ -638,7 +782,7 @@ function sanitize_user_object($user, $context = 'display') {
                else
                        $vars = get_object_vars($user);
                foreach ( array_keys($vars) as $field ) {
-                       if ( is_string($user->$field) || is_numeric($user->$field) ) 
+                       if ( is_string($user->$field) || is_numeric($user->$field) )
                                $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
                }
                $user->filter = $context;
@@ -733,4 +877,34 @@ function sanitize_user_field($field, $value, $user_id, $context) {
        return $value;
 }
 
+/**
+ * Update all user caches
+ *
+ * @since 3.0.0
+ *
+ * @param object $user User object to be cached
+ */
+function update_user_caches(&$user) {
+       wp_cache_add($user->ID, $user, 'users');
+       wp_cache_add($user->user_login, $user->ID, 'userlogins');
+       wp_cache_add($user->user_email, $user->ID, 'useremail');
+       wp_cache_add($user->user_nicename, $user->ID, 'userslugs');
+}
+
+/**
+ * Clean all user caches
+ *
+ * @since 3.0.0
+ *
+ * @param int $id User ID
+ */
+function clean_user_cache($id) {
+       $user = new WP_User($id);
+
+       wp_cache_delete($id, 'users');
+       wp_cache_delete($user->user_login, 'userlogins');
+       wp_cache_delete($user->user_email, 'useremail');
+       wp_cache_delete($user->user_nicename, 'userslugs');
+}
+
 ?>
index ec2be5e445a728ff3dc20741f7997093c947ce6b..7a62c892ad0553e05a6509eecf4c30a06ae72a1a 100644 (file)
@@ -40,9 +40,9 @@ $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari
 if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
        if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
                $is_lynx = true;
-       } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
+       } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
                $is_chrome = true;
-       } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
+       } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
                $is_safari = true;
        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
                $is_gecko = true;
@@ -57,7 +57,7 @@ if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
        }
 }
 
-if ( $is_safari && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false )
+if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
        $is_iphone = true;
 
 $is_IE = ( $is_macIE || $is_winIE );
index 0cbd4f434b49e2f49df6145ca87f75e3be4470f5..706385078ce277fae3c3012fed1cb10c2bac0e9e 100644 (file)
@@ -8,14 +8,14 @@
  *
  * @global string $wp_version
  */
-$wp_version = '2.9.2';
+$wp_version = '3.0';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
  *
  * @global int $wp_db_version
  */
-$wp_db_version = 12329;
+$wp_db_version = 15260;
 
 /**
  * Holds the TinyMCE version
@@ -29,7 +29,7 @@ $tinymce_version = '327-1235';
  *
  * @global string $manifest_version
  */
-$manifest_version = '20090616';
+$manifest_version = '20100530';
 
 /**
  * Holds the required PHP version
index 47c0e6fcf538e63de2169304fc54e09f1299be6d..02fb6aa304229022878606c863d84a9620b7e80c 100644 (file)
@@ -461,7 +461,8 @@ function unregister_widget($widget_class) {
  * 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.
+ * number the sidebar creation is currently at. If the id is provided, and mutliple
+ * sidebars are being defined, the id will have "-2" appended, and so on.
  *
  * @since 2.2.0
  *
@@ -480,25 +481,27 @@ function register_sidebars($number = 1, $args = array()) {
        if ( is_string($args) )
                parse_str($args, $args);
 
-       for ( $i=1; $i <= $number; $i++ ) {
+       for ( $i = 1; $i <= $number; $i++ ) {
                $_args = $args;
 
-               if ( $number > 1 ) {
+               if ( $number > 1 )
                        $_args['name'] = isset($args['name']) ? sprintf($args['name'], $i) : sprintf(__('Sidebar %d'), $i);
-               } else {
+               else
                        $_args['name'] = isset($args['name']) ? $args['name'] : __('Sidebar');
-               }
 
-               if (isset($args['id'])) {
+               // Custom specified ID's are suffixed if they exist already.
+               // Automatically generated sidebar names need to be suffixed regardless starting at -0
+               if ( isset($args['id']) ) {
                        $_args['id'] = $args['id'];
+                       $n = 2; // Start at -2 for conflicting custom ID's
+                       while ( isset($wp_registered_sidebars[$_args['id']]) )
+                               $_args['id'] = $args['id'] . '-' . $n++;
                } else {
                        $n = count($wp_registered_sidebars);
                        do {
-                               $n++;
-                               $_args['id'] = "sidebar-$n";
-                       } while (isset($wp_registered_sidebars[$_args['id']]));
+                               $_args['id'] = 'sidebar-' . ++$n;
+                       } while ( isset($wp_registered_sidebars[$_args['id']]) );
                }
-
                register_sidebar($_args);
        }
 }
@@ -531,8 +534,6 @@ function register_sidebars($number = 1, $args = array()) {
  *
  * @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.
@@ -540,9 +541,6 @@ function register_sidebars($number = 1, $args = array()) {
 function register_sidebar($args = array()) {
        global $wp_registered_sidebars;
 
-       if ( is_string($args) )
-               parse_str($args, $args);
-
        $i = count($wp_registered_sidebars) + 1;
 
        $defaults = array(
@@ -555,10 +553,14 @@ function register_sidebar($args = array()) {
                'after_title' => "</h2>\n",
        );
 
-       $sidebar = array_merge($defaults, (array) $args);
+       $sidebar = wp_parse_args( $args, $defaults );
 
        $wp_registered_sidebars[$sidebar['id']] = $sidebar;
 
+       add_theme_support('widgets');
+
+       do_action( 'register_sidebar', $sidebar );
+
        return $sidebar['id'];
 }
 
@@ -629,8 +631,10 @@ function wp_register_sidebar_widget($id, $name, $output_callback, $options = arr
        );
        $widget = array_merge($widget, $options);
 
-       if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) )
+       if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) ) {
+               do_action( 'wp_register_sidebar_widget', $widget );
                $wp_registered_widgets[$id] = $widget;
+       }
 }
 
 /**
@@ -685,6 +689,8 @@ function wp_sidebar_description( $id ) {
  * @param int|string $id Widget ID.
  */
 function wp_unregister_sidebar_widget($id) {
+       do_action( 'wp_unregister_sidebar_widget', $id );
+
        wp_register_sidebar_widget($id, '', '');
        wp_unregister_widget_control($id);
 }
@@ -879,6 +885,8 @@ function dynamic_sidebar($index = 1) {
 
                $callback = $wp_registered_widgets[$id]['callback'];
 
+               do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] );
+
                if ( is_callable($callback) ) {
                        call_user_func_array($callback, $params);
                        $did_one = true;
@@ -963,7 +971,7 @@ function is_dynamic_sidebar() {
 function is_active_sidebar( $index ) {
        $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
        $sidebars_widgets = wp_get_sidebars_widgets();
-       if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
+       if ( !empty($sidebars_widgets[$index]) )
                return true;
 
        return false;
@@ -980,10 +988,13 @@ function is_active_sidebar( $index ) {
  * @since 2.2.0
  * @access private
  *
- * @param bool $update Optional, deprecated.
+ * @param bool $deprecated. Not used.
  * @return array Upgraded list of widgets to version 3 array format when called from the admin.
  */
 function wp_get_sidebars_widgets($deprecated = true) {
+       if ( $deprecated !== true )
+               _deprecated_argument( __FUNCTION__, '2.8.1' );
+
        global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
 
        // If loading from front page, consult $_wp_sidebars_widgets rather than options
@@ -1069,7 +1080,7 @@ function wp_get_sidebars_widgets($deprecated = true) {
                }
        }
 
-       if ( isset($sidebars_widgets['array_version']) )
+       if ( is_array( $sidebars_widgets ) && isset($sidebars_widgets['array_version']) )
                unset($sidebars_widgets['array_version']);
 
        $sidebars_widgets = apply_filters('sidebars_widgets', $sidebars_widgets);
@@ -1167,114 +1178,6 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) {
        return $settings;
 }
 
-/**
- * Deprecated API
- */
-
-/**
- * Register widget for sidebar with backwards compatibility.
- *
- * Allows $name to be an array that accepts either three elements to grab the
- * first element and the third for the name or just uses the first element of
- * the array for the name.
- *
- * Passes to {@link wp_register_sidebar_widget()} after argument list and
- * backwards compatibility is complete.
- *
- * @since 2.2.0
- * @uses wp_register_sidebar_widget() Passes the compiled arguments.
- *
- * @param string|int $name Widget ID.
- * @param callback $output_callback Run when widget is called.
- * @param string $classname Classname widget option.
- * @param mixed $params,... Widget parameters.
- */
-function register_sidebar_widget($name, $output_callback, $classname = '') {
-       // Compat
-       if ( is_array($name) ) {
-               if ( count($name) == 3 )
-                       $name = sprintf($name[0], $name[2]);
-               else
-                       $name = $name[0];
-       }
-
-       $id = sanitize_title($name);
-       $options = array();
-       if ( !empty($classname) && is_string($classname) )
-               $options['classname'] = $classname;
-       $params = array_slice(func_get_args(), 2);
-       $args = array($id, $name, $output_callback, $options);
-       if ( !empty($params) )
-               $args = array_merge($args, $params);
-
-       call_user_func_array('wp_register_sidebar_widget', $args);
-}
-
-/**
- * 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);
-}
-
-/**
- * Registers widget control callback for customizing options.
- *
- * Allows $name to be an array that accepts either three elements to grab the
- * first element and the third for the name or just uses the first element of
- * the array for the name.
- *
- * Passes to {@link wp_register_widget_control()} after the argument list has
- * been compiled.
- *
- * @since 2.2.0
- *
- * @param int|string $name Sidebar ID.
- * @param callback $control_callback Widget control callback to display and process form.
- * @param int $width Widget width.
- * @param int $height Widget height.
- */
-function register_widget_control($name, $control_callback, $width = '', $height = '') {
-       // Compat
-       if ( is_array($name) ) {
-               if ( count($name) == 3 )
-                       $name = sprintf($name[0], $name[2]);
-               else
-                       $name = $name[0];
-       }
-
-       $id = sanitize_title($name);
-       $options = array();
-       if ( !empty($width) )
-               $options['width'] = $width;
-       if ( !empty($height) )
-               $options['height'] = $height;
-       $params = array_slice(func_get_args(), 4);
-       $args = array($id, $name, $control_callback, $options);
-       if ( !empty($params) )
-               $args = array_merge($args, $params);
-
-       call_user_func_array('wp_register_widget_control', $args);
-}
-
-/**
- * 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);
-}
-
 /**
  * Output an arbitrary widget as a template tag
  *
@@ -1298,6 +1201,8 @@ function the_widget($widget, $instance = array(), $args = array()) {
        $args = wp_parse_args($args, $default_args);
        $instance = wp_parse_args($instance);
 
+       do_action( 'the_widget', $widget, $instance, $args );
+
        $widget_obj->_set(-1);
        $widget_obj->widget($args, $instance);
 }
index bc634382b27704bc4fa82123bf8080f957d43188..6630efcf31e30d5c1d0af2634b51b14588eebe71 100644 (file)
 /**
  * @since 0.71
  */
-define('EZSQL_VERSION', 'WP1.25');
+define( 'EZSQL_VERSION', 'WP1.25' );
 
 /**
  * @since 0.71
  */
-define('OBJECT', 'OBJECT', true);
+define( 'OBJECT', 'OBJECT', true );
 
 /**
- * @since {@internal Version Unknown}}
+ * @since 2.5.0
  */
-define('OBJECT_K', 'OBJECT_K', false);
+define( 'OBJECT_K', 'OBJECT_K' );
 
 /**
  * @since 0.71
  */
-define('ARRAY_A', 'ARRAY_A', false);
+define( 'ARRAY_A', 'ARRAY_A' );
 
 /**
  * @since 0.71
  */
-define('ARRAY_N', 'ARRAY_N', false);
+define( 'ARRAY_N', 'ARRAY_N' );
 
 /**
  * WordPress Database Access Abstraction Object
@@ -65,7 +65,7 @@ class wpdb {
         * Whether to suppress errors during the DB bootstrapping.
         *
         * @access private
-        * @since {@internal Version Unknown}}
+        * @since 2.5
         * @var bool
         */
        var $suppress_errors = false;
@@ -73,7 +73,9 @@ class wpdb {
        /**
         * The last error during query.
         *
-        * @since {@internal Version Unknown}}
+        * @see get_last_error()
+        * @since 2.5
+        * @access private
         * @var string
         */
        var $last_error = '';
@@ -87,6 +89,33 @@ class wpdb {
         */
        var $num_queries = 0;
 
+       /**
+        * Count of rows returned by previous query
+        *
+        * @since 1.2
+        * @access private
+        * @var int
+        */
+       var $num_rows = 0;
+
+       /**
+        * Count of affected rows by previous query
+        *
+        * @since 0.71
+        * @access private
+        * @var int
+        */
+       var $rows_affected = 0;
+
+       /**
+        * The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
+        *
+        * @since 0.71
+        * @access public
+        * @var int
+        */
+       var $insert_id = 0;
+
        /**
         * Saved result of the last query made
         *
@@ -96,6 +125,15 @@ class wpdb {
         */
        var $last_query;
 
+       /**
+        * Results of the last query made
+        *
+        * @since 1.0.0
+        * @access private
+        * @var array|null
+        */
+       var $last_result;
+
        /**
         * Saved info on the table column
         *
@@ -137,40 +175,66 @@ class wpdb {
        var $ready = false;
 
        /**
-        * WordPress Posts table
+        * {@internal Missing Description}}
         *
-        * @since 1.5.0
+        * @since 3.0.0
         * @access public
-        * @var string
+        * @var int
         */
-       var $posts;
+       var $blogid = 0;
 
        /**
-        * WordPress Users table
+        * {@internal Missing Description}}
         *
-        * @since 1.5.0
+        * @since 3.0.0
         * @access public
-        * @var string
+        * @var int
         */
-       var $users;
+       var $siteid = 0;
 
        /**
-        * WordPress Categories table
+        * List of WordPress per-blog tables
         *
-        * @since 1.5.0
-        * @access public
-        * @var string
+        * @since 2.5.0
+        * @access private
+        * @see wpdb::tables()
+        * @var array
         */
-       var $categories;
+       var $tables = array( 'posts', 'comments', 'links', 'options', 'postmeta',
+               'terms', 'term_taxonomy', 'term_relationships', 'commentmeta' );
 
        /**
-        * WordPress Post to Category table
+        * List of deprecated WordPress tables
         *
-        * @since 1.5.0
-        * @access public
-        * @var string
+        * categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
+        *
+        * @since 2.9.0
+        * @access private
+        * @see wpdb::tables()
+        * @var array
         */
-       var $post2cat;
+       var $old_tables = array( 'categories', 'post2cat', 'link2cat' );
+
+       /**
+        * List of WordPress global tables
+        *
+        * @since 3.0.0
+        * @access private
+        * @see wpdb::tables()
+        * @var array
+        */
+       var $global_tables = array( 'users', 'usermeta' );
+
+       /**
+        * List of Multisite global tables
+        *
+        * @since 3.0.0
+        * @access private
+        * @see wpdb::tables()
+        * @var array
+        */
+       var $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta',
+               'sitecategories', 'registration_log', 'blog_versions' );
 
        /**
         * WordPress Comments table
@@ -181,6 +245,15 @@ class wpdb {
         */
        var $comments;
 
+       /**
+        * WordPress Comment Metadata table
+        *
+        * @since 2.9.0
+        * @access public
+        * @var string
+        */
+       var $commentmeta;
+
        /**
         * WordPress Links table
         *
@@ -202,38 +275,38 @@ class wpdb {
        /**
         * WordPress Post Metadata table
         *
-        * @since {@internal Version Unknown}}
+        * @since 1.5.0
         * @access public
         * @var string
         */
        var $postmeta;
 
        /**
-        * WordPress Comment Metadata table
+        * WordPress Posts table
         *
-        * @since 2.9
+        * @since 1.5.0
         * @access public
         * @var string
         */
-       var $commentmeta;
+       var $posts;
 
        /**
-        * WordPress User Metadata table
+        * WordPress Terms table
         *
         * @since 2.3.0
         * @access public
         * @var string
         */
-       var $usermeta;
+       var $terms;
 
        /**
-        * WordPress Terms table
+        * WordPress Term Relationships table
         *
         * @since 2.3.0
         * @access public
         * @var string
         */
-       var $terms;
+       var $term_relationships;
 
        /**
         * WordPress Term Taxonomy table
@@ -244,46 +317,103 @@ class wpdb {
         */
        var $term_taxonomy;
 
+       /*
+        * Global and Multisite tables
+        */
+
        /**
-        * WordPress Term Relationships table
+        * WordPress User Metadata table
         *
         * @since 2.3.0
         * @access public
         * @var string
         */
-       var $term_relationships;
+       var $usermeta;
 
        /**
-        * List of WordPress tables
+        * WordPress Users table
         *
-        * @since {@internal Version Unknown}}
-        * @access private
-        * @var array
+        * @since 1.5.0
+        * @access public
+        * @var string
         */
-       var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
-                       'postmeta', 'terms', 'term_taxonomy', 'term_relationships', 'commentmeta');
+       var $users;
 
        /**
-        * List of deprecated WordPress tables
+        * Multisite Blogs table
         *
-        * @since 2.9.0
-        * @access private
-        * @var array
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $blogs;
+
+       /**
+        * Multisite Blog Versions table
+        *
+        * @since 3.0.0
+        * @access public
+        * @var string
         */
-       var $old_tables = array('categories', 'post2cat', 'link2cat');
+       var $blog_versions;
 
+       /**
+        * Multisite Registration Log table
+        *
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $registration_log;
 
        /**
-        * Format specifiers for DB columns. Columns not listed here default to %s.  Initialized in wp-settings.php.
+        * Multisite Signups table
         *
-        * Keys are colmn names, values are format types: 'ID' => '%d'
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $signups;
+
+       /**
+        * Multisite Sites table
+        *
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $site;
+
+       /**
+        * Multisite Sitewide Terms table
+        *
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $sitecategories;
+
+       /**
+        * Multisite Site Metadata table
+        *
+        * @since 3.0.0
+        * @access public
+        * @var string
+        */
+       var $sitemeta;
+
+       /**
+        * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
+        *
+        * Keys are column names, values are format types: 'ID' => '%d'
         *
         * @since 2.8.0
         * @see wpdb:prepare()
         * @see wpdb:insert()
         * @see wpdb:update()
+        * @see wp_set_wpdb_vars()
         * @access public
-        * @war array
+        * @var array
         */
        var $field_types = array();
 
@@ -323,6 +453,15 @@ class wpdb {
         */
        var $dbuser;
 
+       /**
+        * A textual description of the last query/get_row/get_var call
+        *
+        * @since unknown
+        * @access public
+        * @var string
+        */
+       var $func_call;
+
        /**
         * Connects to the database server and selects a database
         *
@@ -336,8 +475,10 @@ class wpdb {
         * @param string $dbname MySQL database name
         * @param string $dbhost MySQL database host
         */
-       function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
-               return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
+       function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) {
+               if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
+                       $this->db_connect();
+               return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost );
        }
 
        /**
@@ -347,6 +488,7 @@ class wpdb {
         * the actual setting up of the class properties and connection
         * to the database.
         *
+        * @link http://core.trac.wordpress.org/ticket/3354
         * @since 2.0.8
         *
         * @param string $dbuser MySQL database user
@@ -354,23 +496,30 @@ class wpdb {
         * @param string $dbname MySQL database name
         * @param string $dbhost MySQL database host
         */
-       function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
-               register_shutdown_function(array(&$this, "__destruct"));
+       function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
+               register_shutdown_function( array( &$this, '__destruct' ) );
 
                if ( WP_DEBUG )
                        $this->show_errors();
 
-               if ( defined('DB_CHARSET') )
-                       $this->charset = DB_CHARSET;
-
-               if ( defined('DB_COLLATE') )
+               if ( is_multisite() ) {
+                       $this->charset = 'utf8';
+                       if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
+                               $this->collate = DB_COLLATE;
+                       else
+                               $this->collate = 'utf8_general_ci';
+               } elseif ( defined( 'DB_COLLATE' ) ) {
                        $this->collate = DB_COLLATE;
+               }
+
+               if ( defined( 'DB_CHARSET' ) )
+                       $this->charset = DB_CHARSET;
 
                $this->dbuser = $dbuser;
 
-               $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
-               if (!$this->dbh) {
-                       $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
+               $this->dbh = @mysql_connect( $dbhost, $dbuser, $dbpassword, true );
+               if ( !$this->dbh ) {
+                       $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
 <h1>Error establishing a database connection</h1>
 <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
 <ul>
@@ -379,33 +528,33 @@ class wpdb {
        <li>Are you sure that the database server is running?</li>
 </ul>
 <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
-"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
+"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost ), 'db_connect_fail' );
                        return;
                }
 
                $this->ready = true;
 
-               if ( $this->has_cap( 'collation' ) && !empty($this->charset) ) {
-                       if ( function_exists('mysql_set_charset') ) {
-                               mysql_set_charset($this->charset, $this->dbh);
+               if ( $this->has_cap( 'collation' ) && !empty( $this->charset ) ) {
+                       if ( function_exists( 'mysql_set_charset' ) ) {
+                               mysql_set_charset( $this->charset, $this->dbh );
                                $this->real_escape = true;
                        } else {
-                               $collation_query = "SET NAMES '{$this->charset}'";
-                               if ( !empty($this->collate) )
-                                       $collation_query .= " COLLATE '{$this->collate}'";
-                               $this->query($collation_query);
+                               $query = $this->prepare( 'SET NAMES %s', $this->charset );
+                               if ( ! empty( $this->collate ) )
+                                       $query .= $this->prepare( ' COLLATE %s', $this->collate );
+                               $this->query( $query );
                        }
                }
 
-               $this->select($dbname);
+               $this->select( $dbname, $this->dbh );
        }
 
        /**
         * PHP5 style destructor and will run when database object is destroyed.
         *
+        * @see wpdb::__construct()
         * @since 2.0.8
-        *
-        * @return bool Always true
+        * @return bool true
         */
        function __destruct() {
                return true;
@@ -414,34 +563,167 @@ class wpdb {
        /**
         * Sets the table prefix for the WordPress tables.
         *
-        * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to
-        * override the WordPress users and usersmeta tables that would otherwise be determined by the $prefix.
-        *
         * @since 2.5.0
         *
         * @param string $prefix Alphanumeric name for the new prefix.
         * @return string|WP_Error Old prefix or WP_Error on error
         */
-       function set_prefix($prefix) {
+       function set_prefix( $prefix, $set_table_names = true ) {
 
-               if ( preg_match('|[^a-z0-9_]|i', $prefix) )
+               if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
                        return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
 
-               $old_prefix = $this->prefix;
-               $this->prefix = $prefix;
+               $old_prefix = is_multisite() ? '' : $prefix;
 
-               foreach ( (array) $this->tables as $table )
-                       $this->$table = $this->prefix . $table;
+               if ( isset( $this->base_prefix ) )
+                       $old_prefix = $this->base_prefix;
 
-               if ( defined('CUSTOM_USER_TABLE') )
-                       $this->users = CUSTOM_USER_TABLE;
+               $this->base_prefix = $prefix;
 
-               if ( defined('CUSTOM_USER_META_TABLE') )
-                       $this->usermeta = CUSTOM_USER_META_TABLE;
+               if ( $set_table_names ) {
+                       foreach ( $this->tables( 'global' ) as $table => $prefixed_table )
+                               $this->$table = $prefixed_table;
 
+                       if ( is_multisite() && empty( $this->blogid ) )
+                               return $old_prefix;
+
+                       $this->prefix = $this->get_blog_prefix();
+
+                       foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
+                               $this->$table = $prefixed_table;
+
+                       foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
+                               $this->$table = $prefixed_table;
+               }
                return $old_prefix;
        }
 
+       /**
+        * Sets blog id.
+        *
+        * @since 3.0.0
+        * @access public
+        * @param int $blog_id
+        * @param int $site_id Optional.
+        * @return string previous blog id
+        */
+       function set_blog_id( $blog_id, $site_id = 0 ) {
+               if ( ! empty( $site_id ) )
+                       $this->siteid = $site_id;
+
+               $old_blog_id  = $this->blogid;
+               $this->blogid = $blog_id;
+
+               $this->prefix = $this->get_blog_prefix();
+
+               foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
+                       $this->$table = $prefixed_table;
+
+               foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
+                       $this->$table = $prefixed_table;
+
+               return $old_blog_id;
+       }
+
+       /**
+        * Gets blog prefix.
+        *
+        * @uses is_multisite()
+        * @since 3.0.0
+        * @param int $blog_id Optional.
+        * @return string Blog prefix.
+        */
+       function get_blog_prefix( $blog_id = null ) {
+               if ( is_multisite() ) {
+                       if ( null === $blog_id )
+                               $blog_id = $this->blogid;
+                       if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) )
+                               return $this->base_prefix;
+                       else
+                               return $this->base_prefix . $blog_id . '_';
+               } else {
+                       return $this->base_prefix;
+               }
+       }
+
+       /**
+        * Returns an array of WordPress tables.
+        *
+        * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to
+        * override the WordPress users and usersmeta tables that would otherwise
+        * be determined by the prefix.
+        *
+        * The scope argument can take one of the following:
+        *
+        * 'all' - returns 'all' and 'global' tables. No old tables are returned.
+        * 'blog' - returns the blog-level tables for the queried blog.
+        * 'global' - returns the global tables for the installation, returning multisite tables only if running multisite.
+        * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.
+        * 'old' - returns tables which are deprecated.
+        *
+        * @since 3.0.0
+        * @uses wpdb::$tables
+        * @uses wpdb::$old_tables
+        * @uses wpdb::$global_tables
+        * @uses wpdb::$ms_global_tables
+        * @uses is_multisite()
+        *
+        * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
+        * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog
+        *      prefix is requested, then the custom users and usermeta tables will be mapped.
+        * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.
+        * @return array Table names. When a prefix is requested, the key is the unprefixed table name.
+        */
+       function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
+               switch ( $scope ) {
+                       case 'all' :
+                               $tables = array_merge( $this->global_tables, $this->tables );
+                               if ( is_multisite() )
+                                       $tables = array_merge( $tables, $this->ms_global_tables );
+                               break;
+                       case 'blog' :
+                               $tables = $this->tables;
+                               break;
+                       case 'global' :
+                               $tables = $this->global_tables;
+                               if ( is_multisite() )
+                                       $tables = array_merge( $tables, $this->ms_global_tables );
+                               break;
+                       case 'ms_global' :
+                               $tables = $this->ms_global_tables;
+                               break;
+                       case 'old' :
+                               $tables = $this->old_tables;
+                               break;
+                       default :
+                               return array();
+                               break;
+               }
+
+               if ( $prefix ) {
+                       if ( ! $blog_id )
+                               $blog_id = $this->blogid;
+                       $blog_prefix = $this->get_blog_prefix( $blog_id );
+                       $base_prefix = $this->base_prefix;
+                       $global_tables = array_merge( $this->global_tables, $this->ms_global_tables );
+                       foreach ( $tables as $k => $table ) {
+                               if ( in_array( $table, $global_tables ) )
+                                       $tables[ $table ] = $base_prefix . $table;
+                               else
+                                       $tables[ $table ] = $blog_prefix . $table;
+                               unset( $tables[ $k ] );
+                       }
+
+                       if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) )
+                               $tables['users'] = CUSTOM_USER_TABLE;
+
+                       if ( isset( $tables['usermeta'] ) && defined( 'CUSTOM_USER_META_TABLE' ) )
+                               $tables['usermeta'] = CUSTOM_USER_META_TABLE;
+               }
+
+               return $tables;
+       }
+
        /**
         * Selects a database using the current database connection.
         *
@@ -451,12 +733,16 @@ class wpdb {
         * @since 0.71
         *
         * @param string $db MySQL database name
+        * @param resource $dbh Optional link identifier.
         * @return null Always null.
         */
-       function select($db) {
-               if (!@mysql_select_db($db, $this->dbh)) {
+       function select( $db, $dbh = null) {
+               if ( is_null($dbh) ) 
+                       $dbh = $this->dbh;
+
+               if ( !@mysql_select_db( $db, $dbh ) ) {
                        $this->ready = false;
-                       $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'
+                       $this->bail( sprintf( /*WP_I18N_DB_SELECT_DB*/'
 <h1>Can&#8217;t select database</h1>
 <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>%1$s</code> database.</p>
 <ul>
@@ -464,24 +750,56 @@ class wpdb {
 <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 <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, $this->dbuser), 'db_select_fail');
+<p>If you don\'t know how to set up 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, $this->dbuser ), 'db_select_fail' );
                        return;
                }
        }
 
-       function _weak_escape($string) {
-               return addslashes($string);
+       /**
+        * Weak escape, using addslashes()
+        *
+        * @see addslashes()
+        * @since 2.8.0
+        * @access private
+        *
+        * @param string $string
+        * @return string
+        */
+       function _weak_escape( $string ) {
+               return addslashes( $string );
        }
 
-       function _real_escape($string) {
+       /**
+        * Real escape, using mysql_real_escape_string() or addslashes()
+        *
+        * @see mysql_real_escape_string()
+        * @see addslashes()
+        * @since 2.8
+        * @access private
+        *
+        * @param  string $string to escape
+        * @return string escaped
+        */
+       function _real_escape( $string ) {
                if ( $this->dbh && $this->real_escape )
                        return mysql_real_escape_string( $string, $this->dbh );
                else
                        return addslashes( $string );
        }
 
-       function _escape($data) {
-               if ( is_array($data) ) {
+       /**
+        * Escape data. Works on arrays.
+        *
+     * @uses wpdb::_escape()
+     * @uses wpdb::_real_escape()
+        * @since  2.8
+        * @access private
+        *
+        * @param  string|array $data
+        * @return string|array escaped
+        */
+       function _escape( $data ) {
+               if ( is_array( $data ) ) {
                        foreach ( (array) $data as $k => $v ) {
                                if ( is_array($v) )
                                        $data[$k] = $this->_escape( $v );
@@ -496,17 +814,18 @@ class wpdb {
        }
 
        /**
-        * Escapes content for insertion into the database using addslashes(), for security
+        * Escapes content for insertion into the database using addslashes(), for security.
         *
-        * @since 0.71
+        * Works on arrays.
         *
-        * @param string|array $data
-        * @return string query safe string
+        * @since 0.71
+        * @param string|array $data to escape
+        * @return string|array escaped as query safe string
         */
-       function escape($data) {
-               if ( is_array($data) ) {
+       function escape( $data ) {
+               if ( is_array( $data ) ) {
                        foreach ( (array) $data as $k => $v ) {
-                               if ( is_array($v) )
+                               if ( is_array( $v ) )
                                        $data[$k] = $this->escape( $v );
                                else
                                        $data[$k] = $this->_weak_escape( $v );
@@ -521,16 +840,25 @@ class wpdb {
        /**
         * Escapes content by reference for insertion into the database, for security
         *
+        * @uses wpdb::_real_escape()
         * @since 2.3.0
-        *
-        * @param string $s
+        * @param string $string to escape
+        * @return void
         */
-       function escape_by_ref(&$string) {
+       function escape_by_ref( &$string ) {
                $string = $this->_real_escape( $string );
        }
 
        /**
-        * Prepares a SQL query for safe execution.  Uses sprintf()-like syntax.
+        * Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
+        *
+        * The following directives can be used in the query format string:
+        *   %d (decimal number)
+        *   %s (string)
+        *   %% (literal percentage sign - no argument needed)
+        *
+        * Both %d and %s are to be left unquoted in the query string and they need an argument passed for them.
+        * Literals (%) as parts of the query must be properly written as %%.
         *
         * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
         * Does not support sign, padding, alignment, width or precision specifiers.
@@ -541,30 +869,36 @@ class wpdb {
         * Both %d and %s should be left unquoted in the query string.
         *
         * <code>
-        * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", "foo", 1337 )
+        * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", 'foo', 1337 )
+        * wpdb::prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' );
         * </code>
         *
         * @link http://php.net/sprintf Description of syntax.
         * @since 2.3.0
         *
         * @param string $query Query statement with sprintf()-like placeholders
-        * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-        * @param mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-        * @return null|string Sanitized query string
+        * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like
+        *      {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if
+        *      being called like {@link http://php.net/sprintf sprintf()}.
+        * @param mixed $args,... further variables to substitute into the query's placeholders if being called like
+        *      {@link http://php.net/sprintf sprintf()}.
+        * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string
+        *      if there was something to prepare
         */
-       function prepare($query = null) { // ( $query, *$args )
+       function prepare( $query = null ) { // ( $query, *$args )
                if ( is_null( $query ) )
                        return;
+
                $args = func_get_args();
-               array_shift($args);
+               array_shift( $args );
                // If args were passed as an array (as in vsprintf), move them up
-               if ( isset($args[0]) && is_array($args[0]) )
+               if ( isset( $args[0] ) && is_array($args[0]) )
                        $args = $args[0];
-               $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
-               $query = str_replace('"%s"', '%s', $query); // doublequote unquoting
-               $query = str_replace('%s', "'%s'", $query); // quote the strings
-               array_walk($args, array(&$this, 'escape_by_ref'));
-               return @vsprintf($query, $args);
+               $query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
+               $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
+               $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
+               array_walk( $args, array( &$this, 'escape_by_ref' ) );
+               return @vsprintf( $query, $args );
        }
 
        /**
@@ -576,43 +910,47 @@ class wpdb {
         * @param string $str The error to display
         * @return bool False if the showing of errors is disabled.
         */
-       function print_error($str = '') {
+       function print_error( $str = '' ) {
                global $EZSQL_ERROR;
 
-               if (!$str) $str = mysql_error($this->dbh);
-               $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str);
+               if ( !$str )
+                       $str = mysql_error( $this->dbh );
+               $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );
 
                if ( $this->suppress_errors )
                        return false;
 
                if ( $caller = $this->get_caller() )
-                       $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller);
+                       $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller );
                else
-                       $error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query);
+                       $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query );
 
-               $log_error = true;
-               if ( ! function_exists('error_log') )
-                       $log_error = false;
+               if ( function_exists( 'error_log' )
+                       && ( $log_file = @ini_get( 'error_log' ) )
+                       && ( 'syslog' == $log_file || @is_writable( $log_file ) )
+                       )
+                       @error_log( $error_str );
 
-               $log_file = @ini_get('error_log');
-               if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) )
-                       $log_error = false;
-
-               if ( $log_error )
-                       @error_log($error_str, 0);
-
-               // Is error output turned on or not..
-               if ( !$this->show_errors )
+               // Are we showing errors?
+               if ( ! $this->show_errors )
                        return false;
 
-               $str = htmlspecialchars($str, ENT_QUOTES);
-               $query = htmlspecialchars($this->last_query, ENT_QUOTES);
-
                // If there is an error then take note of it
-               print "<div id='error'>
-               <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
-               <code>$query</code></p>
-               </div>";
+               if ( is_multisite() ) {
+                       $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
+                       if ( defined( 'ERRORLOGFILE' ) )
+                               error_log( $msg, 3, ERRORLOGFILE );
+                       if ( defined( 'DIEONDBERROR' ) )
+                               wp_die( $msg );
+               } else {
+                       $str   = htmlspecialchars( $str, ENT_QUOTES );
+                       $query = htmlspecialchars( $this->last_query, ENT_QUOTES );
+
+                       print "<div id='error'>
+                       <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
+                       <code>$query</code></p>
+                       </div>";
+               }
        }
 
        /**
@@ -624,6 +962,7 @@ class wpdb {
         * errors.
         *
         * @since 0.71
+        * @see wpdb::hide_errors()
         *
         * @param bool $show Whether to show or hide errors
         * @return bool Old value for showing errors.
@@ -637,9 +976,12 @@ class wpdb {
        /**
         * Disables showing of database errors.
         *
+        * By default database errors are not shown.
+        *
         * @since 0.71
+        * @see wpdb::show_errors()
         *
-        * @return bool Whether showing of errors was active or not
+        * @return bool Whether showing of errors was active
         */
        function hide_errors() {
                $show = $this->show_errors;
@@ -650,12 +992,17 @@ class wpdb {
        /**
         * Whether to suppress database errors.
         *
-        * @param unknown_type $suppress
-        * @return unknown
+        * By default database errors are suppressed, with a simple
+        * call to this function they can be enabled.
+        *
+        * @since 2.5
+        * @see wpdb::hide_errors()
+        * @param bool $suppress Optional. New value. Defaults to true.
+        * @return bool Old value
         */
        function suppress_errors( $suppress = true ) {
                $errors = $this->suppress_errors;
-               $this->suppress_errors = $suppress;
+               $this->suppress_errors = (bool) $suppress;
                return $errors;
        }
 
@@ -663,11 +1010,48 @@ class wpdb {
         * Kill cached query results.
         *
         * @since 0.71
+        * @return void
         */
        function flush() {
                $this->last_result = array();
-               $this->col_info = null;
-               $this->last_query = null;
+               $this->col_info    = null;
+               $this->last_query  = null;
+       }
+
+       function db_connect( $query = "SELECT" ) {
+               global $db_list, $global_db_list;
+               if ( ! is_array( $db_list ) )
+                       return true;
+
+               if ( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
+                       $action = 'global';
+                       $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
+                       $this->db_global = $details;
+               } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
+                       $action = 'write';
+                       $details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ];
+                       $this->db_write = $details;
+               } else {
+                       $action = '';
+                       $details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ];
+                       $this->db_read = $details;
+               }
+
+               $dbhname = "dbh" . $action;
+               $this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] );
+               if (!$this->$dbhname ) {
+                       $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
+<h1>Error establishing a database connection</h1>
+<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
+<ul>
+       <li>Are you sure you have the correct username and password?</li>
+       <li>Are you sure that you have typed the correct hostname?</li>
+       <li>Are you sure that the database server is running?</li>
+</ul>
+<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
+"/*/WP_I18N_DB_CONN_ERROR*/, $details['db_host'] ), 'db_connect_fail' );
+               }
+               $this->select( $details[ 'db_name' ], $this->$dbhname );
        }
 
        /**
@@ -677,19 +1061,17 @@ class wpdb {
         *
         * @since 0.71
         *
-        * @param string $query
+        * @param string $query Database query
         * @return int|false Number of rows affected/selected or false on error
         */
-       function query($query) {
+       function query( $query ) {
                if ( ! $this->ready )
                        return false;
 
-               // filter the query, if filters are available
-               // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
-               if ( function_exists('apply_filters') )
-                       $query = apply_filters('query', $query);
+               // some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
+               if ( function_exists( 'apply_filters' ) )
+                       $query = apply_filters( 'query', $query );
 
-               // initialise return
                $return_val = 0;
                $this->flush();
 
@@ -699,49 +1081,72 @@ class wpdb {
                // Keep track of the last query for debug..
                $this->last_query = $query;
 
-               // Perform the query via std mysql_query function..
-               if ( defined('SAVEQUERIES') && SAVEQUERIES )
+               if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES )
                        $this->timer_start();
 
-               $this->result = @mysql_query($query, $this->dbh);
-               ++$this->num_queries;
+               // use $this->dbh for read ops, and $this->dbhwrite for write ops
+               // use $this->dbhglobal for gloal table ops
+               unset( $dbh );
+               if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) {
+                       if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
+                               if( false == isset( $this->dbhglobal ) ) {
+                                       $this->db_connect( $query );
+                               }
+                               $dbh =& $this->dbhglobal;
+                               $this->last_db_used = "global";
+                       } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
+                               if( false == isset( $this->dbhwrite ) ) {
+                                       $this->db_connect( $query );
+                               }
+                               $dbh =& $this->dbhwrite;
+                               $this->last_db_used = "write";
+                       } else {
+                               $dbh =& $this->dbh;
+                               $this->last_db_used = "read";
+                       }
+               } else {
+                       $dbh =& $this->dbh;
+                       $this->last_db_used = "other/read";
+               }
 
-               if ( defined('SAVEQUERIES') && SAVEQUERIES )
+               $this->result = @mysql_query( $query, $dbh );
+               $this->num_queries++;
+
+               if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES )
                        $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
 
                // If there is an error then take note of it..
-               if ( $this->last_error = mysql_error($this->dbh) ) {
+               if ( $this->last_error = mysql_error( $dbh ) ) {
                        $this->print_error();
                        return false;
                }
 
-               if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) {
-                       $this->rows_affected = mysql_affected_rows($this->dbh);
+               if ( preg_match( "/^\\s*(insert|delete|update|replace|alter) /i", $query ) ) {
+                       $this->rows_affected = mysql_affected_rows( $dbh );
                        // Take note of the insert_id
-                       if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
-                               $this->insert_id = mysql_insert_id($this->dbh);
+                       if ( preg_match( "/^\\s*(insert|replace) /i", $query ) ) {
+                               $this->insert_id = mysql_insert_id($dbh);
                        }
                        // Return number of rows affected
                        $return_val = $this->rows_affected;
                } else {
                        $i = 0;
-                       while ($i < @mysql_num_fields($this->result)) {
-                               $this->col_info[$i] = @mysql_fetch_field($this->result);
+                       while ( $i < @mysql_num_fields( $this->result ) ) {
+                               $this->col_info[$i] = @mysql_fetch_field( $this->result );
                                $i++;
                        }
                        $num_rows = 0;
-                       while ( $row = @mysql_fetch_object($this->result) ) {
+                       while ( $row = @mysql_fetch_object( $this->result ) ) {
                                $this->last_result[$num_rows] = $row;
                                $num_rows++;
                        }
 
-                       @mysql_free_result($this->result);
+                       @mysql_free_result( $this->result );
 
                        // Log number of rows the query returned
+                       // and return number of rows selected
                        $this->num_rows = $num_rows;
-
-                       // Return number of rows selected
-                       $return_val = $this->num_rows;
+                       $return_val     = $num_rows;
                }
 
                return $return_val;
@@ -751,61 +1156,114 @@ class wpdb {
         * Insert a row into a table.
         *
         * <code>
+        * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
         * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
         * </code>
         *
         * @since 2.5.0
         * @see wpdb::prepare()
+        * @see wpdb::$field_types
+        * @see wp_set_wpdb_vars()
         *
         * @param string $table table name
-        * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
-        * @param array|string $format (optional) An array of formats to be mapped to each of the value in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+        * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
+        *      A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
         * @return int|false The number of rows inserted, or false on error.
         */
-       function insert($table, $data, $format = null) {
+       function insert( $table, $data, $format = null ) {
+               return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' );
+       }
+
+       /**
+        * Replace a row into a table.
+        *
+        * <code>
+        * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
+        * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
+        * </code>
+        *
+        * @since 3.0.0
+        * @see wpdb::prepare()
+        * @see wpdb::$field_types
+        * @see wp_set_wpdb_vars()
+        *
+        * @param string $table table name
+        * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
+        *      A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
+        * @return int|false The number of rows affected, or false on error.
+        */
+       function replace( $table, $data, $format = null ) {
+               return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' );
+       }
+
+       /**
+        * Helper function for insert and replace.
+        *
+        * Runs an insert or replace query based on $type argument.
+        *
+        * @access private
+        * @since 3.0.0
+        * @see wpdb::prepare()
+        * @see wpdb::$field_types
+        * @see wp_set_wpdb_vars()
+        *
+        * @param string $table table name
+        * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
+        *      A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
+        * @return int|false The number of rows affected, or false on error.
+        */
+       function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
+               if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ) ) )
+                       return false;
                $formats = $format = (array) $format;
-               $fields = array_keys($data);
+               $fields = array_keys( $data );
                $formatted_fields = array();
                foreach ( $fields as $field ) {
-                       if ( !empty($format) )
-                               $form = ( $form = array_shift($formats) ) ? $form : $format[0];
-                       elseif ( isset($this->field_types[$field]) )
+                       if ( !empty( $format ) )
+                               $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
+                       elseif ( isset( $this->field_types[$field] ) )
                                $form = $this->field_types[$field];
                        else
                                $form = '%s';
                        $formatted_fields[] = $form;
                }
-               $sql = "INSERT INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
-               return $this->query( $this->prepare( $sql, $data) );
+               $sql = "{$type} INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
+               return $this->query( $this->prepare( $sql, $data ) );
        }
 
-
        /**
         * Update a row in the table
         *
         * <code>
+        * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) )
         * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
         * </code>
         *
         * @since 2.5.0
         * @see wpdb::prepare()
+        * @see wpdb::$field_types
+        * @see wp_set_wpdb_vars()
         *
         * @param string $table table name
-        * @param array $data Data to update (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
-        * @param array $where A named array of WHERE clauses (in column => value pairs).  Multiple clauses will be joined with ANDs.  Both $where columns and $where values should be "raw".
-        * @param array|string $format (optional) An array of formats to be mapped to each of the values in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
-        * @param array|string $format_where (optional) An array of formats to be mapped to each of the values in $where.  If string, that format will be used for all of  the items in $where.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $where will be treated as strings.
+        * @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw".
+        * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data.
+        *      A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
+        * @param array|string $format_where Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $where will be treated as strings.
         * @return int|false The number of rows updated, or false on error.
         */
-       function update($table, $data, $where, $format = null, $where_format = null) {
-               if ( !is_array( $where ) )
+       function update( $table, $data, $where, $format = null, $where_format = null ) {
+               if ( ! is_array( $data ) || ! is_array( $where ) )
                        return false;
 
                $formats = $format = (array) $format;
                $bits = $wheres = array();
-               foreach ( (array) array_keys($data) as $field ) {
-                       if ( !empty($format) )
-                               $form = ( $form = array_shift($formats) ) ? $form : $format[0];
+               foreach ( (array) array_keys( $data ) as $field ) {
+                       if ( !empty( $format ) )
+                               $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
                        elseif ( isset($this->field_types[$field]) )
                                $form = $this->field_types[$field];
                        else
@@ -814,10 +1272,10 @@ class wpdb {
                }
 
                $where_formats = $where_format = (array) $where_format;
-               foreach ( (array) array_keys($where) as $field ) {
-                       if ( !empty($where_format) )
-                               $form = ( $form = array_shift($where_formats) ) ? $form : $where_format[0];
-                       elseif ( isset($this->field_types[$field]) )
+               foreach ( (array) array_keys( $where ) as $field ) {
+                       if ( !empty( $where_format ) )
+                               $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0];
+                       elseif ( isset( $this->field_types[$field] ) )
                                $form = $this->field_types[$field];
                        else
                                $form = '%s';
@@ -825,7 +1283,7 @@ class wpdb {
                }
 
                $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
-               return $this->query( $this->prepare( $sql, array_merge(array_values($data), array_values($where))) );
+               return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
        }
 
        /**
@@ -837,23 +1295,23 @@ class wpdb {
         *
         * @since 0.71
         *
-        * @param string|null $query SQL query.  If null, use the result from the previous query.
-        * @param int $x (optional) Column of value to return.  Indexed from 0.
-        * @param int $y (optional) Row of value to return.  Indexed from 0.
-        * @return string Database query result
+        * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query.
+        * @param int $x Optional. Column of value to return.  Indexed from 0.
+        * @param int $y Optional. Row of value to return.  Indexed from 0.
+        * @return string|null Database query result (as string), or null on failure
         */
-       function get_var($query=null, $x = 0, $y = 0) {
-               $this->func_call = "\$db->get_var(\"$query\",$x,$y)";
+       function get_var( $query = null, $x = 0, $y = 0 ) {
+               $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
                if ( $query )
-                       $this->query($query);
+                       $this->query( $query );
 
                // Extract var out of cached results based x,y vals
                if ( !empty( $this->last_result[$y] ) ) {
-                       $values = array_values(get_object_vars($this->last_result[$y]));
+                       $values = array_values( get_object_vars( $this->last_result[$y] ) );
                }
 
                // If there is a value return it else return null
-               return (isset($values[$x]) && $values[$x]!=='') ? $values[$x] : null;
+               return ( isset( $values[$x] ) && $values[$x] !== '' ) ? $values[$x] : null;
        }
 
        /**
@@ -864,26 +1322,27 @@ class wpdb {
         * @since 0.71
         *
         * @param string|null $query SQL query.
-        * @param string $output (optional) one of ARRAY_A | ARRAY_N | OBJECT constants.  Return an associative array (column => value, ...), a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
-        * @param int $y (optional) Row to return.  Indexed from 0.
-        * @return mixed Database query result in format specifed by $output
+        * @param string $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants. Return an associative array (column => value, ...),
+        *      a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
+        * @param int $y Optional. Row to return. Indexed from 0.
+        * @return mixed Database query result in format specifed by $output or null on failure
         */
-       function get_row($query = null, $output = OBJECT, $y = 0) {
+       function get_row( $query = null, $output = OBJECT, $y = 0 ) {
                $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
                if ( $query )
-                       $this->query($query);
+                       $this->query( $query );
                else
                        return null;
 
-               if ( !isset($this->last_result[$y]) )
+               if ( !isset( $this->last_result[$y] ) )
                        return null;
 
                if ( $output == OBJECT ) {
                        return $this->last_result[$y] ? $this->last_result[$y] : null;
                } elseif ( $output == ARRAY_A ) {
-                       return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null;
+                       return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
                } elseif ( $output == ARRAY_N ) {
-                       return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null;
+                       return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
                } else {
                        $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);
                }
@@ -898,18 +1357,18 @@ class wpdb {
         *
         * @since 0.71
         *
-        * @param string|null $query SQL query.  If null, use the result from the previous query.
-        * @param int $x Column to return.  Indexed from 0.
-        * @return array Database query result.  Array indexed from 0 by SQL result row number.
+        * @param string|null $query Optional. SQL query. Defaults to previous query.
+        * @param int $x Optional. Column to return. Indexed from 0.
+        * @return array Database query result. Array indexed from 0 by SQL result row number.
         */
-       function get_col($query = null , $x = 0) {
+       function get_col( $query = null , $x = 0 ) {
                if ( $query )
-                       $this->query($query);
+                       $this->query( $query );
 
                $new_array = array();
                // Extract the column values
-               for ( $i=0; $i < count($this->last_result); $i++ ) {
-                       $new_array[$i] = $this->get_var(null, $x, $i);
+               for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) {
+                       $new_array[$i] = $this->get_var( null, $x, $i );
                }
                return $new_array;
        }
@@ -922,17 +1381,20 @@ class wpdb {
         * @since 0.71
         *
         * @param string $query SQL query.
-        * @param string $output (optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants.  With one of the first three, return an array of rows indexed from 0 by SQL result row number.  Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.  With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value.  Duplicate keys are discarded.
+        * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number.
+        *      Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.
+        *      With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value.  Duplicate keys are discarded.
         * @return mixed Database query results
         */
-       function get_results($query = null, $output = OBJECT) {
+       function get_results( $query = null, $output = OBJECT ) {
                $this->func_call = "\$db->get_results(\"$query\", $output)";
 
                if ( $query )
-                       $this->query($query);
+                       $this->query( $query );
                else
                        return null;
 
+               $new_array = array();
                if ( $output == OBJECT ) {
                        // Return an integer-keyed array of row objects
                        return $this->last_result;
@@ -941,27 +1403,26 @@ class wpdb {
                        // (Duplicates are discarded)
                        foreach ( $this->last_result as $row ) {
                                $key = array_shift( get_object_vars( $row ) );
-                               if ( !isset( $new_array[ $key ] ) )
+                               if ( ! isset( $new_array[ $key ] ) )
                                        $new_array[ $key ] = $row;
                        }
                        return $new_array;
                } elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
                        // Return an integer-keyed array of...
                        if ( $this->last_result ) {
-                               $i = 0;
                                foreach( (array) $this->last_result as $row ) {
                                        if ( $output == ARRAY_N ) {
                                                // ...integer-keyed row arrays
-                                               $new_array[$i] = array_values( get_object_vars( $row ) );
+                                               $new_array[] = array_values( get_object_vars( $row ) );
                                        } else {
                                                // ...column name-keyed row arrays
-                                               $new_array[$i] = get_object_vars( $row );
+                                               $new_array[] = get_object_vars( $row );
                                        }
-                                       ++$i;
                                }
-                               return $new_array;
                        }
+                       return $new_array;
                }
+               return null;
        }
 
        /**
@@ -969,14 +1430,15 @@ class wpdb {
         *
         * @since 0.71
         *
-        * @param string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
-        * @param int $col_offset 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
+        * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
+        * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
         * @return mixed Column Results
         */
-       function get_col_info($info_type = 'name', $col_offset = -1) {
+       function get_col_info( $info_type = 'name', $col_offset = -1 ) {
                if ( $this->col_info ) {
                        if ( $col_offset == -1 ) {
                                $i = 0;
+                               $new_array = array();
                                foreach( (array) $this->col_info as $col ) {
                                        $new_array[$i] = $col->{$info_type};
                                        $i++;
@@ -996,8 +1458,7 @@ class wpdb {
         * @return true
         */
        function timer_start() {
-               $mtime = microtime();
-               $mtime = explode(' ', $mtime);
+               $mtime            = explode( ' ', microtime() );
                $this->time_start = $mtime[1] + $mtime[0];
                return true;
        }
@@ -1010,9 +1471,8 @@ class wpdb {
         * @return int Total time spent on the query, in milliseconds
         */
        function timer_stop() {
-               $mtime = microtime();
-               $mtime = explode(' ', $mtime);
-               $time_end = $mtime[1] + $mtime[0];
+               $mtime      = explode( ' ', microtime() );
+               $time_end   = $mtime[1] + $mtime[0];
                $time_total = $time_end - $this->time_start;
                return $time_total;
        }
@@ -1025,12 +1485,12 @@ class wpdb {
         * @since 1.5.0
         *
         * @param string $message The Error message
-        * @param string $error_code (optional) A Computer readable string to identify the error.
+        * @param string $error_code Optional. A Computer readable string to identify the error.
         * @return false|void
         */
-       function bail($message, $error_code = '500') {
+       function bail( $message, $error_code = '500' ) {
                if ( !$this->show_errors ) {
-                       if ( class_exists('WP_Error') )
+                       if ( class_exists( 'WP_Error' ) )
                                $this->error = new WP_Error($error_code, $message);
                        else
                                $this->error = $message;
@@ -1040,23 +1500,23 @@ class wpdb {
        }
 
        /**
-        * Whether or not MySQL database is at least the required minimum version.
+        * Whether MySQL database is at least the required minimum version.
         *
         * @since 2.5.0
         * @uses $wp_version
+        * @uses $required_mysql_version
         *
         * @return WP_Error
         */
-       function check_database_version()
-       {
-               global $wp_version;
-               // Make sure the server has MySQL 4.1.2
-               if ( version_compare($this->db_version(), '4.1.2', '<') )
-                       return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.1.2 or higher'), $wp_version));
+       function check_database_version() {
+               global $wp_version, $required_mysql_version;
+               // Make sure the server has the required MySQL version
+               if ( version_compare($this->db_version(), $required_mysql_version, '<') )
+                       return new WP_Error('database_version', sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ));
        }
 
        /**
-        * Whether of not the database supports collation.
+        * Whether the database supports collation.
         *
         * Called when WordPress is generating the table scheme.
         *
@@ -1069,21 +1529,23 @@ class wpdb {
        }
 
        /**
-        * Generic function to determine if a database supports a particular feature
+        * Determine if a database supports a particular feature
+        *
+        * @since 2.7
+        * @see   wpdb::db_version()
+        *
         * @param string $db_cap the feature
-        * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
         * @return bool
         */
        function has_cap( $db_cap ) {
                $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;
+               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', '>=' );
+               };
 
                return false;
        }
@@ -1091,7 +1553,7 @@ class wpdb {
        /**
         * Retrieve the name of the function that called wpdb.
         *
-        * Requires PHP 4.3 and searches up the list of functions until it reaches
+        * Searches up the list of functions until it reaches
         * the one that would most logically had called this method.
         *
         * @since 2.5.0
@@ -1099,43 +1561,34 @@ class wpdb {
         * @return string The name of the calling function
         */
        function get_caller() {
-               // requires PHP 4.3+
-               if ( !is_callable('debug_backtrace') )
-                       return '';
-
-               $bt = debug_backtrace();
+               $trace  = array_reverse( debug_backtrace() );
                $caller = array();
 
-               $bt = array_reverse( $bt );
-               foreach ( (array) $bt as $call ) {
-                       if ( @$call['class'] == __CLASS__ )
-                               continue;
-                       $function = $call['function'];
-                       if ( isset( $call['class'] ) )
-                               $function = $call['class'] . "->$function";
-                       $caller[] = $function;
+               foreach ( $trace as $call ) {
+                       if ( isset( $call['class'] ) && __CLASS__ == $call['class'] )
+                               continue; // Filter out wpdb calls.
+                       $caller[] = isset( $call['class'] ) ? "{$call['class']}->{$call['function']}" : $call['function'];
                }
-               $caller = join( ', ', $caller );
 
-               return $caller;
+               return join( ', ', $caller );
        }
 
        /**
-        * The database version number
-        * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
+        * 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 ));
+               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/db.php
         * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
         * @since 0.71
         */
-       $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
+       $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
 }
 ?>
index 3843223c61d04be3390f817f46a0500af2c97164..9e2d447403e51512a312c8937cebe240294ad4c9 100644 (file)
@@ -247,12 +247,19 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                                continue;
 
                        // If we have a word based diff, use it.  Otherwise, use the normal line.
-                       $orig_line  = isset($orig_diffs[$orig_rows[$row]])
-                               ? $orig_diffs[$orig_rows[$row]]
-                               : htmlspecialchars($orig[$orig_rows[$row]]);
-                       $final_line = isset($final_diffs[$final_rows[$row]])
-                               ? $final_diffs[$final_rows[$row]]
-                               : htmlspecialchars($final[$final_rows[$row]]);
+                       if ( isset( $orig_diffs[$orig_rows[$row]] ) )
+                               $orig_line = $orig_diffs[$orig_rows[$row]];
+                       elseif ( isset( $orig[$orig_rows[$row]] ) )
+                               $orig_line = htmlspecialchars($orig[$orig_rows[$row]]);
+                       else
+                               $orig_line = '';
+
+                       if ( isset( $final_diffs[$final_rows[$row]] ) )
+                               $final_line = $final_diffs[$final_rows[$row]];
+                       elseif ( isset( $final[$final_rows[$row]] ) )
+                               $final_line = htmlspecialchars($final[$final_rows[$row]]);
+                       else
+                               $final_line = '';
 
                        if ( $orig_rows[$row] < 0 ) { // Orig is blank.  This is really an added row.
                                $r .= $this->_added( array($final_line), false );
index b9170528ce7bda2099e26f5f0eadccb96d4648a0..069d7a5ff4222c51bbabe9b131e489ab7c2cdf53 100644 (file)
  * @package WordPress
  */
 
-if (empty($wp)) {
+if ( empty($wp) ) {
        require_once('./wp-load.php');
        wp();
 }
 
 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-$link_cat = $_GET['link_cat'];
-if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
-       $link_cat = '';
-} else { // be safe
-       $link_cat = '' . urldecode($link_cat) . '';
-       $link_cat = intval($link_cat);
+$link_cat = '';
+if ( !empty($_GET['link_cat']) ) {
+       $link_cat = $_GET['link_cat'];
+       if ( !in_array($link_cat, array('all', '0')) )
+               $link_cat = absint( (string)urldecode($link_cat) );
 }
-?><?php echo '<?xml version="1.0"?'.">\n"; ?>
-<?php the_generator( 'comment' ); ?>
+
+echo '<?xml version="1.0"?'.">\n";
+?>
 <opml version="1.0">
        <head>
-               <title>Links for <?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?></title>
+               <title><?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?></title>
                <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
+               <?php do_action('opml_head'); ?>
        </head>
        <body>
 <?php
-
-if (empty ($link_cat))
-       $cats = get_categories("type=link&hierarchical=0");
+if ( empty($link_cat) )
+       $cats = get_categories(array('type' => 'link', 'hierarchical' => 0));
 else
-       $cats = get_categories('type=link&hierarchical=0&include='.$link_cat);
+       $cats = get_categories(array('type' => 'link', 'hierarchical' => 0, 'include' => $link_cat));
 
-foreach ((array) $cats as $cat) {
+foreach ( (array)$cats as $cat ) :
        $catname = apply_filters('link_category', $cat->name);
 
 ?>
 <outline type="category" title="<?php echo esc_attr($catname); ?>">
 <?php
-
-       $bookmarks = get_bookmarks("category={$cat->term_id}");
-       foreach ((array) $bookmarks as $bookmark) {
-               $title = esc_attr(apply_filters('link_title', $bookmark->link_name));
+       $bookmarks = get_bookmarks(array("category" => $cat->term_id));
+       foreach ( (array)$bookmarks as $bookmark ) :
+               $title = apply_filters('link_title', $bookmark->link_name);
 ?>
-       <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
+       <outline text="<?php echo esc_attr($title); ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
 <?php
-
-       }
+       endforeach; // $bookmarks
 ?>
 </outline>
 <?php
-
-}
+endforeach; // $cats
 ?>
 </body>
 </opml>
index aee3b39f59f16ba0ac47330234562b43307de61a..7f396406e6e2d58d8b52105731f07491cdf5d7bf 100644 (file)
@@ -20,9 +20,9 @@
 define( 'ABSPATH', dirname(__FILE__) . '/' );
 
 if ( defined('E_RECOVERABLE_ERROR') )
-       error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
+       error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
 else
-       error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
+       error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
 
 if ( file_exists( ABSPATH . 'wp-config.php') ) {
 
index a20e6ffec27bfe49e53f1161792f3cbb7da7a7b0..c97edd938f12b96282dba59efddff1a210cc9b2d 100644 (file)
@@ -39,14 +39,22 @@ if ( force_ssl_admin() && !is_ssl() ) {
  * @param WP_Error $wp_error Optional. WordPress Error Object
  */
 function login_header($title = 'Log In', $message = '', $wp_error = '') {
-       global $error, $is_iphone, $interim_login;
+       global $error, $is_iphone, $interim_login, $current_site;
 
        // Don't index any of these forms
-       add_filter( 'pre_option_blog_public', create_function( '$a', 'return 0;' ) );
+       add_filter( 'pre_option_blog_public', '__return_zero' );
        add_action( 'login_head', 'noindex' );
 
        if ( empty($wp_error) )
                $wp_error = new WP_Error();
+
+       // Shake it!
+       $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
+       $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
+
+       if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
+               add_action( 'login_head', 'wp_shake_js', 12 );
+
        ?>
 <!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(); ?>>
@@ -74,9 +82,12 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
        do_action('login_head'); ?>
 </head>
 <body class="login">
-
+<?php   if ( !is_multisite() ) { ?>
 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
-<?php
+<?php   } else { ?>
+<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', network_home_url() ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
+<?php   }
+
        $message = apply_filters('login_message', $message);
        if ( !empty( $message ) ) echo $message . "\n";
 
@@ -104,6 +115,20 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
                        echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
        }
 } // End of login_header()
+function wp_shake_js() {
+       global $is_iphone;
+       if ( $is_iphone )
+               return;
+?>
+<script type="text/javascript">
+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 s(id,pos){g(id).left=pos+'px';}
+function g(id){return document.getElementById(id).style;}
+function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
+addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
+</script>
+<?php
+}
 
 /**
  * Handles sending password retrieval email to user.
@@ -113,7 +138,7 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
  * @return bool|WP_Error True: when finish. WP_Error on error
  */
 function retrieve_password() {
-       global $wpdb;
+       global $wpdb, $current_site;
 
        $errors = new WP_Error();
 
@@ -162,22 +187,25 @@ function retrieve_password() {
                $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
        }
        $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
-       $message .= get_option('siteurl') . "\r\n\r\n";
+       $message .= network_site_url() . "\r\n\r\n";
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
        $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
-       $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
+       $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
 
-       // The blogname option is escaped with esc_html on the way into the database in sanitize_option
-       // we want to reverse this for the plain text arena of emails.
-       $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
+       if ( is_multisite() )
+               $blogname = $GLOBALS['current_site']->site_name;
+       else
+               // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+               // we want to reverse this for the plain text arena of emails.
+               $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
-       $title = sprintf(__('[%s] Password Reset'), $blogname);
+       $title = sprintf( __('[%s] Password Reset'), $blogname );
 
        $title = apply_filters('retrieve_password_title', $title);
        $message = apply_filters('retrieve_password_message', $message, $key);
 
        if ( $message && !wp_mail($user_email, $title, $message) )
-               die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
+               wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );
 
        return true;
 }
@@ -211,22 +239,25 @@ function reset_password($key, $login) {
        do_action('password_reset', $user, $new_pass);
 
        wp_set_password($new_pass, $user->ID);
-       update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
+       update_user_option($user->ID, 'default_password_nag', true, true); //Set up the Password change nag.
        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
        $message .= site_url('wp-login.php', 'login') . "\r\n";
 
-       // The blogname option is escaped with esc_html on the way into the database in sanitize_option
-       // we want to reverse this for the plain text arena of emails.
-       $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
+       if ( is_multisite() )
+               $blogname = $GLOBALS['current_site']->site_name;
+       else
+               // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+               // we want to reverse this for the plain text arena of emails.
+               $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
-       $title = sprintf(__('[%s] Your new password'), $blogname);
+       $title = sprintf( __('[%s] Your new password'), $blogname );
 
        $title = apply_filters('password_reset_title', $title);
        $message = apply_filters('password_reset_message', $message, $new_pass);
 
        if ( $message && !wp_mail($user->user_email, $title, $message) )
-               die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
+               wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );
 
        wp_password_change_notification($user);
 
@@ -240,45 +271,49 @@ function reset_password($key, $login) {
  * @param string $user_email User's email address to send password and add
  * @return int|WP_Error Either user's ID or error on failure.
  */
-function register_new_user($user_login, $user_email) {
+function register_new_user( $user_login, $user_email ) {
        $errors = new WP_Error();
 
-       $user_login = sanitize_user( $user_login );
+       $sanitized_user_login = sanitize_user( $user_login );
        $user_email = apply_filters( 'user_registration_email', $user_email );
 
        // Check the username
-       if ( $user_login == '' )
-               $errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
-       elseif ( !validate_username( $user_login ) ) {
-               $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.'));
-               $user_login = '';
-       } elseif ( username_exists( $user_login ) )
-               $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
+       if ( $sanitized_user_login == '' ) {
+               $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
+       } elseif ( ! validate_username( $user_login ) ) {
+               $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
+               $sanitized_user_login = '';
+       } elseif ( username_exists( $sanitized_user_login ) ) {
+               $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered, please choose another one.' ) );
+       }
 
        // Check the e-mail address
-       if ($user_email == '') {
-               $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
-       } elseif ( !is_email( $user_email ) ) {
-               $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.'));
+       if ( $user_email == '' ) {
+               $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your e-mail address.' ) );
+       } elseif ( ! is_email( $user_email ) ) {
+               $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
                $user_email = '';
-       } elseif ( email_exists( $user_email ) )
-               $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
+       } elseif ( email_exists( $user_email ) ) {
+               $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
+       }
 
-       do_action('register_post', $user_login, $user_email, $errors);
+       do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
 
-       $errors = apply_filters( 'registration_errors', $errors, $user_login, $user_email );
+       $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
 
        if ( $errors->get_error_code() )
                return $errors;
 
        $user_pass = wp_generate_password();
-       $user_id = wp_create_user( $user_login, $user_pass, $user_email );
-       if ( !$user_id ) {
-               $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
+       $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
+       if ( ! $user_id ) {
+               $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
                return $errors;
        }
 
-       wp_new_user_notification($user_id, $user_pass);
+       update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
+
+       wp_new_user_notification( $user_id, $user_pass );
 
        return $user_id;
 }
@@ -305,7 +340,7 @@ if ( defined('RELOCATE') ) { // Move flag is set
        if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
                $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
 
-       $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+       $schema = is_ssl() ? 'https://' : 'http://';
        if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_option('siteurl') )
                update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
 }
@@ -325,11 +360,8 @@ case 'logout' :
        check_admin_referer('log-out');
        wp_logout();
 
-       $redirect_to = 'wp-login.php?loggedout=true';
-       if ( isset( $_REQUEST['redirect_to'] ) )
-               $redirect_to = $_REQUEST['redirect_to'];
-
-       wp_safe_redirect($redirect_to);
+       $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
+       wp_safe_redirect( $redirect_to );
        exit();
 
 break;
@@ -339,12 +371,14 @@ case 'retrievepassword' :
        if ( $http_post ) {
                $errors = retrieve_password();
                if ( !is_wp_error($errors) ) {
-                       wp_redirect('wp-login.php?checkemail=confirm');
+                       $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
+                       wp_safe_redirect( $redirect_to );
                        exit();
                }
        }
 
        if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
+       $redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
 
        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);
@@ -359,6 +393,7 @@ case 'retrievepassword' :
                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
        </p>
 <?php do_action('lostpassword_form'); ?>
+       <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
        <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Get New Password'); ?>" tabindex="100" /></p>
 </form>
 
@@ -377,6 +412,7 @@ case 'retrievepassword' :
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
+if(typeof wpOnload=='function')wpOnload();
 </script>
 </body>
 </html>
@@ -398,6 +434,12 @@ case 'rp' :
 break;
 
 case 'register' :
+       if ( is_multisite() ) {
+               // Multisite uses wp-signup.php
+               wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
+               exit;
+       }
+
        if ( !get_option('users_can_register') ) {
                wp_redirect('wp-login.php?registration=disabled');
                exit();
@@ -412,11 +454,13 @@ case 'register' :
                $user_email = $_POST['user_email'];
                $errors = register_new_user($user_login, $user_email);
                if ( !is_wp_error($errors) ) {
-                       wp_redirect('wp-login.php?checkemail=registered');
+                       $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
+                       wp_safe_redirect( $redirect_to );
                        exit();
                }
        }
 
+       $redirect_to = apply_filters( 'registration_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
        login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
 ?>
 
@@ -432,6 +476,7 @@ case 'register' :
 <?php do_action('register_form'); ?>
        <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
        <br class="clear" />
+       <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
        <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
 </form>
 
@@ -446,6 +491,7 @@ case 'register' :
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
+if(typeof wpOnload=='function')wpOnload();
 </script>
 </body>
 </html>
@@ -477,6 +523,11 @@ default:
                $redirect_to = admin_url();
        }
 
+       $reauth = empty($_REQUEST['reauth']) ? false : true;
+
+       // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
+       // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
+       // the admin via http or https.
        if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
                $secure_cookie = false;
 
@@ -484,7 +535,7 @@ default:
 
        $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
 
-       if ( !is_wp_error($user) ) {
+       if ( !is_wp_error($user) && !$reauth ) {
                if ( $interim_login ) {
                        $message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
                        login_header( '', $message ); ?>
@@ -503,7 +554,7 @@ default:
 
        $errors = $user;
        // Clear errors if loggedout is set.
-       if ( !empty($_GET['loggedout']) )
+       if ( !empty($_GET['loggedout']) || $reauth )
                $errors = new WP_Error();
 
        // If cookies are disabled we can't log in even with a valid user+pass
@@ -524,13 +575,17 @@ default:
        elseif  ( $interim_login )
                $errors->add('expired', __('Your session has expired. Please log-in again.'), 'message');
 
+       // Clear any stale cookies.
+       if ( $reauth )
+               wp_clear_auth_cookie();
+
        login_header(__('Log In'), '', $errors);
 
        if ( isset($_POST['log']) )
                $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(stripslashes($_POST['log'])) : '';
+       $rememberme = ! empty( $_POST['rememberme'] );
 ?>
 
-<?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 />
@@ -541,7 +596,7 @@ default:
                <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
        </p>
 <?php do_action('login_form'); ?>
-       <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php esc_attr_e('Remember Me'); ?></label></p>
+       <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
        <p class="submit">
                <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
 <?php  if ( $interim_login ) { ?>
@@ -552,34 +607,41 @@ default:
                <input type="hidden" name="testcookie" value="1" />
        </p>
 </form>
-<?php endif; ?>
 
 <?php if ( !$interim_login ) { ?>
 <p id="nav">
 <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
-<?php elseif (get_option('users_can_register')) : ?>
+<?php elseif ( get_option('users_can_register') ) : ?>
 <a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a> |
 <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
 <?php else : ?>
 <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
 <?php endif; ?>
 </p>
-
+</div>
 <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>
-<?php } ?>
+<?php } else { ?>
 </div>
+<?php } ?>
 
 <script type="text/javascript">
-<?php if ( $user_login || $interim_login ) { ?>
+function wp_attempt_focus(){
 setTimeout( function(){ try{
+<?php if ( $user_login || $interim_login ) { ?>
 d = document.getElementById('user_pass');
+<?php } else { ?>
+d = document.getElementById('user_login');
+<?php } ?>
 d.value = '';
 d.focus();
 } catch(e){}
 }, 200);
-<?php } else { ?>
-try{document.getElementById('user_login').focus();}catch(e){}
+}
+
+<?php if ( !$error ) { ?>
+wp_attempt_focus();
 <?php } ?>
+if(typeof wpOnload=='function')wpOnload();
 </script>
 </body>
 </html>
index cbc47315907c6b0b323a033f1fdd9d19d6921c46..69b54156eb43d3a6a4baebb9d06291169eebcb55 100644 (file)
@@ -10,6 +10,9 @@
 /** Make sure that the WordPress bootstrap has run before continuing. */
 require(dirname(__FILE__) . '/wp-load.php');
 
+if ( ! apply_filters( 'enable_post_by_email_configuration', true ) )
+       wp_die( __( 'This action has been disabled by the administrator.' ) );
+
 /** Allow a plugin to do a complete takeover of Post by Email **/
 do_action('wp-mail.php');
 
@@ -32,13 +35,18 @@ $time_difference = get_option('gmt_offset') * 3600;
 $phone_delim = '::';
 
 $pop3 = new POP3();
-$count = 0;
 
-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&#8217;t seem to be any new mail.') : esc_html($pop3->ERROR) );
+if ( !$pop3->connect( get_option('mailserver_url'), get_option('mailserver_port') ) || !$pop3->user( get_option('mailserver_login') ) )
+       wp_die( esc_html( $pop3->ERROR ) );
+
+$count = $pop3->pass( get_option('mailserver_pass') );
+
+if( false === $count )
+       wp_die( esc_html( $pop3->ERROR ) );
+
+if( 0 === $count ) {
+       $pop3->quit();
+       wp_die( __('There doesn&#8217;t seem to be any new mail.') );
 }
 
 for ( $i = 1; $i <= $count; $i++ ) {
index 9ab9a6906015aa4d72415c72eaaa66462b608126..473f2c6cdd2f7b1fd5a75e228ace0c4253dd4081 100644 (file)
 <?php
 /**
- * Used to setup and fix common variables and include
+ * Used to set up and fix common variables and include
  * the WordPress procedural and class library.
  *
- * You should not have to change this file and allows
- * for some configuration in wp-config.php.
+ * Allows for some configuration in wp-config.php (see default-constants.php)
  *
  * @package WordPress
  */
 
-if ( !defined('WP_MEMORY_LIMIT') )
-       define('WP_MEMORY_LIMIT', '32M');
-
-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);
-
-if ( function_exists('date_default_timezone_set') )
-       date_default_timezone_set('UTC');
-
 /**
- * Turn register globals off.
+ * Stores the location of the WordPress directory of functions, classes, and core content.
  *
- * @access private
- * @since 2.1.0
- * @return null Will return null if register_globals PHP directive was disabled
+ * @since 1.0.0
  */
-function wp_unregister_GLOBALS() {
-       if ( !ini_get('register_globals') )
-               return;
-
-       if ( isset($_REQUEST['GLOBALS']) )
-               die('GLOBALS overwrite attempt detected');
-
-       // Variables that shouldn't be unset
-       $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
-
-       $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
-       foreach ( $input as $k => $v )
-               if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
-                       $GLOBALS[$k] = NULL;
-                       unset($GLOBALS[$k]);
-               }
-}
+define( 'WPINC', 'wp-includes' );
 
-wp_unregister_GLOBALS();
+// Include files required for initialization.
+require( ABSPATH . WPINC . '/load.php' );
+require( ABSPATH . WPINC . '/default-constants.php' );
+require( ABSPATH . WPINC . '/version.php' );
 
-unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
+// Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
+wp_initial_constants( );
 
-/**
- * The $blog_id global, which you can change in the config allows you to create a simple
- * multiple blog installation using just one WordPress and changing $blog_id around.
- *
- * @global int $blog_id
- * @since 2.0.0
- */
-if ( ! isset($blog_id) )
-       $blog_id = 1;
+// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
+set_magic_quotes_runtime( 0 );
+@ini_set( 'magic_quotes_sybase', 0 );
 
-// Fix for IIS when running with PHP ISAPI
-if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+// Set default timezone in PHP 5.
+if ( function_exists( 'date_default_timezone_set' ) )
+       date_default_timezone_set( 'UTC' );
 
-       // IIS Mod-Rewrite
-       if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
-               $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
-       }
-       // IIS Isapi_Rewrite
-       else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
-               $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
-       }
-       else
-       {
-               // Use ORIG_PATH_INFO if there is no PATH_INFO
-               if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
-                       $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
-
-               // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
-               if ( isset($_SERVER['PATH_INFO']) ) {
-                       if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
-                               $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
-                       else
-                               $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
-               }
-
-               // Append the query string if it exists and isn't null
-               if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
-                       $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
-               }
-       }
-}
-
-// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
-if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
-       $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
-
-// Fix for Dreamhost and other PHP as CGI hosts
-if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
-       unset($_SERVER['PATH_INFO']);
+// Turn register_globals off.
+wp_unregister_GLOBALS();
 
-// Fix empty PHP_SELF
-$PHP_SELF = $_SERVER['PHP_SELF'];
-if ( empty($PHP_SELF) )
-       $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+// Ensure these global variables do not exist so they do not interfere with WordPress.
+unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
 
-if ( version_compare( '4.3', phpversion(), '>' ) ) {
-       die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
-}
+// Standardize $_SERVER variables across setups.
+wp_fix_server_vars();
 
-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' );
-               header( 'Retry-After: 600' );
-?>
-<!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();
-       }
-}
+// Check for the required PHP version and for the MySQL extension or a database drop-in.
+wp_check_php_mysql_versions();
 
-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*/ );
+// Check if we have recieved a request due to missing favicon.ico
+wp_favicon_request();
 
-/**
- * PHP 4 standard microtime start capture.
- *
- * @access private
- * @since 0.71
- * @global int $timestart Seconds and Microseconds added together from when function is called.
- * @return bool Always returns true.
- */
-function timer_start() {
-       global $timestart;
-       $mtime = explode(' ', microtime() );
-       $mtime = $mtime[1] + $mtime[0];
-       $timestart = $mtime;
-       return true;
-}
+// Check if we're in maintenance mode.
+wp_maintenance();
 
-/**
- * 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>
- * $nTimePageTookToExecute = timer_stop();
- * echo $nTimePageTookToExecute;
- * </code>
- *
- * Or instead, you can do:
- * <code>
- * timer_stop(1);
- * </code>
- * which will do what the above does. If you need the result, you can assign it to a variable, but
- * most cases, you only need to echo it.
- *
- * @since 0.71
- * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
- * @global int $timeend  Seconds and Microseconds added together from when function is called
- *
- * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
- * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
- * @return float The "second.microsecond" finished time calculation
- */
-function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
-       global $timestart, $timeend;
-       $mtime = microtime();
-       $mtime = explode(' ',$mtime);
-       $mtime = $mtime[1] + $mtime[0];
-       $timeend = $mtime;
-       $timetotal = $timeend-$timestart;
-       $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
-       if ( $display )
-               echo $r;
-       return $r;
-}
+// Start loading timer.
 timer_start();
 
-// Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
-if ( defined('WP_DEBUG') && WP_DEBUG ) {
-       if ( defined('E_DEPRECATED') )
-               error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
-       else
-               error_reporting(E_ALL);
-       // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On
-       if ( ! defined('WP_DEBUG_DISPLAY') || WP_DEBUG_DISPLAY )
-               ini_set('display_errors', 1);
-       // Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log
-       if ( defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ) {
-               ini_set('log_errors', 1);
-               ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
-       }
-} else {
-       define('WP_DEBUG', false);
-       if ( defined('E_RECOVERABLE_ERROR') )
-               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
-       else
-               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
-}
+// Check if we're in WP_DEBUG mode.
+wp_debug_mode();
 
-// For an advanced caching plugin to use, static because you would only want one
-if ( defined('WP_CACHE') && WP_CACHE )
-       @include WP_CONTENT_DIR . '/advanced-cache.php';
+// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
+if ( WP_CACHE )
+       WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
 
-/**
- * Private
- */ 
-if ( !defined('MEDIA_TRASH') )
-       define('MEDIA_TRASH', false);
+// Define WP_LANG_DIR if not set.
+wp_set_lang_dir();
 
-/**
- * Stores the location of the WordPress directory of functions, classes, and core content.
- *
- * @since 1.0.0
- */
-define('WPINC', 'wp-includes');
-
-if ( !defined('WP_LANG_DIR') ) {
-       /**
-        * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
-        * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
-        *
-        * @since 2.1.0
-        */
-       if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
-               define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
-               if (!defined('LANGDIR')) {
-                       // Old static relative path maintained for limited backwards compatibility - won't work in some cases
-                       define('LANGDIR', 'wp-content/languages');
-               }
-       } else {
-               define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
-               if (!defined('LANGDIR')) {
-                       // Old relative path maintained for backwards compatibility
-                       define('LANGDIR', WPINC . '/languages');
-               }
-       }
-}
-
-require (ABSPATH . WPINC . '/compat.php');
-require (ABSPATH . WPINC . '/functions.php');
-require (ABSPATH . WPINC . '/classes.php');
+// Load early WordPress files.
+require( ABSPATH . WPINC . '/compat.php' );
+require( ABSPATH . WPINC . '/functions.php' );
+require( ABSPATH . WPINC . '/classes.php' );
 
+// Include the wpdb class, or a db.php database drop-in if present.
 require_wp_db();
 
-if ( !empty($wpdb->error) )
-       dead_db();
-
-/**
- * Format specifiers for DB columns. Columns not listed here default to %s.
- * @since 2.8.0
- * @see wpdb:$field_types
- * @see wpdb:prepare()
- * @see wpdb:insert()
- * @see wpdb:update()
- */
-$wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
-       'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
-       'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
-       'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d');
+// Set the database table prefix and the format specifiers for database table columns.
+wp_set_wpdb_vars();
 
-$prefix = $wpdb->set_prefix($table_prefix);
+// Start the WordPress object cache, or an external object cache if the drop-in is present.
+wp_start_object_cache();
 
-if ( is_wp_error($prefix) )
-       wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
+// Load early WordPress files.
+require( ABSPATH . WPINC . '/plugin.php' );
+require( ABSPATH . WPINC . '/default-filters.php' );
+require( ABSPATH . WPINC . '/pomo/mo.php' );
 
-/**
- * Copy an object.
- *
- * Returns a cloned copy of an object.
- *
- * @since 2.7.0
- *
- * @param object $object The object to clone
- * @return object The cloned object
- */
-function wp_clone( $object ) {
-       static $can_clone;
-       if ( !isset( $can_clone ) ) {
-               $can_clone = version_compare( phpversion(), '5.0', '>=' );
-       }
-       return $can_clone ? clone( $object ) : $object;
+// Initialize multisite if enabled.
+if ( is_multisite() ) {
+       require( ABSPATH . WPINC . '/ms-blogs.php' );
+       require( ABSPATH . WPINC . '/ms-settings.php' );
+} elseif ( ! defined( 'MULTISITE' ) ) {
+       define( 'MULTISITE', false );
 }
 
-/**
- * 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;
+// Stop most of WordPress from being loaded if we just want the basics.
+if ( SHORTINIT )
        return false;
-}
 
-if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
-       require_once (WP_CONTENT_DIR . '/object-cache.php');
-       $_wp_using_ext_object_cache = true;
-} else {
-       require_once (ABSPATH . WPINC . '/cache.php');
-       $_wp_using_ext_object_cache = false;
+// Load the l18n library.
+require( ABSPATH . WPINC . '/l10n.php' );
+
+// Run the installer if WordPress is not installed.
+wp_not_installed();
+
+// Load most of WordPress.
+require( ABSPATH . WPINC . '/formatting.php' );
+require( ABSPATH . WPINC . '/capabilities.php' );
+require( ABSPATH . WPINC . '/query.php' );
+require( ABSPATH . WPINC . '/theme.php' );
+require( ABSPATH . WPINC . '/user.php' );
+require( ABSPATH . WPINC . '/meta.php' );
+require( ABSPATH . WPINC . '/general-template.php' );
+require( ABSPATH . WPINC . '/link-template.php' );
+require( ABSPATH . WPINC . '/author-template.php' );
+require( ABSPATH . WPINC . '/post.php' );
+require( ABSPATH . WPINC . '/post-template.php' );
+require( ABSPATH . WPINC . '/category.php' );
+require( ABSPATH . WPINC . '/category-template.php' );
+require( ABSPATH . WPINC . '/comment.php' );
+require( ABSPATH . WPINC . '/comment-template.php' );
+require( ABSPATH . WPINC . '/rewrite.php' );
+require( ABSPATH . WPINC . '/feed.php' );
+require( ABSPATH . WPINC . '/bookmark.php' );
+require( ABSPATH . WPINC . '/bookmark-template.php' );
+require( ABSPATH . WPINC . '/kses.php' );
+require( ABSPATH . WPINC . '/cron.php' );
+require( ABSPATH . WPINC . '/deprecated.php' );
+require( ABSPATH . WPINC . '/script-loader.php' );
+require( ABSPATH . WPINC . '/taxonomy.php' );
+require( ABSPATH . WPINC . '/update.php' );
+require( ABSPATH . WPINC . '/canonical.php' );
+require( ABSPATH . WPINC . '/shortcodes.php' );
+require( ABSPATH . WPINC . '/media.php' );
+require( ABSPATH . WPINC . '/http.php' );
+require( ABSPATH . WPINC . '/class-http.php' );
+require( ABSPATH . WPINC . '/widgets.php' );
+require( ABSPATH . WPINC . '/nav-menu.php' );
+require( ABSPATH . WPINC . '/nav-menu-template.php' );
+
+// Load multisite-specific files.
+if ( is_multisite() ) {
+       require( ABSPATH . WPINC . '/ms-functions.php' );
+       require( ABSPATH . WPINC . '/ms-default-filters.php' );
+       require( ABSPATH . WPINC . '/ms-deprecated.php' );
 }
 
-wp_cache_init();
-if ( function_exists('wp_cache_add_global_groups') ) {
-       wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient'));
-       wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
-}
-
-require (ABSPATH . WPINC . '/plugin.php');
-require (ABSPATH . WPINC . '/default-filters.php');
-include_once(ABSPATH . WPINC . '/pomo/mo.php');
-require_once (ABSPATH . WPINC . '/l10n.php');
-
-if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
-       if ( defined('WP_SITEURL') )
-               $link = WP_SITEURL . '/wp-admin/install.php';
-       elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
-               $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
-       else
-               $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
-       require_once(ABSPATH . WPINC . '/kses.php');
-       require_once(ABSPATH . WPINC . '/pluggable.php');
-       require_once(ABSPATH . WPINC . '/formatting.php');
-       wp_redirect($link);
-       die(); // have to die here ~ Mark
-}
-
-require (ABSPATH . WPINC . '/formatting.php');
-require (ABSPATH . WPINC . '/capabilities.php');
-require (ABSPATH . WPINC . '/query.php');
-require (ABSPATH . WPINC . '/theme.php');
-require (ABSPATH . WPINC . '/user.php');
-require (ABSPATH . WPINC . '/meta.php');
-require (ABSPATH . WPINC . '/general-template.php');
-require (ABSPATH . WPINC . '/link-template.php');
-require (ABSPATH . WPINC . '/author-template.php');
-require (ABSPATH . WPINC . '/post.php');
-require (ABSPATH . WPINC . '/post-template.php');
-require (ABSPATH . WPINC . '/category.php');
-require (ABSPATH . WPINC . '/category-template.php');
-require (ABSPATH . WPINC . '/comment.php');
-require (ABSPATH . WPINC . '/comment-template.php');
-require (ABSPATH . WPINC . '/rewrite.php');
-require (ABSPATH . WPINC . '/feed.php');
-require (ABSPATH . WPINC . '/bookmark.php');
-require (ABSPATH . WPINC . '/bookmark-template.php');
-require (ABSPATH . WPINC . '/kses.php');
-require (ABSPATH . WPINC . '/cron.php');
-require (ABSPATH . WPINC . '/version.php');
-require (ABSPATH . WPINC . '/deprecated.php');
-require (ABSPATH . WPINC . '/script-loader.php');
-require (ABSPATH . WPINC . '/taxonomy.php');
-require (ABSPATH . WPINC . '/update.php');
-require (ABSPATH . WPINC . '/canonical.php');
-require (ABSPATH . WPINC . '/shortcodes.php');
-require (ABSPATH . WPINC . '/media.php');
-require (ABSPATH . WPINC . '/http.php');
-require (ABSPATH . WPINC . '/widgets.php');
-
-if ( !defined('WP_CONTENT_URL') )
-       define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
-
-/**
- * Allows for the plugins directory to be moved from the default location.
- *
- * @since 2.6.0
- */
-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
-
-/**
- * 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.
-
-/**
- * Allows for the mu-plugins directory to be moved from the default location.
- *
- * @since 2.8.0
- */
-if ( !defined('WPMU_PLUGIN_DIR') )
-       define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
-
-/**
- * Allows for the mu-plugins directory to be moved from the default location.
- *
- * @since 2.8.0
- */
-if ( !defined('WPMU_PLUGIN_URL') )
-       define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
+// Define constants that rely on the API to obtain the default value.
+// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
+wp_plugin_directory_constants( );
 
-/**
- * Allows for the mu-plugins directory to be moved from the default location.
- *
- * @since 2.8.0
- */
-if ( !defined( 'MUPLUGINDIR' ) )
-       define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
-
-if ( is_dir( WPMU_PLUGIN_DIR ) ) {
-       if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) {
-               while ( ( $plugin = readdir( $dh ) ) !== false ) {
-                       if ( substr( $plugin, -4 ) == '.php' ) {
-                               include_once( WPMU_PLUGIN_DIR . '/' . $plugin );
-                       }
-               }
-       }
+// Load must-use plugins.
+foreach ( wp_get_mu_plugins() as $mu_plugin ) {
+       include_once( $mu_plugin );
 }
-do_action('muplugins_loaded');
-
-/**
- * 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
- * @since 2.5.0
- */
-$wp_default_secret_key = 'put your unique phrase here';
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.0.0
- */
-if ( !defined('USER_COOKIE') )
-       define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.0.0
- */
-if ( !defined('PASS_COOKIE') )
-       define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.5.0
- */
-if ( !defined('AUTH_COOKIE') )
-       define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
+unset( $mu_plugin );
 
-/**
- * It is possible to define this in wp-config.php
- * @since 2.6.0
- */
-if ( !defined('SECURE_AUTH_COOKIE') )
-       define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
+do_action( 'muplugins_loaded' );
 
-/**
- * It is possible to define this in wp-config.php
- * @since 2.6.0
- */
-if ( !defined('LOGGED_IN_COOKIE') )
-       define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
+if ( is_multisite() )
+       ms_cookie_constants(  );
 
-/**
- * It is possible to define this in wp-config.php
- * @since 2.3.0
- */
-if ( !defined('TEST_COOKIE') )
-       define('TEST_COOKIE', 'wordpress_test_cookie');
+// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
+wp_cookie_constants( );
 
-/**
- * It is possible to define this in wp-config.php
- * @since 1.2.0
- */
-if ( !defined('COOKIEPATH') )
-       define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
+// Define and enforce our SSL constants
+wp_ssl_constants( );
 
-/**
- * It is possible to define this in wp-config.php
- * @since 1.5.0
- */
-if ( !defined('SITECOOKIEPATH') )
-       define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
+// Create common globals.
+require( ABSPATH . WPINC . '/vars.php' );
 
-/**
- * It is possible to define this in wp-config.php
- * @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
- * @since 2.6.0
- */
-if ( !defined('PLUGINS_COOKIE_PATH') )
-       define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.0.0
- */
-if ( !defined('COOKIE_DOMAIN') )
-       define('COOKIE_DOMAIN', false);
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.6.0
- */
-if ( !defined('FORCE_SSL_ADMIN') )
-       define('FORCE_SSL_ADMIN', false);
-force_ssl_admin(FORCE_SSL_ADMIN);
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.6.0
- */
-if ( !defined('FORCE_SSL_LOGIN') )
-       define('FORCE_SSL_LOGIN', false);
-force_ssl_login(FORCE_SSL_LOGIN);
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.5.0
- */
-if ( !defined( 'AUTOSAVE_INTERVAL' ) )
-       define( 'AUTOSAVE_INTERVAL', 60 );
-
-/**
- * It is possible to define this in wp-config.php
- * @since 2.9.0
- */
-if ( !defined( 'EMPTY_TRASH_DAYS' ) )
-       define( 'EMPTY_TRASH_DAYS', 30 );
-
-require (ABSPATH . WPINC . '/vars.php');
-
-// make taxonomies available to plugins and themes
-// @plugin authors: warning: this gets registered again on the init hook
+// Make taxonomies and posts available to plugins and themes.
+// @plugin authors: warning: these get registered again on the init hook.
 create_initial_taxonomies();
+create_initial_post_types();
 
-// Check for hacks file if the option is enabled
-if ( get_option('hack_file') ) {
-       if ( file_exists(ABSPATH . 'my-hacks.php') )
-               require(ABSPATH . 'my-hacks.php');
-}
-
-$current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
-if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
-       foreach ( $current_plugins as $plugin ) {
-               // check the $plugin filename
-               // Validate plugin filename
-               if ( validate_file($plugin) // $plugin must validate as file
-                       || '.php' != substr($plugin, -4) // $plugin must end with '.php'
-                       || !file_exists(WP_PLUGIN_DIR . '/' . $plugin)  // $plugin must exist
-                       )
-                       continue;
-
-               include_once(WP_PLUGIN_DIR . '/' . $plugin);
-       }
-       unset($plugin);
-}
-unset($current_plugins);
+// Load active plugins.
+foreach ( wp_get_active_and_valid_plugins() as $plugin )
+       include_once( $plugin );
+unset( $plugin );
 
-require (ABSPATH . WPINC . '/pluggable.php');
+// Load pluggable functions.
+require( ABSPATH . WPINC . '/pluggable.php' );
+require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
 
-/*
- * In most cases the default internal encoding is latin1, which is of no use,
- * since we want to use the mb_ functions for utf-8 strings
- */
-if (function_exists('mb_internal_encoding')) {
-       if (!@mb_internal_encoding(get_option('blog_charset')))
-               mb_internal_encoding('UTF-8');
-}
+// Set internal encoding.
+wp_set_internal_encoding();
 
-
-if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
+// Run wp_cache_postload() if object cache is enabled and the function exists.
+if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
        wp_cache_postload();
 
-do_action('plugins_loaded');
-
-$default_constants = array( 'WP_POST_REVISIONS' => true );
-foreach ( $default_constants as $c => $v )
-       @define( $c, $v ); // will fail if the constant is already defined
-unset($default_constants, $c, $v);
+do_action( 'plugins_loaded' );
 
-// If already slashed, strip.
-if ( get_magic_quotes_gpc() ) {
-       $_GET    = stripslashes_deep($_GET   );
-       $_POST   = stripslashes_deep($_POST  );
-       $_COOKIE = stripslashes_deep($_COOKIE);
-}
+// Define constants which affect functionality if not already defined.
+wp_functionality_constants( );
 
-// Escape with wpdb.
-$_GET    = add_magic_quotes($_GET   );
-$_POST   = add_magic_quotes($_POST  );
-$_COOKIE = add_magic_quotes($_COOKIE);
-$_SERVER = add_magic_quotes($_SERVER);
+// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
+wp_magic_quotes();
 
-// Force REQUEST to be GET + POST.  If SERVER, COOKIE, or ENV are needed, use those superglobals directly.
-$_REQUEST = array_merge($_GET, $_POST);
-
-do_action('sanitize_comment_cookies');
+do_action( 'sanitize_comment_cookies' );
 
 /**
  * WordPress Query object
@@ -651,21 +209,21 @@ $wp_the_query =& new WP_Query();
  * @global object $wp_query
  * @since 1.5.0
  */
-$wp_query     =& $wp_the_query;
+$wp_query =& $wp_the_query;
 
 /**
  * Holds the WordPress Rewrite object for creating pretty URLs
  * @global object $wp_rewrite
  * @since 1.5.0
  */
-$wp_rewrite   =& new WP_Rewrite();
+$wp_rewrite =& new WP_Rewrite();
 
 /**
  * WordPress Object
  * @global object $wp
  * @since 2.0.0
  */
-$wp           =& new WP();
+$wp =& new WP();
 
 /**
  * WordPress Widget Factory Object
@@ -674,34 +232,23 @@ $wp           =& new WP();
  */
 $wp_widget_factory =& new WP_Widget_Factory();
 
-do_action('setup_theme');
+do_action( 'setup_theme' );
 
-/**
- * Web Path to the current active template directory
- * @since 1.5.0
- */
-define('TEMPLATEPATH', get_template_directory());
-
-/**
- * Web Path to the current active template stylesheet directory
- * @since 2.1.0
- */
-define('STYLESHEETPATH', get_stylesheet_directory());
+// Define the template related constants.
+wp_templating_constants(  );
 
 // Load the default text localization domain.
 load_default_textdomain();
 
-/**
- * The locale of the blog
- * @since 1.5.0
- */
+// Find the blog locale.
 $locale = get_locale();
 $locale_file = WP_LANG_DIR . "/$locale.php";
-if ( is_readable($locale_file) )
-       require_once($locale_file);
+if ( is_readable( $locale_file ) )
+       require( $locale_file );
+unset($locale_file);
 
 // Pull in locale data after loading text domain.
-require_once(ABSPATH . WPINC . '/locale.php');
+require( ABSPATH . WPINC . '/locale.php' );
 
 /**
  * WordPress Locale object for loading locale domain date and various strings.
@@ -710,30 +257,49 @@ require_once(ABSPATH . WPINC . '/locale.php');
  */
 $wp_locale =& new WP_Locale();
 
-// Load functions for active theme.
-if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
-       include(STYLESHEETPATH . '/functions.php');
-if ( file_exists(TEMPLATEPATH . '/functions.php') )
-       include(TEMPLATEPATH . '/functions.php');
+// Load the functions for the active theme, for both parent and child theme if applicable.
+if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
+       include( STYLESHEETPATH . '/functions.php' );
+if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
+       include( TEMPLATEPATH . '/functions.php' );
 
-// Load in support for template functions which the theme supports
+do_action( 'after_setup_theme' );
+
+// Load any template functions the theme supports.
 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
 
+register_shutdown_function( 'shutdown_action_hook' );
+
+// Set up current user.
+$wp->init();
+
 /**
- * Runs just before PHP shuts down execution.
+ * Most of WP is loaded at this stage, and the user is authenticated. WP continues
+ * to load on the init hook that follows (e.g. widgets), and many plugins instantiate
+ * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
  *
- * @access private
- * @since 1.2.0
+ * If you wish to plug an action once WP is loaded, use the wp_loaded hook below.
  */
-function shutdown_action_hook() {
-       do_action('shutdown');
-       wp_cache_close();
-}
-register_shutdown_function('shutdown_action_hook');
-
-$wp->init();  // Sets up current user.
+do_action( 'init' );
 
-// Everything is loaded and initialized.
-do_action('init');
+// Check site status
+if ( is_multisite() ) {
+       if ( true !== ( $file = ms_site_check() ) ) {
+               require( $file );
+               die();
+       }
+       unset($file);
+}
 
+/**
+ * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
+ *
+ * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
+ * users not logged in.
+ *
+ * @link http://codex.wordpress.org/AJAX_in_Plugins
+ *
+ * @since 3.0.0
+ */
+do_action('wp_loaded');
 ?>
diff --git a/wp-signup.php b/wp-signup.php
new file mode 100644 (file)
index 0000000..cbea126
--- /dev/null
@@ -0,0 +1,456 @@
+<?php
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+add_action( 'wp_head', 'signuppageheaders' ) ;
+
+require( './wp-blog-header.php' );
+require_once( ABSPATH . WPINC . '/registration.php' );
+
+if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
+       wp_redirect( network_home_url() );
+       die();
+}
+
+function do_signup_header() {
+       do_action("signup_header");
+}
+add_action( 'wp_head', 'do_signup_header' );
+
+function signuppageheaders() {
+       echo "<meta name='robots' content='noindex,nofollow' />\n";
+}
+
+if ( !is_multisite() ) {
+       wp_redirect( get_option( 'siteurl' ) . "/wp-login.php?action=register" );
+       die();
+}
+
+if ( !is_main_site() ) {
+       wp_redirect( network_home_url( 'wp-signup.php' ) );
+       die();
+}
+
+// Fix for page title
+$wp_query->is_404 = false;
+
+function wpmu_signup_stylesheet() {
+       ?>
+       <style type="text/css">
+               .mu_register { width: 90%; margin:0 auto; }
+               .mu_register form { margin-top: 2em; }
+               .mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; }
+               .mu_register input[type="submit"],
+                       .mu_register #blog_title,
+                       .mu_register #user_email,
+                       .mu_register #blogname,
+                       .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
+               .mu_register .prefix_address,
+                       .mu_register .suffix_address {font-size: 18px;display:inline; }
+               .mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
+               .mu_register label.checkbox { display:inline; }
+               .mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
+       </style>
+       <?php
+}
+
+add_action( 'wp_head', 'wpmu_signup_stylesheet' );
+get_header();
+
+do_action( 'before_signup_form' );
+?>
+<div id="content" class="widecolumn">
+<div class="mu_register">
+<?php
+function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
+       global $current_site;
+       // Blog name
+       if ( !is_subdomain_install() )
+               echo '<label for="blogname">' . __('Site Name:') . '</label>';
+       else
+               echo '<label for="blogname">' . __('Site Domain:') . '</label>';
+
+       if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
+               <p class="error"><?php echo $errmsg ?></p>
+       <?php }
+
+       if ( !is_subdomain_install() )
+               echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
+       else
+               echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
+
+       if ( !is_user_logged_in() ) {
+               print '(<strong>' . __( 'Your address will be ' );
+               if ( !is_subdomain_install() )
+                       print $current_site->domain . $current_site->path . __( 'sitename' );
+               else
+                       print __( 'domain.' ) . $site_domain . $current_site->path;
+               echo '.</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
+       }
+
+       // Blog Title
+       ?>
+       <label for="blog_title"><?php _e('Site Title:') ?></label>
+       <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
+               <p class="error"><?php echo $errmsg ?></p>
+       <?php }
+       echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
+       ?>
+
+       <div id="privacy">
+        <p class="privacy-intro">
+            <label for="blog_public_on"><?php _e('Privacy:') ?></label>
+            <?php _e('Allow my site to appear in search engines like Google, Technorati, and in public listings around this network.'); ?>
+            <br style="clear:both" />
+            <label class="checkbox" for="blog_public_on">
+                <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
+                <strong><?php _e( 'Yes' ); ?></strong>
+            </label>
+            <label class="checkbox" for="blog_public_off">
+                <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
+                <strong><?php _e( 'No' ); ?></strong>
+            </label>
+        </p>
+       </div>
+
+       <?php
+       do_action('signup_blogform', $errors);
+}
+
+function validate_blog_form() {
+       $user = '';
+       if ( is_user_logged_in() )
+               $user = wp_get_current_user();
+
+       return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
+}
+
+function show_user_form($user_name = '', $user_email = '', $errors = '') {
+       // User name
+       echo '<label for="user_name">' . __('Username:') . '</label>';
+       if ( $errmsg = $errors->get_error_message('user_name') ) {
+               echo '<p class="error">'.$errmsg.'</p>';
+       }
+       echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
+       _e( '(Must be at least 4 characters, letters and numbers only.)' );
+       ?>
+
+       <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
+       <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
+               <p class="error"><?php echo $errmsg ?></p>
+       <?php } ?>
+       <input name="user_email" type="text" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?>
+       <?php
+       if ( $errmsg = $errors->get_error_message('generic') ) {
+               echo '<p class="error">' . $errmsg . '</p>';
+       }
+       do_action( 'signup_extra_fields', $errors );
+}
+
+function validate_user_form() {
+       return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
+}
+
+function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
+       global $current_user, $current_site;
+
+       if ( ! is_wp_error($errors) ) {
+               $errors = new WP_Error();
+       }
+
+       // allow definition of default variables
+       $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
+       $blogname = $filtered_results['blogname'];
+       $blog_title = $filtered_results['blog_title'];
+       $errors = $filtered_results['errors'];
+
+       echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';
+
+       if ( $errors->get_error_code() ) {
+               echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
+       }
+       ?>
+       <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p>
+
+       <?php
+       $blogs = get_blogs_of_user($current_user->ID);
+       if ( !empty($blogs) ) { ?>
+
+                       <p><?php _e( 'Sites you are already a member of:' ) ?></p>
+                       <ul>
+                               <?php foreach ( $blogs as $blog ) {
+                                       $home_url = get_home_url( $blog->userblog_id );
+                                       echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
+                               } ?>
+                       </ul>
+       <?php } ?>
+
+       <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
+       <form id="setupform" method="post" action="wp-signup.php">
+               <input type="hidden" name="stage" value="gimmeanotherblog" />
+               <?php do_action( "signup_hidden_fields" ); ?>
+               <?php show_blog_form($blogname, $blog_title, $errors); ?>
+               <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
+       </form>
+       <?php
+}
+
+function validate_another_blog_signup() {
+       global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
+       $current_user = wp_get_current_user();
+       if ( !is_user_logged_in() )
+               die();
+
+       $result = validate_blog_form();
+       extract($result);
+
+       if ( $errors->get_error_code() ) {
+               signup_another_blog($blogname, $blog_title, $errors);
+               return false;
+       }
+
+       $public = (int) $_POST['blog_public'];
+       $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated
+       $meta = apply_filters( 'add_signup_meta', $meta );
+
+       wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid );
+       confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
+       return true;
+}
+
+function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') {
+       ?>
+       <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
+       <p>
+               <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site.  <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?>
+       </p>
+       <?php
+       do_action( 'signup_finished' );
+}
+
+function signup_user($user_name = '', $user_email = '', $errors = '') {
+       global $current_site, $active_signup;
+
+       if ( !is_wp_error($errors) )
+               $errors = new WP_Error();
+       if ( isset( $_POST[ 'signup_for' ] ) )
+               $signup[ esc_html( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
+       else
+               $signup[ 'blog' ] = 'checked="checked"';
+
+       //TODO - This doesn't seem to do anything do we really need it?
+       $signup['user'] = isset( $signup['user'] ) ? $signup['user'] : '';
+
+       // allow definition of default variables
+       $filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
+       $user_name = $filtered_results['user_name'];
+       $user_email = $filtered_results['user_email'];
+       $errors = $filtered_results['errors'];
+
+       ?>
+
+       <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
+       <form id="setupform" method="post" action="wp-signup.php">
+               <input type="hidden" name="stage" value="validate-user-signup" />
+               <?php do_action( "signup_hidden_fields" ); ?>
+               <?php show_user_form($user_name, $user_email, $errors); ?>
+
+               <p>
+               <?php if ( $active_signup == 'blog' ) { ?>
+                       <input id="signupblog" type="hidden" name="signup_for" value="blog" />
+               <?php } elseif ( $active_signup == 'user' ) { ?>
+                       <input id="signupblog" type="hidden" name="signup_for" value="user" />
+               <?php } else { ?>
+                       <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> />
+                       <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
+                       <br />
+                       <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup['user'] ?> />
+                       <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
+               <?php } ?>
+               </p>
+
+               <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
+       </form>
+       <?php
+}
+
+function validate_user_signup() {
+       $result = validate_user_form();
+       extract($result);
+
+       if ( $errors->get_error_code() ) {
+               signup_user($user_name, $user_email, $errors);
+               return false;
+       }
+
+       if ( 'blog' == $_POST['signup_for'] ) {
+               signup_blog($user_name, $user_email);
+               return false;
+       }
+
+       wpmu_signup_user($user_name, $user_email, apply_filters( "add_signup_meta", array() ) );
+
+       confirm_user_signup($user_name, $user_email);
+       return true;
+}
+
+function confirm_user_signup($user_name, $user_email) {
+       ?>
+       <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2>
+       <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
+       <p><?php printf(__( 'Check your inbox at <strong>%1$s</strong> and click the link given.' ),  $user_email) ?></p>
+       <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
+       <?php
+       do_action( 'signup_finished' );
+}
+
+function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
+       if ( !is_wp_error($errors) )
+               $errors = new WP_Error();
+
+       // allow definition of default variables
+       $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
+       $user_name = $filtered_results['user_name'];
+       $user_email = $filtered_results['user_email'];
+       $blogname = $filtered_results['blogname'];
+       $blog_title = $filtered_results['blog_title'];
+       $errors = $filtered_results['errors'];
+
+       if ( empty($blogname) )
+               $blogname = $user_name;
+       ?>
+       <form id="setupform" method="post" action="wp-signup.php">
+               <input type="hidden" name="stage" value="validate-blog-signup" />
+               <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
+               <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
+               <?php do_action( "signup_hidden_fields" ); ?>
+               <?php show_blog_form($blogname, $blog_title, $errors); ?>
+               <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
+       </form>
+       <?php
+}
+
+function validate_blog_signup() {
+       // Re-validate user info.
+       $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
+       extract($result);
+
+       if ( $errors->get_error_code() ) {
+               signup_user($user_name, $user_email, $errors);
+               return false;
+       }
+
+       $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
+       extract($result);
+
+       if ( $errors->get_error_code() ) {
+               signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
+               return false;
+       }
+
+       $public = (int) $_POST['blog_public'];
+       $meta = array ('lang_id' => 1, 'public' => $public);
+       $meta = apply_filters( "add_signup_meta", $meta );
+
+       wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
+       confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
+       return true;
+}
+
+function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) {
+       ?>
+       <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
+
+       <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
+       <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email) ?></p>
+       <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
+       <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
+       <p>
+               <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
+               <ul id="noemail-tips">
+                       <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
+                       <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
+                       <li><?php printf( __( 'Have you entered your email correctly?  You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li>
+               </ul>
+       </p>
+       <?php
+       do_action( 'signup_finished' );
+}
+
+// Main
+$active_signup = get_site_option( 'registration' );
+if ( !$active_signup )
+       $active_signup = 'all';
+
+$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
+
+// Make the signup type translatable.
+$i18n_signup['all'] = _x('all', 'Multisite active signup type');
+$i18n_signup['none'] = _x('none', 'Multisite active signup type');
+$i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
+$i18n_signup['user'] = _x('user', 'Multisite active signup type');
+
+if ( is_super_admin() )
+       echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'ms-options.php' ) ) ) . '</div>';
+
+$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
+
+$current_user = wp_get_current_user();
+if ( $active_signup == "none" ) {
+       _e( 'Registration has been disabled.' );
+} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
+       if ( is_ssl() )
+               $proto = 'https://';
+       else
+               $proto = 'http://';
+       $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . '/wp-signup.php' ));
+       echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
+} else {
+       $stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default';
+       switch ( $stage ) {
+               case 'validate-user-signup' :
+                       if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
+                               validate_user_signup();
+                       else
+                               _e( 'User registration has been disabled.' );
+               break;
+               case 'validate-blog-signup':
+                       if ( $active_signup == 'all' || $active_signup == 'blog' )
+                               validate_blog_signup();
+                       else
+                               _e( 'Site registration has been disabled.' );
+                       break;
+               case 'gimmeanotherblog':
+                       validate_another_blog_signup();
+                       break;
+               case 'default':
+               default :
+                       $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
+                       do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
+                       if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
+                               signup_another_blog($newblogname);
+                       elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
+                               signup_user( $newblogname, $user_email );
+                       elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
+                               _e( 'Sorry, new registrations are not allowed at this time.' );
+                       else
+                               _e( 'You are logged in already. No need to register again!' );
+
+                       if ( $newblogname ) {
+                               $newblog = get_blogaddress_by_name( $newblogname );
+
+                               if ( $active_signup == 'blog' || $active_signup == 'all' )
+                                       printf( __( '<p><em>The site you were looking for, <strong>%s</strong> does not exist, but you can create it now!</em></p>' ), $newblog );
+                               else
+                                       printf( __( '<p><em>The site you were looking for, <strong>%s</strong>, does not exist.</em></p>' ), $newblog );
+                       }
+                       break;
+       }
+}
+?>
+</div>
+</div>
+<?php do_action( 'after_signup_form' ); ?>
+
+<?php get_footer(); ?>
index 864da720c3f777f6070f2db5e867c52b5c93db4a..737fbcecd5d17145a8647f77b1dbc90cae6df84e 100644 (file)
@@ -7,13 +7,13 @@
 
 if (empty($wp)) {
        require_once('./wp-load.php');
-       wp('tb=1');
+       wp( array( 'tb' => '1' ) );
 }
 
 /**
  * trackback_response() - Respond with error or success XML message
  *
- * @param int|bool $error Whether there was an error or not
+ * @param int|bool $error Whether there was an error
  * @param string $error_message Error message if an error occurred
  */
 function trackback_response($error = 0, $error_message = '') {
index 8e683b7569e145c6a019faba68d712fd2cb39d5b..fd471f26eead1e8fbb8dff62ba7e62b16f01e062 100644 (file)
@@ -246,7 +246,7 @@ class wp_xmlrpc_server extends IXR_Server {
         */
        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') ) );
+                       $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.  An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
                        return false;
                }
 
@@ -268,7 +268,7 @@ class wp_xmlrpc_server extends IXR_Server {
         */
        function login($username, $password) {
                if ( !get_option( 'enable_xmlrpc' ) ) {
-                       $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog.  An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
+                       $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.  An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
                        return false;
                }
 
@@ -279,7 +279,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return false;
                }
 
-               set_current_user( $user->ID );
+               wp_set_current_user( $user->ID );
                return $user;
        }
 
@@ -294,14 +294,13 @@ class wp_xmlrpc_server extends IXR_Server {
        function escape(&$array) {
                global $wpdb;
 
-               if(!is_array($array)) {
+               if (!is_array($array)) {
                        return($wpdb->escape($array));
-               }
-               else {
+               } else {
                        foreach ( (array) $array as $k => $v ) {
-                               if (is_array($v)) {
+                               if ( is_array($v) ) {
                                        $this->escape($array[$k]);
-                               } else if (is_object($v)) {
+                               } else if ( is_object($v) ) {
                                        //skip
                                } else {
                                        $array[$k] = $wpdb->escape($v);
@@ -370,7 +369,7 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
-        * Setup blog options property.
+        * Set up blog options property.
         *
         * Passes property through 'xmlrpc_blog_options' filter.
         *
@@ -392,7 +391,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                'value'                 => $wp_version
                        ),
                        'blog_url'                      => array(
-                               'desc'                  => __( 'Blog URL' ),
+                               'desc'                  => __( 'Site URL' ),
                                'readonly'              => true,
                                'option'                => 'siteurl'
                        ),
@@ -404,12 +403,12 @@ class wp_xmlrpc_server extends IXR_Server {
                                'option'                => 'gmt_offset'
                        ),
                        'blog_title'            => array(
-                               'desc'                  => __( 'Blog Title' ),
+                               'desc'                  => __( 'Site Title' ),
                                'readonly'              => false,
                                'option'                        => 'blogname'
                        ),
                        'blog_tagline'          => array(
-                               'desc'                  => __( 'Blog Tagline' ),
+                               'desc'                  => __( 'Site Tagline' ),
                                'readonly'              => false,
                                'option'                => 'blogdescription'
                        ),
@@ -442,8 +441,9 @@ class wp_xmlrpc_server extends IXR_Server {
         * @return array
         */
        function wp_getUsersBlogs( $args ) {
+               global $current_site;
                // If this isn't on WPMU then just use blogger_getUsersBlogs
-               if( !function_exists( 'is_site_admin' ) ) {
+               if ( !is_multisite() ) {
                        array_unshift( $args, 1 );
                        return $this->blogger_getUsersBlogs( $args );
                }
@@ -453,23 +453,23 @@ class wp_xmlrpc_server extends IXR_Server {
                $username = $args[0];
                $password = $args[1];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
+
 
                do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
 
                $blogs = (array) get_blogs_of_user( $user->ID );
                $struct = array( );
 
-               foreach( $blogs as $blog ) {
+               foreach ( $blogs as $blog ) {
                        // Don't include blogs that aren't hosted at this site
-                       if( $blog->site_id != $current_site->id )
+                       if ( $blog->site_id != $current_site->id )
                                continue;
 
                        $blog_id = $blog->userblog_id;
                        switch_to_blog($blog_id);
-                       $is_admin = current_user_can('level_8');
+                       $is_admin = current_user_can('manage_options');
 
                        $struct[] = array(
                                'isAdmin'               => $is_admin,
@@ -505,7 +505,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return $this->error;
                }
 
-               if( !current_user_can( 'edit_page', $page_id ) )
+               if ( !current_user_can( 'edit_page', $page_id ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
 
                do_action('xmlrpc_call', 'wp.getPage');
@@ -514,14 +514,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $page = get_page($page_id);
 
                // If we found the page then format the data.
-               if($page->ID && ($page->post_type == "page")) {
+               if ( $page->ID && ($page->post_type == "page") ) {
                        // Get all of the page content and link.
                        $full_page = get_extended($page->post_content);
                        $link = post_permalink($page->ID);
 
                        // Get info the page parent if there is one.
                        $parent_title = "";
-                       if(!empty($page->post_parent)) {
+                       if ( !empty($page->post_parent) ) {
                                $parent = get_page($page->post_parent);
                                $parent_title = $parent->post_title;
                        }
@@ -535,13 +535,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
 
                        // For drafts use the GMT version of the date
-                       if ( $page->post_status == 'draft' ) {
+                       if ( $page->post_status == 'draft' )
                                $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' );
-                       }
 
                        // Pull the categories info together.
                        $categories = array();
-                       foreach(wp_get_post_categories($page->ID) as $cat_id) {
+                       foreach ( wp_get_post_categories($page->ID) as $cat_id ) {
                                $categories[] = get_cat_name($cat_id);
                        }
 
@@ -549,7 +548,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        $author = get_userdata($page->post_author);
 
                        $page_template = get_post_meta( $page->ID, '_wp_page_template', true );
-                       if( empty( $page_template ) )
+                       if ( empty( $page_template ) )
                                $page_template = 'default';
 
                        $page_struct = array(
@@ -603,11 +602,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $num_pages      = isset($args[3]) ? (int) $args[3] : 10;
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_pages' ) )
+               if ( !current_user_can( 'edit_pages' ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
 
                do_action('xmlrpc_call', 'wp.getPages');
@@ -616,10 +614,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $num_pages = count($pages);
 
                // If we have pages, put together their info.
-               if($num_pages >= 1) {
+               if ( $num_pages >= 1 ) {
                        $pages_struct = array();
 
-                       for($i = 0; $i < $num_pages; $i++) {
+                       for ( $i = 0; $i < $num_pages; $i++ ) {
                                $page = wp_xmlrpc_server::wp_getPage(array(
                                        $blog_id, $pages[$i]->ID, $username, $password
                                ));
@@ -649,16 +647,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $page           = $args[3];
                $publish        = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'wp.newPage');
 
                // Make sure the user is allowed to add new pages.
-               if(!current_user_can("publish_pages")) {
+               if ( !current_user_can("publish_pages") )
                        return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
-               }
 
                // Mark this as content for a page.
                $args[3]["post_type"] = "page";
@@ -683,32 +679,25 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $page_id        = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'wp.deletePage');
 
                // Get the current page based on the page_id and
                // make sure it is a page and not a post.
                $actual_page = wp_get_single_post($page_id, ARRAY_A);
-               if(
-                       !$actual_page
-                       || ($actual_page["post_type"] != "page")
-               ) {
+               if ( !$actual_page || ($actual_page["post_type"] != "page") )
                        return(new IXR_Error(404, __("Sorry, no such page.")));
-               }
 
                // Make sure the user can delete pages.
-               if(!current_user_can("delete_page", $page_id)) {
+               if ( !current_user_can("delete_page", $page_id) )
                        return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
-               }
 
                // Attempt to delete the page.
                $result = wp_delete_post($page_id);
-               if(!$result) {
+               if ( !$result )
                        return(new IXR_Error(500, __("Failed to delete the page.")));
-               }
 
                return(true);
        }
@@ -730,25 +719,19 @@ class wp_xmlrpc_server extends IXR_Server {
                $content        = $args[4];
                $publish        = $args[5];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'wp.editPage');
 
                // Get the page data and make sure it is a page.
                $actual_page = wp_get_single_post($page_id, ARRAY_A);
-               if(
-                       !$actual_page
-                       || ($actual_page["post_type"] != "page")
-               ) {
+               if ( !$actual_page || ($actual_page["post_type"] != "page") )
                        return(new IXR_Error(404, __("Sorry, no such page.")));
-               }
 
                // Make sure the user is allowed to edit pages.
-               if(!current_user_can("edit_page", $page_id)) {
+               if ( !current_user_can("edit_page", $page_id) )
                        return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
-               }
 
                // Mark this as content for a page.
                $content["post_type"] = "page";
@@ -783,11 +766,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username                               = $args[1];
                $password                               = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_pages' ) )
+               if ( !current_user_can( 'edit_pages' ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
 
                do_action('xmlrpc_call', 'wp.getPageList');
@@ -807,7 +789,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                // The date needs to be formated properly.
                $num_pages = count($page_list);
-               for($i = 0; $i < $num_pages; $i++) {
+               for ( $i = 0; $i < $num_pages; $i++ ) {
                        $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
                        $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);
 
@@ -844,18 +826,16 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if(!current_user_can("edit_posts")) {
-                       return(new IXR_Error(401, __("Sorry, you cannot edit posts on this blog.")));
-               }
+               if ( !current_user_can("edit_posts") )
+                       return(new IXR_Error(401, __("Sorry, you cannot edit posts on this site.")));
 
                do_action('xmlrpc_call', 'wp.getAuthors');
 
                $authors = array();
-               foreach( (array) get_users_of_blog() as $row ) {
+               foreach ( (array) get_users_of_blog() as $row ) {
                        $authors[] = array(
                                "user_id"       => $row->user_id,
                                "user_login"    => $row->user_login,
@@ -881,19 +861,17 @@ class wp_xmlrpc_server extends IXR_Server {
                $username               = $args[1];
                $password               = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) ) {
-                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view tags.' ) );
-               }
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
 
                do_action( 'xmlrpc_call', 'wp.getKeywords' );
 
                $tags = array( );
 
-               if( $all_tags = get_tags( ) ) {
+               if ( $all_tags = get_tags() ) {
                        foreach( (array) $all_tags as $tag ) {
                                $struct['tag_id']                       = $tag->term_id;
                                $struct['name']                         = $tag->name;
@@ -925,22 +903,19 @@ class wp_xmlrpc_server extends IXR_Server {
                $password                               = $args[2];
                $category                               = $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'wp.newCategory');
 
                // Make sure the user is allowed to add a category.
-               if(!current_user_can("manage_categories")) {
+               if ( !current_user_can("manage_categories") )
                        return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
-               }
 
                // If no slug was provided make it empty so that
                // WordPress will generate one.
-               if(empty($category["slug"])) {
+               if ( empty($category["slug"]) )
                        $category["slug"] = "";
-               }
 
                // If no parent_id was provided make it empty
                // so that it will be a top level page (no parent).
@@ -948,9 +923,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        $category["parent_id"] = "";
 
                // If no description was provided make it empty.
-               if(empty($category["description"])) {
+               if ( empty($category["description"]) )
                        $category["description"] = "";
-               }
 
                $new_category = array(
                        "cat_name"                              => $category["name"],
@@ -960,9 +934,8 @@ class wp_xmlrpc_server extends IXR_Server {
                );
 
                $cat_id = wp_insert_category($new_category);
-               if(!$cat_id) {
+               if ( !$cat_id )
                        return(new IXR_Error(500, __("Sorry, the new category failed.")));
-               }
 
                return($cat_id);
        }
@@ -983,15 +956,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $password               = $args[2];
                $category_id    = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'wp.deleteCategory');
 
-               if( !current_user_can("manage_categories") ) {
+               if ( !current_user_can("manage_categories") )
                        return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
-               }
 
                return wp_delete_category( $category_id );
        }
@@ -1013,12 +984,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $category                               = $args[3];
                $max_results                    = (int) $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
 
                do_action('xmlrpc_call', 'wp.suggestCategories');
 
@@ -1050,12 +1020,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $comment_id     = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                if ( !current_user_can( 'moderate_comments' ) )
-                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
+                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
 
                do_action('xmlrpc_call', 'wp.getComment');
 
@@ -1106,6 +1075,7 @@ class wp_xmlrpc_server extends IXR_Server {
         * @return array
         */
        function wp_getComments($args) {
+               $raw_args = $args;
                $this->escape($args);
 
                $blog_id        = (int) $args[0];
@@ -1113,9 +1083,8 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $struct         = $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
@@ -1149,7 +1118,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                for ( $i = 0; $i < $num_comments; $i++ ) {
                        $comment = wp_xmlrpc_server::wp_getComment(array(
-                               $blog_id, $username, $password, $comments[$i]->comment_ID,
+                               $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID,
                        ));
                        $comments_struct[] = $comment;
                }
@@ -1173,12 +1142,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $comment_ID     = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                if ( !current_user_can( 'moderate_comments' ) )
-                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
+                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
 
                do_action('xmlrpc_call', 'wp.deleteComment');
 
@@ -1205,12 +1173,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $comment_ID     = (int) $args[3];
                $content_struct = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                if ( !current_user_can( 'moderate_comments' ) )
-                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
+                       return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
 
                do_action('xmlrpc_call', 'wp.editComment');
 
@@ -1356,12 +1323,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                if ( !current_user_can( 'moderate_comments' ) )
-                       return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
+                       return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
 
                do_action('xmlrpc_call', 'wp.getCommentStatusList');
 
@@ -1384,13 +1350,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $post_id        = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) ) {
+               if ( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
-               }
 
                do_action('xmlrpc_call', 'wp.getCommentCount');
 
@@ -1418,13 +1382,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) ) {
-                       return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
-               }
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
 
                do_action('xmlrpc_call', 'wp.getPostStatusList');
 
@@ -1446,13 +1408,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) ) {
-                       return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
-               }
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
 
                do_action('xmlrpc_call', 'wp.getPageStatusList');
 
@@ -1474,13 +1434,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_pages' ) ) {
-                       return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
-               }
+               if ( !current_user_can( 'edit_pages' ) )
+                       return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
 
                $templates = get_page_templates( );
                $templates['Default'] = 'default';
@@ -1504,14 +1462,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $options        = (array) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                // If no specific options where asked for, return all of them
-               if (count( $options ) == 0 ) {
+               if ( count( $options ) == 0 )
                        $options = array_keys($this->blog_options);
-               }
 
                return $this->_getOptions($options);
        }
@@ -1524,15 +1480,13 @@ class wp_xmlrpc_server extends IXR_Server {
         * @param array $options Options to retrieve.
         * @return array
         */
-       function _getOptions($options)
-       {
+       function _getOptions($options) {
                $data = array( );
-               foreach( $options as $option ) {
-                       if( array_key_exists( $option, $this->blog_options ) )
-                       {
+               foreach ( $options as $option ) {
+                       if ( array_key_exists( $option, $this->blog_options ) ) {
                                $data[$option] = $this->blog_options[$option];
                                //Is the value static or dynamic?
-                               if( isset( $data[$option]['option'] ) ) {
+                               if ( isset( $data[$option]['option'] ) ) {
                                        $data[$option]['value'] = get_option( $data[$option]['option'] );
                                        unset($data[$option]['option']);
                                }
@@ -1558,19 +1512,18 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $options        = (array) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'manage_options' ) )
+               if ( !current_user_can( 'manage_options' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
 
-               foreach( $options as $o_name => $o_value ) {
+               foreach ( $options as $o_name => $o_value ) {
                        $option_names[] = $o_name;
-                       if( !array_key_exists( $o_name, $this->blog_options ) )
+                       if ( !array_key_exists( $o_name, $this->blog_options ) )
                                continue;
 
-                       if( $this->blog_options[$o_name]['readonly'] == true )
+                       if ( $this->blog_options[$o_name]['readonly'] == true )
                                continue;
 
                        update_option( $this->blog_options[$o_name]['option'], $o_value );
@@ -1595,15 +1548,16 @@ class wp_xmlrpc_server extends IXR_Server {
         * @return array
         */
        function blogger_getUsersBlogs($args) {
+               if ( is_multisite() )
+                       return $this->_multisite_getUsersBlogs($args);
 
                $this->escape($args);
 
                $username = $args[1];
                $password  = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.getUsersBlogs');
 
@@ -1620,6 +1574,35 @@ class wp_xmlrpc_server extends IXR_Server {
                return array($struct);
        }
 
+       /**
+        * Private function for retrieving a users blogs for multisite setups
+        *
+        * @access protected
+        */
+       function _multisite_getUsersBlogs($args) {
+               global $current_blog;
+               $domain = $current_blog->domain;
+               $path = $current_blog->path . 'xmlrpc.php';
+               $protocol = is_ssl() ? 'https' : 'http';
+
+               $rpc = new IXR_Client("$protocol://{$domain}{$path}");
+               $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
+               $blogs = $rpc->getResponse();
+
+               if ( isset($blogs['faultCode']) )
+                       return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
+
+               if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
+                       return $blogs;
+               } else {
+                       foreach ( (array) $blogs as $blog ) {
+                               if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
+                                       return array($blog);
+                       }
+                       return array();
+               }
+       }
+
        /**
         * Retrieve user's data.
         *
@@ -1637,12 +1620,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $username = $args[1];
                $password  = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
 
                do_action('xmlrpc_call', 'blogger.getUserInfo');
 
@@ -1673,11 +1655,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username = $args[2];
                $password  = $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_post', $post_ID ) )
+               if ( !current_user_can( 'edit_post', $post_ID ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
 
                do_action('xmlrpc_call', 'blogger.getPost');
@@ -1717,21 +1698,20 @@ class wp_xmlrpc_server extends IXR_Server {
                $password  = $args[3];
                $num_posts  = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.getRecentPosts');
 
                $posts_list = wp_get_recent_posts($num_posts);
 
-               if (!$posts_list) {
+               if ( !$posts_list ) {
                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
                        return $this->error;
                }
 
                foreach ($posts_list as $entry) {
-                       if( !current_user_can( 'edit_post', $entry['ID'] ) )
+                       if ( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                        $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
@@ -1751,7 +1731,7 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                $recent_posts = array();
-               for ($j=0; $j<count($struct); $j++) {
+               for ( $j=0; $j<count($struct); $j++ ) {
                        array_push($recent_posts, $struct[$j]);
                }
 
@@ -1775,15 +1755,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $password  = $args[3];
                $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.getTemplate');
 
-               if ( !current_user_can('edit_themes') ) {
+               if ( !current_user_can('edit_themes') )
                        return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
-               }
 
                /* warning: here we make the assumption that the blog's URL is on the same server */
                $filename = get_option('home') . '/';
@@ -1817,15 +1795,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $content    = $args[4];
                $template   = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.setTemplate');
 
-               if ( !current_user_can('edit_themes') ) {
+               if ( !current_user_can('edit_themes') )
                        return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
-               }
 
                /* warning: here we make the assumption that the blog's URL is on the same server */
                $filename = get_option('home') . '/';
@@ -1859,15 +1835,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $content    = $args[4];
                $publish    = $args[5];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.newPost');
 
                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
                if ( !current_user_can($cap) )
-                       return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.'));
+                       return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
 
                $post_status = ($publish) ? 'publish' : 'draft';
 
@@ -1886,7 +1861,7 @@ class wp_xmlrpc_server extends IXR_Server {
                if ( is_wp_error( $post_ID ) )
                        return new IXR_Error(500, $post_ID->get_error_message());
 
-               if (!$post_ID)
+               if ( !$post_ID )
                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
 
                $this->attach_uploads( $post_ID, $post_content );
@@ -1914,17 +1889,15 @@ class wp_xmlrpc_server extends IXR_Server {
                $content     = $args[4];
                $publish     = $args[5];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.editPost');
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
-               if (!$actual_post || $actual_post['post_type'] != 'post') {
+               if ( !$actual_post || $actual_post['post_type'] != 'post' )
                        return new IXR_Error(404, __('Sorry, no such post.'));
-               }
 
                $this->escape($actual_post);
 
@@ -1944,9 +1917,9 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $result = wp_update_post($postdata);
 
-               if (!$result) {
+               if ( !$result )
                        return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
-               }
+
                $this->attach_uploads( $ID, $post_content );
 
                return true;
@@ -1968,26 +1941,23 @@ class wp_xmlrpc_server extends IXR_Server {
                $password   = $args[3];
                $publish     = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'blogger.deletePost');
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
-               if (!$actual_post || $actual_post['post_type'] != 'post') {
+               if ( !$actual_post || $actual_post['post_type'] != 'post' )
                        return new IXR_Error(404, __('Sorry, no such post.'));
-               }
 
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
 
                $result = wp_delete_post($post_ID);
 
-               if (!$result) {
+               if ( !$result )
                        return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
-               }
 
                return true;
        }
@@ -2013,76 +1983,63 @@ class wp_xmlrpc_server extends IXR_Server {
                $content_struct = $args[3];
                $publish     = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'metaWeblog.newPost');
 
                $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
-               $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
+               $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
                $post_type = 'post';
                $page_template = '';
-               if( !empty( $content_struct['post_type'] ) ) {
-                       if( $content_struct['post_type'] == 'page' ) {
+               if ( !empty( $content_struct['post_type'] ) ) {
+                       if ( $content_struct['post_type'] == 'page' ) {
                                $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
-                               $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' );
+                               $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
                                $post_type = 'page';
-                               if( !empty( $content_struct['wp_page_template'] ) )
+                               if ( !empty( $content_struct['wp_page_template'] ) )
                                        $page_template = $content_struct['wp_page_template'];
-                       }
-                       elseif( $content_struct['post_type'] == 'post' ) {
+                       } elseif ( $content_struct['post_type'] == 'post' ) {
                                // This is the default, no changes needed
-                       }
-                       else {
+                       } else {
                                // No other post_type values are allowed here
                                return new IXR_Error( 401, __( 'Invalid post type.' ) );
                        }
                }
 
-               if( !current_user_can( $cap ) ) {
+               if ( !current_user_can( $cap ) )
                        return new IXR_Error( 401, $error_message );
-               }
 
                // Let WordPress generate the post_name (slug) unless
                // one has been provided.
                $post_name = "";
-               if(isset($content_struct["wp_slug"])) {
+               if ( isset($content_struct["wp_slug"]) )
                        $post_name = $content_struct["wp_slug"];
-               }
 
                // Only use a password if one was given.
-               if(isset($content_struct["wp_password"])) {
+               if ( isset($content_struct["wp_password"]) )
                        $post_password = $content_struct["wp_password"];
-               }
 
                // Only set a post parent if one was provided.
-               if(isset($content_struct["wp_page_parent_id"])) {
+               if ( isset($content_struct["wp_page_parent_id"]) )
                        $post_parent = $content_struct["wp_page_parent_id"];
-               }
 
                // Only set the menu_order if it was provided.
-               if(isset($content_struct["wp_page_order"])) {
+               if ( isset($content_struct["wp_page_order"]) )
                        $menu_order = $content_struct["wp_page_order"];
-               }
 
                $post_author = $user->ID;
 
                // If an author id was provided then use it instead.
-               if(
-                       isset($content_struct["wp_author_id"])
-                       && ($user->ID != $content_struct["wp_author_id"])
-               ) {
-                       switch($post_type) {
+               if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+                       switch ( $post_type ) {
                                case "post":
-                                       if(!current_user_can("edit_others_posts")) {
+                                       if ( !current_user_can("edit_others_posts") )
                                                return(new IXR_Error(401, __("You are not allowed to post as this user")));
-                                       }
                                        break;
                                case "page":
-                                       if(!current_user_can("edit_others_pages")) {
+                                       if ( !current_user_can("edit_others_pages") )
                                                return(new IXR_Error(401, __("You are not allowed to create pages as this user")));
-                                       }
                                        break;
                                default:
                                        return(new IXR_Error(401, __("Invalid post type.")));
@@ -2096,8 +2053,8 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $post_status = $publish ? 'publish' : 'draft';
 
-               if( isset( $content_struct["{$post_type}_status"] ) ) {
-                       switch( $content_struct["{$post_type}_status"] ) {
+               if ( isset( $content_struct["{$post_type}_status"] ) ) {
+                       switch ( $content_struct["{$post_type}_status"] ) {
                                case 'draft':
                                case 'private':
                                case 'publish':
@@ -2105,9 +2062,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                        break;
                                case 'pending':
                                        // Pending is only valid for posts, not pages.
-                                       if( $post_type === 'post' ) {
+                                       if ( $post_type === 'post' )
                                                $post_status = $content_struct["{$post_type}_status"];
-                                       }
                                        break;
                                default:
                                        $post_status = $publish ? 'publish' : 'draft';
@@ -2120,9 +2076,9 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $tags_input = $content_struct['mt_keywords'];
 
-               if(isset($content_struct["mt_allow_comments"])) {
-                       if(!is_numeric($content_struct["mt_allow_comments"])) {
-                               switch($content_struct["mt_allow_comments"]) {
+               if ( isset($content_struct["mt_allow_comments"]) ) {
+                       if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+                               switch ( $content_struct["mt_allow_comments"] ) {
                                        case "closed":
                                                $comment_status = "closed";
                                                break;
@@ -2133,9 +2089,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                                $comment_status = get_option("default_comment_status");
                                                break;
                                }
-                       }
-                       else {
-                               switch((int) $content_struct["mt_allow_comments"]) {
+                       } else {
+                               switch ( (int) $content_struct["mt_allow_comments"] ) {
                                        case 0:
                                        case 2:
                                                $comment_status = "closed";
@@ -2148,14 +2103,13 @@ class wp_xmlrpc_server extends IXR_Server {
                                                break;
                                }
                        }
-               }
-               else {
+               } else {
                        $comment_status = get_option("default_comment_status");
                }
 
-               if(isset($content_struct["mt_allow_pings"])) {
-                       if(!is_numeric($content_struct["mt_allow_pings"])) {
-                               switch($content_struct['mt_allow_pings']) {
+               if ( isset($content_struct["mt_allow_pings"]) ) {
+                       if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+                               switch ( $content_struct['mt_allow_pings'] ) {
                                        case "closed":
                                                $ping_status = "closed";
                                                break;
@@ -2166,9 +2120,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                                $ping_status = get_option("default_ping_status");
                                                break;
                                }
-                       }
-                       else {
-                               switch((int) $content_struct["mt_allow_pings"]) {
+                       } else {
+                               switch ( (int) $content_struct["mt_allow_pings"] ) {
                                        case 0:
                                                $ping_status = "closed";
                                                break;
@@ -2180,14 +2133,12 @@ class wp_xmlrpc_server extends IXR_Server {
                                                break;
                                }
                        }
-               }
-               else {
+               } else {
                        $ping_status = get_option("default_ping_status");
                }
 
-               if ($post_more) {
+               if ( $post_more )
                        $post_content = $post_content . "<!--more-->" . $post_more;
-               }
 
                $to_ping = $content_struct['mt_tb_ping_urls'];
                if ( is_array($to_ping) )
@@ -2211,7 +2162,7 @@ class wp_xmlrpc_server extends IXR_Server {
                logIO('O', 'Post cats: ' . var_export($catnames,true));
                $post_category = array();
 
-               if (is_array($catnames)) {
+               if ( is_array($catnames) ) {
                        foreach ($catnames as $cat) {
                                $post_category[] = get_cat_ID($cat);
                        }
@@ -2224,20 +2175,19 @@ class wp_xmlrpc_server extends IXR_Server {
                if ( is_wp_error( $post_ID ) )
                        return new IXR_Error(500, $post_ID->get_error_message());
 
-               if (!$post_ID) {
+               if ( !$post_ID )
                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
-               }
 
                // Only posts can be sticky
-               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
+               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
                        if ( $content_struct['sticky'] == true )
                                stick_post( $post_ID );
                        elseif ( $content_struct['sticky'] == false )
                                unstick_post( $post_ID );
+               }
 
-               if ( isset($content_struct['custom_fields']) ) {
+               if ( isset($content_struct['custom_fields']) )
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
-               }
 
                // Handle enclosures
                $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
@@ -2250,7 +2200,7 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        function add_enclosure_if_new($post_ID, $enclosure) {
-               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
+               if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
 
                        $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
                        $found = false;
@@ -2264,9 +2214,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                        }
                                }
                        }
-                       if (!$found) {
+                       if (!$found)
                                add_post_meta( $post_ID, 'enclosure', $encstring );
-                       }
                }
        }
 
@@ -2283,11 +2232,10 @@ class wp_xmlrpc_server extends IXR_Server {
 
                // find any unattached files
                $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
-               if( is_array( $attachments ) ) {
-                       foreach( $attachments as $file ) {
-                               if( strpos( $post_content, $file->guid ) !== false ) {
+               if ( is_array( $attachments ) ) {
+                       foreach ( $attachments as $file ) {
+                               if ( strpos( $post_content, $file->guid ) !== false )
                                        $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
-                               }
                        }
                }
        }
@@ -2310,87 +2258,73 @@ class wp_xmlrpc_server extends IXR_Server {
                $content_struct = $args[3];
                $publish     = $args[4];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'metaWeblog.editPost');
 
                $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
-               $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
+               $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
                $post_type = 'post';
                $page_template = '';
-               if( !empty( $content_struct['post_type'] ) ) {
-                       if( $content_struct['post_type'] == 'page' ) {
+               if ( !empty( $content_struct['post_type'] ) ) {
+                       if ( $content_struct['post_type'] == 'page' ) {
                                $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
-                               $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' );
+                               $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
                                $post_type = 'page';
-                               if( !empty( $content_struct['wp_page_template'] ) )
+                               if ( !empty( $content_struct['wp_page_template'] ) )
                                        $page_template = $content_struct['wp_page_template'];
-                       }
-                       elseif( $content_struct['post_type'] == 'post' ) {
+                       } elseif ( $content_struct['post_type'] == 'post' ) {
                                // This is the default, no changes needed
-                       }
-                       else {
+                       } else {
                                // No other post_type values are allowed here
                                return new IXR_Error( 401, __( 'Invalid post type.' ) );
                        }
                }
 
-               if( !current_user_can( $cap ) ) {
+               if ( !current_user_can( $cap ) )
                        return new IXR_Error( 401, $error_message );
-               }
 
                $postdata = wp_get_single_post($post_ID, ARRAY_A);
 
                // If there is no post data for the give post id, stop
                // now and return an error.  Other wise a new post will be
                // created (which was the old behavior).
-               if(empty($postdata["ID"])) {
+               if ( empty($postdata["ID"]) )
                        return(new IXR_Error(404, __("Invalid post ID.")));
-               }
 
                $this->escape($postdata);
                extract($postdata, EXTR_SKIP);
 
                // Let WordPress manage slug if none was provided.
                $post_name = "";
-               if(isset($content_struct["wp_slug"])) {
+               if ( isset($content_struct["wp_slug"]) )
                        $post_name = $content_struct["wp_slug"];
-               }
 
                // Only use a password if one was given.
-               if(isset($content_struct["wp_password"])) {
+               if ( isset($content_struct["wp_password"]) )
                        $post_password = $content_struct["wp_password"];
-               }
 
                // Only set a post parent if one was given.
-               if(isset($content_struct["wp_page_parent_id"])) {
+               if ( isset($content_struct["wp_page_parent_id"]) )
                        $post_parent = $content_struct["wp_page_parent_id"];
-               }
 
                // Only set the menu_order if it was given.
-               if(isset($content_struct["wp_page_order"])) {
+               if ( isset($content_struct["wp_page_order"]) )
                        $menu_order = $content_struct["wp_page_order"];
-               }
 
                $post_author = $postdata["post_author"];
 
                // Only set the post_author if one is set.
-               if(
-                       isset($content_struct["wp_author_id"])
-                       && ($user->ID != $content_struct["wp_author_id"])
-               ) {
-                       switch($post_type) {
+               if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+                       switch ( $post_type ) {
                                case "post":
-                                       if(!current_user_can("edit_others_posts")) {
+                                       if ( !current_user_can("edit_others_posts") )
                                                return(new IXR_Error(401, __("You are not allowed to change the post author as this user.")));
-                                       }
                                        break;
                                case "page":
-                                       if(!current_user_can("edit_others_pages")) {
+                                       if ( !current_user_can("edit_others_pages") )
                                                return(new IXR_Error(401, __("You are not allowed to change the page author as this user.")));
-                                       }
                                        break;
                                default:
                                        return(new IXR_Error(401, __("Invalid post type.")));
@@ -2399,9 +2333,9 @@ class wp_xmlrpc_server extends IXR_Server {
                        $post_author = $content_struct["wp_author_id"];
                }
 
-               if(isset($content_struct["mt_allow_comments"])) {
-                       if(!is_numeric($content_struct["mt_allow_comments"])) {
-                               switch($content_struct["mt_allow_comments"]) {
+               if ( isset($content_struct["mt_allow_comments"]) ) {
+                       if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+                               switch ( $content_struct["mt_allow_comments"] ) {
                                        case "closed":
                                                $comment_status = "closed";
                                                break;
@@ -2412,9 +2346,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                                $comment_status = get_option("default_comment_status");
                                                break;
                                }
-                       }
-                       else {
-                               switch((int) $content_struct["mt_allow_comments"]) {
+                       } else {
+                               switch ( (int) $content_struct["mt_allow_comments"] ) {
                                        case 0:
                                        case 2:
                                                $comment_status = "closed";
@@ -2429,9 +2362,9 @@ class wp_xmlrpc_server extends IXR_Server {
                        }
                }
 
-               if(isset($content_struct["mt_allow_pings"])) {
-                       if(!is_numeric($content_struct["mt_allow_pings"])) {
-                               switch($content_struct["mt_allow_pings"]) {
+               if ( isset($content_struct["mt_allow_pings"]) ) {
+                       if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+                               switch ( $content_struct["mt_allow_pings"] ) {
                                        case "closed":
                                                $ping_status = "closed";
                                                break;
@@ -2442,9 +2375,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                                $ping_status = get_option("default_ping_status");
                                                break;
                                }
-                       }
-                       else {
-                               switch((int) $content_struct["mt_allow_pings"]) {
+                       } else {
+                               switch ( (int) $content_struct["mt_allow_pings"] ) {
                                        case 0:
                                                $ping_status = "closed";
                                                break;
@@ -2464,7 +2396,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $post_category = array();
 
-               if (is_array($catnames)) {
+               if ( is_array($catnames) ) {
                        foreach ($catnames as $cat) {
                                $post_category[] = get_cat_ID($cat);
                        }
@@ -2474,7 +2406,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $post_more = $content_struct['mt_text_more'];
 
                $post_status = $publish ? 'publish' : 'draft';
-               if( isset( $content_struct["{$post_type}_status"] ) ) {
+               if ( isset( $content_struct["{$post_type}_status"] ) ) {
                        switch( $content_struct["{$post_type}_status"] ) {
                                case 'draft':
                                case 'private':
@@ -2483,9 +2415,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                        break;
                                case 'pending':
                                        // Pending is only valid for posts, not pages.
-                                       if( $post_type === 'post' ) {
+                                       if ( $post_type === 'post' )
                                                $post_status = $content_struct["{$post_type}_status"];
-                                       }
                                        break;
                                default:
                                        $post_status = $publish ? 'publish' : 'draft';
@@ -2502,9 +2433,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
                }
 
-               if ($post_more) {
+               if ( $post_more )
                        $post_content = $post_content . "<!--more-->" . $post_more;
-               }
 
                $to_ping = $content_struct['mt_tb_ping_urls'];
                if ( is_array($to_ping) )
@@ -2531,20 +2461,19 @@ class wp_xmlrpc_server extends IXR_Server {
                if ( is_wp_error( $result ) )
                        return new IXR_Error(500, $result->get_error_message());
 
-               if (!$result) {
+               if ( !$result )
                        return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
-               }
 
                // Only posts can be sticky
-               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
+               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
                        if ( $content_struct['sticky'] == true )
                                stick_post( $post_ID );
                        elseif ( $content_struct['sticky'] == false )
                                unstick_post( $post_ID );
+               }
 
-               if ( isset($content_struct['custom_fields']) ) {
+               if ( isset($content_struct['custom_fields']) )
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
-               }
 
                // Handle enclosures
                $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
@@ -2572,11 +2501,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username  = $args[1];
                $password   = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_post', $post_ID ) )
+               if ( !current_user_can( 'edit_post', $post_ID ) )
                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
 
                do_action('xmlrpc_call', 'metaWeblog.getPost');
@@ -2588,9 +2516,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
 
                        // For drafts use the GMT version of the post date
-                       if ( $postdata['post_status'] == 'draft' ) {
+                       if ( $postdata['post_status'] == 'draft' )
                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
-                       }
 
                        $categories = array();
                        $catids = wp_get_post_categories($post_ID);
@@ -2617,9 +2544,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
 
                        // Consider future posts as published
-                       if( $postdata['post_status'] === 'future' ) {
+                       if ( $postdata['post_status'] === 'future' )
                                $postdata['post_status'] = 'publish';
-                       }
 
                        $sticky = false;
                        if ( is_sticky( $post_ID ) )
@@ -2631,7 +2557,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                        foreach ( (array) $val as $enc ) {
                                                $encdata = split("\n", $enc);
                                                $enclosure['url'] = trim(htmlspecialchars($encdata[0]));
-                                               $enclosure['length'] = trim($encdata[1]);
+                                               $enclosure['length'] = (int) trim($encdata[1]);
                                                $enclosure['type'] = trim($encdata[2]);
                                                break 2;
                                        }
@@ -2664,7 +2590,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                'sticky' => $sticky
                        );
 
-                       if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
+                       if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
 
                        return $resp;
                } else {
@@ -2689,35 +2615,31 @@ class wp_xmlrpc_server extends IXR_Server {
                $password   = $args[2];
                $num_posts   = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
 
                $posts_list = wp_get_recent_posts($num_posts);
 
-               if (!$posts_list) {
+               if ( !$posts_list )
                        return array( );
-               }
 
                foreach ($posts_list as $entry) {
-                       if( !current_user_can( 'edit_post', $entry['ID'] ) )
+                       if ( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                        $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
 
                        // For drafts use the GMT version of the date
-                       if ( $entry['post_status'] == 'draft' ) {
+                       if ( $entry['post_status'] == 'draft' )
                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
-                       }
 
                        $categories = array();
                        $catids = wp_get_post_categories($entry['ID']);
-                       foreach($catids as $catid) {
+                       foreach( $catids as $catid )
                                $categories[] = get_cat_name($catid);
-                       }
 
                        $tagnames = array();
                        $tags = wp_get_post_tags( $entry['ID'] );
@@ -2740,9 +2662,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
 
                        // Consider future posts as published
-                       if( $entry['post_status'] === 'future' ) {
+                       if ( $entry['post_status'] === 'future' )
                                $entry['post_status'] = 'publish';
-                       }
 
                        $struct[] = array(
                                'dateCreated' => new IXR_Date($post_date),
@@ -2772,7 +2693,7 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                $recent_posts = array();
-               for ($j=0; $j<count($struct); $j++) {
+               for ( $j=0; $j<count($struct); $j++ ) {
                        array_push($recent_posts, $struct[$j]);
                }
 
@@ -2795,18 +2716,17 @@ class wp_xmlrpc_server extends IXR_Server {
                $username  = $args[1];
                $password   = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
 
                do_action('xmlrpc_call', 'metaWeblog.getCategories');
 
                $categories_struct = array();
 
-               if ( $cats = get_categories('get=all') ) {
+               if ( $cats = get_categories(array('get' => 'all')) ) {
                        foreach ( $cats as $cat ) {
                                $struct['categoryId'] = $cat->term_id;
                                $struct['parentId'] = $cat->parent;
@@ -2849,9 +2769,8 @@ class wp_xmlrpc_server extends IXR_Server {
 
                logIO('O', '(MW) Received '.strlen($bits).' bytes');
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
 
@@ -2864,7 +2783,7 @@ class wp_xmlrpc_server extends IXR_Server {
                if ( $upload_err = apply_filters( "pre_upload_error", false ) )
                        return new IXR_Error(500, $upload_err);
 
-               if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
+               if ( !empty($data["overwrite"]) && ($data["overwrite"] == true) ) {
                        // Get postmeta info on the object.
                        $old_file = $wpdb->get_row("
                                SELECT ID
@@ -2904,7 +2823,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
 
-               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 ), 'upload' );
        }
 
        /* MovableType API functions
@@ -2928,30 +2847,28 @@ class wp_xmlrpc_server extends IXR_Server {
                $password   = $args[2];
                $num_posts   = (int) $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'mt.getRecentPostTitles');
 
                $posts_list = wp_get_recent_posts($num_posts);
 
-               if (!$posts_list) {
+               if ( !$posts_list ) {
                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
                        return $this->error;
                }
 
                foreach ($posts_list as $entry) {
-                       if( !current_user_can( 'edit_post', $entry['ID'] ) )
+                       if ( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                        $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
 
                        // For drafts use the GMT version of the date
-                       if ( $entry['post_status'] == 'draft' ) {
+                       if ( $entry['post_status'] == 'draft' )
                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
-                       }
 
                        $struct[] = array(
                                'dateCreated' => new IXR_Date($post_date),
@@ -2964,7 +2881,7 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                $recent_posts = array();
-               for ($j=0; $j<count($struct); $j++) {
+               for ( $j=0; $j<count($struct); $j++ ) {
                        array_push($recent_posts, $struct[$j]);
                }
 
@@ -2987,19 +2904,18 @@ class wp_xmlrpc_server extends IXR_Server {
                $username  = $args[1];
                $password   = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_posts' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
+               if ( !current_user_can( 'edit_posts' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
 
                do_action('xmlrpc_call', 'mt.getCategoryList');
 
                $categories_struct = array();
 
-               if ( $cats = get_categories('hide_empty=0&hierarchical=0') ) {
-                       foreach ($cats as $cat) {
+               if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
+                       foreach ( $cats as $cat ) {
                                $struct['categoryId'] = $cat->term_id;
                                $struct['categoryName'] = $cat->name;
 
@@ -3026,11 +2942,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username  = $args[1];
                $password   = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
-               if( !current_user_can( 'edit_post', $post_ID ) )
+               if ( !current_user_can( 'edit_post', $post_ID ) )
                        return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
 
                do_action('xmlrpc_call', 'mt.getPostCategories');
@@ -3039,7 +2954,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $catids = wp_get_post_categories(intval($post_ID));
                // first listed category will be the primary category
                $isPrimary = true;
-               foreach($catids as $catid) {
+               foreach ( $catids as $catid ) {
                        $categories[] = array(
                                'categoryName' => get_cat_name($catid),
                                'categoryId' => (string) $catid,
@@ -3068,16 +2983,15 @@ class wp_xmlrpc_server extends IXR_Server {
                $password   = $args[2];
                $categories  = $args[3];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'mt.setPostCategories');
 
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
 
-               foreach($categories as $cat) {
+               foreach ( $categories as $cat ) {
                        $catids[] = $cat['categoryId'];
                }
 
@@ -3099,7 +3013,7 @@ class wp_xmlrpc_server extends IXR_Server {
                do_action('xmlrpc_call', 'mt.supportedMethods');
 
                $supported_methods = array();
-               foreach($this->methods as $key=>$value) {
+               foreach ( $this->methods as $key => $value ) {
                        $supported_methods[] = $key;
                }
 
@@ -3136,18 +3050,16 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $actual_post = wp_get_single_post($post_ID, ARRAY_A);
 
-               if (!$actual_post) {
+               if ( !$actual_post )
                        return new IXR_Error(404, __('Sorry, no such post.'));
-               }
 
                $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
 
-               if (!$comments) {
+               if ( !$comments )
                        return array();
-               }
 
                $trackback_pings = array();
-               foreach($comments as $comment) {
+               foreach ( $comments as $comment ) {
                        if ( 'trackback' == $comment->comment_type ) {
                                $content = $comment->comment_content;
                                $title = substr($content, 8, (strpos($content, '</strong>') - 8));
@@ -3156,7 +3068,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                        'pingURL'   => $comment->comment_author_url,
                                        'pingIP'    => $comment->comment_author_IP
                                );
-               }
+                       }
                }
 
                return $trackback_pings;
@@ -3178,9 +3090,8 @@ class wp_xmlrpc_server extends IXR_Server {
                $username  = $args[1];
                $password   = $args[2];
 
-               if ( !$user = $this->login($username, $password) ) {
+               if ( !$user = $this->login($username, $password) )
                        return $this->error;
-               }
 
                do_action('xmlrpc_call', 'mt.publishPost');
 
@@ -3231,36 +3142,36 @@ class wp_xmlrpc_server extends IXR_Server {
 
                // Check if the page linked to is in our site
                $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
-               if( !$pos1 )
+               if ( !$pos1 )
                        return new IXR_Error(0, __('Is there no link to us?'));
 
                // let's find which post is linked to
                // FIXME: does url_to_postid() cover all these cases already?
                //        if so, then let's use it and drop the old code.
                $urltest = parse_url($pagelinkedto);
-               if ($post_ID = url_to_postid($pagelinkedto)) {
+               if ( $post_ID = url_to_postid($pagelinkedto) ) {
                        $way = 'url_to_postid()';
-               } elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
+               } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) {
                        // the path defines the post_ID (archives/p/XXXX)
                        $blah = explode('/', $match[0]);
                        $post_ID = (int) $blah[1];
                        $way = 'from the path';
-               } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
+               } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) {
                        // the querystring defines the post_ID (?p=XXXX)
                        $blah = explode('=', $match[0]);
                        $post_ID = (int) $blah[1];
                        $way = 'from the querystring';
-               } elseif (isset($urltest['fragment'])) {
+               } elseif ( isset($urltest['fragment']) ) {
                        // an #anchor is there, it's either...
-                       if (intval($urltest['fragment'])) {
+                       if ( intval($urltest['fragment']) ) {
                                // ...an integer #XXXX (simpliest case)
                                $post_ID = (int) $urltest['fragment'];
                                $way = 'from the fragment (numeric)';
-                       } elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
+                       } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
                                // ...a post id in the form 'post-###'
                                $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
                                $way = 'from the fragment (post-###)';
-                       } elseif (is_string($urltest['fragment'])) {
+                       } elseif ( is_string($urltest['fragment']) ) {
                                // ...or a string #title, a little more complicated
                                $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
                                $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title);
@@ -3292,10 +3203,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
 
                // Let's check that the remote site didn't already pingback this entry
-               $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) );
-
-               if ( $wpdb->num_rows ) // We already have a Pingback from this URL
-                       return new IXR_Error(48, __('The pingback has already been registered.'));
+               if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
+                       return new IXR_Error( 48, __( 'The pingback has already been registered.' ) );
 
                // very stupid, but gives time to the 'from' server to publish !
                sleep(1);
@@ -3395,26 +3304,25 @@ class wp_xmlrpc_server extends IXR_Server {
                $url = $args;
 
                $post_ID = url_to_postid($url);
-               if (!$post_ID) {
+               if ( !$post_ID ) {
                        // We aren't sure that the resource is available and/or pingback enabled
                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
                }
 
                $actual_post = wp_get_single_post($post_ID, ARRAY_A);
 
-               if (!$actual_post) {
+               if ( !$actual_post ) {
                        // No such post = resource not found
                        return new IXR_Error(32, __('The specified target URL does not exist.'));
                }
 
                $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
 
-               if (!$comments) {
+               if ( !$comments )
                        return array();
-               }
 
                $pingbacks = array();
-               foreach($comments as $comment) {
+               foreach ( $comments as $comment ) {
                        if ( 'pingback' == $comment->comment_type )
                                $pingbacks[] = $comment->comment_author_url;
                }